diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-04-10 11:34:54 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-04-10 11:34:54 +0200 |
| commit | 099b16b2876d385624b8ad00914fa47ab396f40b (patch) | |
| tree | 9b645727305b4c9270e68602468f231b1929ea55 /pandoc/center-img.lua | |
| parent | 6efec10a335bc2553106d272bf786196a7cfa041 (diff) | |
| download | unterricht-099b16b2876d385624b8ad00914fa47ab396f40b.tar.gz unterricht-099b16b2876d385624b8ad00914fa47ab396f40b.zip | |
pandoc: allow to include other files
The following block will inlcude a second markdown file:
```{.include}
path/to/other/markdown/file.md
```
Move all used pandoc filters from the latex/ base directory into
a new pandoc/ directory.
Diffstat (limited to 'pandoc/center-img.lua')
| -rw-r--r-- | pandoc/center-img.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pandoc/center-img.lua b/pandoc/center-img.lua new file mode 100644 index 00000000..18782725 --- /dev/null +++ b/pandoc/center-img.lua @@ -0,0 +1,20 @@ +-- Based on: +-- https://pandoc.org/lua-filters.html#center-images-in-latex-and-html-output +-- Licensed under MIT License found at: +-- https://github.com/TomBener/pandoc-templates/blob/05aba224519d8a2b037108948bde0d820860b786/LICENSE + +-- Filter images with this function if the target format is LaTeX. +if FORMAT:match('beamer') then + function Image(elem) + -- Surround all images with the 'center' class with image-centering raw LaTeX. + if elem.classes[1] == "center" then + return { + pandoc.RawInline('latex', '\\hfill\\break{\\centering'), + elem, + pandoc.RawInline('latex', '\\par}') + } + else + return elem + end + end +end |
