zhaoterryy / mkdocs-pdf-export-plugin

An MkDocs plugin to export content pages as PDF files
MIT License
312 stars 43 forks source link

Rendering LaTeX output with Arithmatex MathJax #18

Closed crivetimihai closed 5 years ago

crivetimihai commented 5 years ago

I am using the pymdownx.arithmatex extension with the material theme, as described here: https://squidfunk.github.io/mkdocs-material/extensions/pymdown/#arithmatex-mathjax

This works great when rendering HTML, but doesn't translate to PDF when using pdf-export.

mkdocs.yml is configured with the extra_javascript for MathJax. Maybe I'm missing a CSS?

extra_css:
  - 'pdf.css'

extra_javascript:
  - 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML'

Thanks!

shauser commented 5 years ago

weasyprint will never run any JS code. If you want anything to be rendered, it has to be in the initial HTML DOM. Basically, for this to work, you'd have to implement a python plugin which renders the TeX Math to an image during build time.