timofurrer / pandoc-mermaid-filter

Pandoc filter for mermaid code blocks
MIT License
75 stars 21 forks source link

Text is cut-off in labels workaround for use with this pandoc-filter #8

Open ghost opened 4 years ago

ghost commented 4 years ago

This is not really an issue, but a workaround I would like to share with other users.

This issue has a proposed workaround which requires that I pass the -c option with a config file to mermaid. In this pandoc filter I did not find a way to pass this option (correct me if I'm wrong), so I found a workaround.

I added the -c option in the mmdc.cmd file directly to pass the CSS:

@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe"  "%~dp0\..\mermaid.cli\index.bundle.js" %* "-c" "c:\Users\username\node_modules\mermaid.cli\mermaid-config.json"
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node  "%~dp0\..\mermaid.cli\index.bundle.js" %* "-c" "c:\Users\username\node_modules\mermaid.cli\mermaid-config.json"
)

Where mermaid-config.json looks like:

{
    "themeCSS": ".label foreignObject { font-size: 14px; }"
}

Now the charts rendered by this filter show the labels correctly again.

timofurrer commented 4 years ago

Thanks! Should we maybe add an env variable for options or something like that?

ghost commented 4 years ago

Thanks! Should we maybe add an env variable for options or something like that?

That would be great of course, e.g. a MERMAID_CFG similar to the PUPPETEER_CFG