pandoc-ext / diagram

Generate diagrams from embedded code; supports Mermaid, Dot/GraphViz, PlantUML, Asymptote, CeTZ, and TikZ.
MIT License
94 stars 11 forks source link

Cant get diagram.lua to work with tikz #46

Open MoritzBeroRoos opened 1 month ago

MoritzBeroRoos commented 1 month ago

Hi, im sorry but i have to ask if i miss something obvious. What i have done on a fresh ubuntu system:

Some more math $\mathbb{R}$.


Now i call pandoc like this

pandoc input.tex -o output.html -f latex -t html --embed-resources --lua-filter=diagram.lua

**Expected outcome:**
An output.html file containg an svg div.

**Actual outcome:**
output.html
```html
<p>Some math <span class="math inline"><em>x</em><sup>2</sup></span>.
Here is a circle:</p>
<p>Some more math <span class="math inline">ℝ</span>.</p>

There is no image clue to be seen. Also the conversion is extremely fast, which makes me doubt that inkscape has been used. (if i start inkscape as a gui it takes a few seconds). I get no errors or warnings that i can see. Also i get the exact same output file if i leave the filter out completely:

pandoc input.tex -o output.html -f latex -t html --embed-resources

Is there something i have to install to use this package?

tarleb commented 1 month ago

The filter expects code blocks, so it works best with markdown, rst, org, etc, where it's relatively easy to create such blocks. tikzpictures environments are skipped by the LaTeX reader (or parsed as RawBlock elements with +raw_tex), so one would need a filter to change those elements to something that this filter expects.

See also https://github.com/jgm/pandoc/discussions/10270