adrienbrignon / mkdocs-exporter

⚡ The fastest and most configurable plugin for MkDocs, allowing seamless export of individual pages or entire documentation as PDF documents.
https://adrienbrignon.github.io/mkdocs-exporter/
MIT License
71 stars 2 forks source link

mermaid prints as code #19

Closed wbste closed 6 months ago

wbste commented 6 months ago

Does this plugin render mermaid.js correctly?

My PDFs render Mermaid as code, while the website renders the diagram. Docs here: https://squidfunk.github.io/mkdocs-material/reference/diagrams/

Edit: nevermind, you obviously publish mermaid fine: https://adrienbrignon.github.io/mkdocs-exporter/samples/diagrams/

r-b-g-b commented 1 month ago

For posterity, to get MermaidJS to render as a diagram:

  1. Include the mkdocs-exporter.js file in my docs/assets/scripts directory

  2. Add the extra_javascript to mkdocs.yml (following the example from this repo's mkdocs.yml

    extra_javascript:
      - assets/scripts/mkdocs-exporter.js
      - https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.9.1/mermaid.min.js  

Thanks for the great extension!

adrienbrignon commented 1 month ago

For posterity, to get MermaidJS to render as a diagram:

  1. Include the mkdocs-exporter.js file in my docs/assets/scripts directory
  2. Add the extra_javascript to mkdocs.yml (following the example from this repo's mkdocs.yml
    extra_javascript:
     - assets/scripts/mkdocs-exporter.js
     - https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.9.1/mermaid.min.js  

Thanks for the great extension!

I will make sure to add this to the documentation. Thank you @r-b-g-b!

pxc commented 3 weeks ago

Thanks @r-b-g-b

I've been trying to work out how to get my MathJax formulas (via arithmatex) to render in the PDF export, and this was the same solution for that.

marekzukal commented 2 weeks ago

Hi, I have the same issue. I have coppied the mkdocs-exporter.js into my docs directory and I have the extra_javascript in my yml file. Yet, the diagrams are displayed as code in my pdf. None of the debug options provided anything helpful. Can you please advise what else and how to check? Thank you.

marekzukal commented 2 weeks ago

for example, when I try to mangle the script name, to check is the yml script used properly, I get this error: ERROR - [mkdocs-exporter.pdf.browser] (error) RS5 documentation description - RS5 Documentation Failed to load resource: net::ERR_FILE_NOT_FOUND So I guess it shows that the script is located where it should be

adrienbrignon commented 2 weeks ago

Hello @marekzukal,

To help you investigate the problem further, could you please provide a minimal, reproducible example? It would be very helpful if you could either provide a repository or some code snippets.

Thanks,

marekzukal commented 1 week ago

Thank you, @adrienbrignon, for the quick reply. I cloned the exporter git repository to try out your example config, installed deps into my venv and even in my project the Mermaid diagrams started working. I suspect some package of the dependencies was missing. So definitely a problem on my side. Sorry about that. I am still quite new to the world of python, pip and so on. Pity there was no error message that could point me to the right direction.

just FYI, a list of packages I was missing, probably Cairo is the crucial one.

csscompressor mkdocstrings_python CairoSVG griffe GitPython cairocffi