summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-05-31 22:40:17 +0200
committerJonas Smedegaard <dr@jones.dk>2025-06-07 08:55:45 +0200
commit09d5d6e1b00a7e493198cfeb684830c91bb66787 (patch)
tree4ce1a58429c6388b3f584e0c3b5d51bc892f254d
parent1d64a4f4f1931a8009d2431f625a9d7d5a12b170 (diff)
add and use filter extension graphics-noindent
-rw-r--r--_extensions/js/graphics-noindent/_extension.yml6
-rw-r--r--_extensions/js/graphics-noindent/graphics-noindent.lua15
-rw-r--r--_quarto.yml1
3 files changed, 22 insertions, 0 deletions
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
diff --git a/_quarto.yml b/_quarto.yml
index 2cd743e..5f1a402 100644
--- a/_quarto.yml
+++ b/_quarto.yml
@@ -70,4 +70,5 @@ resources:
filters:
- nobreaks
+ - graphics-noindent
- multicol-nohead