From 09d5d6e1b00a7e493198cfeb684830c91bb66787 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 31 May 2025 22:40:17 +0200 Subject: add and use filter extension graphics-noindent --- _extensions/js/graphics-noindent/_extension.yml | 6 ++++++ _extensions/js/graphics-noindent/graphics-noindent.lua | 15 +++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 _extensions/js/graphics-noindent/_extension.yml create mode 100644 _extensions/js/graphics-noindent/graphics-noindent.lua (limited to '_extensions/js/graphics-noindent') diff --git a/_extensions/js/graphics-noindent/_extension.yml b/_extensions/js/graphics-noindent/_extension.yml new file mode 100644 index 0000000..81c5276 --- /dev/null +++ b/_extensions/js/graphics-noindent/_extension.yml @@ -0,0 +1,6 @@ +title: Graphics-NoIndent +author: Jonas Smedegaard +version: 0.0.1 +contributes: + filters: + - graphics-noindent.lua diff --git a/_extensions/js/graphics-noindent/graphics-noindent.lua b/_extensions/js/graphics-noindent/graphics-noindent.lua new file mode 100644 index 0000000..2f3a140 --- /dev/null +++ b/_extensions/js/graphics-noindent/graphics-noindent.lua @@ -0,0 +1,15 @@ +-- Disable indentation when a paragraph exclusively contains an image + +local noindent = pandoc.RawInline('latex', [[ +\noindent +]]) + +function Para(elem) + if FORMAT:match 'latex' then + if elem.content[1].t == 'Image' then + new_elem = elem + new_elem.content:insert(1, noindent) + return new_elem + end + end +end -- cgit v1.2.3