Closed y9c closed 6 years ago
There are a few pandoc filters that support mermaid diagram generation. This one seems to do the job: https://github.com/timofurrer/pandoc-mermaid-filter, but theres also this one https://github.com/raghur/mermaid-filter.
Could you please show me how to use it with pandoc-latex-template?
The first link has a usage example right there:
Usage
Install it with pip:
pip install pandoc-mermaid-filter
And use it like any other pandoc filter:
pandoc tests/sample.md -o sample.pdf --filter pandoc-mermaid
The mermaid binary must be in your
$PATH
or can be set with theMERMAID_BIN
environment variable.
The command could look like this:
pandoc example.md -o example.pdf --from markdown --template eisvogel --listings --filter pandoc-mermaid
Thank you @Wandmalfarbe
I run a demo with this command.
pandoc example.md -o example.pdf --from markdown --template eisvogel.tex --listings --filter pandoc-mermaid --latex-engine=xelatex
I seems that mermaid graphic is render as low resolution png as default, how can I set output format and theme of the diagram in cli.
I have install these packages.
https://github.com/mermaidjs/mermaid.cli https://github.com/timofurrer/pandoc-mermaid-filter
Usage: mmdc [options]
Options:
-V, --version output the version number
-t, --theme [theme] Theme of the chart, could be default, forest, dark or neutral. Optional. Default: default (default: default)
-w, --width [width] Width of the page. Optional. Default: 800 (default: 800)
-H, --height [height] Height of the page. Optional. Default: 600 (default: 600)
-i, --input <input> Input mermaid file. Required.
-o, --output [output] Output file. It should be either svg, png or pdf. Optional. Default: input + ".svg"
-b, --backgroundColor [backgroundColor] Background color. Example: transparent, red, '#F0F0F0'. Optional. Default: white
-c, --configFile [configFile] JSON configuration file for mermaid. Optional
-C, --cssFile [cssFile] CSS file for the page. Optional
-p --puppeteerConfigFile [puppeteerConfigFile] JSON configuration file for puppeteer. Optional
-h, --help output usage information
BTW, it seems that it is not a good solution to rendering mermaid in this way, which is extremely heavy.
pandoc
--> eisvogel
+ pandoc-mermaid
--> mermaid.cli
--> mermaid
--> puppeteer
--> chromium
...
The tikz way ( #36 ) works now, but it complicated the markdown file.
mermaid
is powerful in generating diagram in markdown file.https://github.com/knsv/mermaid