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

Correct macro use #18

Closed wbste closed 6 months ago

wbste commented 6 months ago

Hello, I was trying to get you example template to fill in the jinja2 fields but I never could. I made sure mkdocs-macros was installed and I was able to load the config test just fine on my home page with {{ macros_info() }}

When creating the PDFs I get no errors, and the resulting PDF looks perfect, except the field are still just the field {{ whatever }}.

I feel like there's some config I'm missing but I'm at a loss. Any idea where to look next?

Other then that thanks so much for this extension. Makes a beautiful PDF!

adrienbrignon commented 6 months ago

Hello @wbste,

Did you make sure to load the exporter plugin before the macros one? It should work out of the box.

For reference, feel free to check out the mkdocs.yml configuration file used for this project's documentation.

wbste commented 6 months ago

🤦 You're the man. Thanks so much!

wbste commented 6 months ago

@adrienbrignon QQ if you don't mind. Is there a way to use the page name to generate the PDF? In other words, instead of every PDF being index.pdf, it'd be nice if it was based off the page name (less work for an end user to download/rename files). Let me know if that's worthy or another issue or not.

adrienbrignon commented 6 months ago

Of course!

You should be able to do so by creating a Python functions that returns the page's name and reference it as the download attribute of the button.

See this page for more details.


Forgot to mention the existence of mkdocs_exporter.plugins.pdf.button.download; the project's documentation uses it. It should give you the expected behavior.

wbste commented 6 months ago

Nevermind, fixed it.

Changed this line to get the folder index.html is in and use that for the filename.