MkDocs PDF Generate Plugin
The pdf-generate plugin will generate separate PDF files for each markdown page in your MkDocs repository using WeasyPrint. The exported documents support many advanced features such as table of contents, customisable cover page, ability to control page orientation, support for CSS paged media module CSS paged media module , and using MkDocs page metadata to generate cover page.
Requirements
- This package requires MkDocs version 1.4.2 or higher (MkDocs <1.4.2 might work as well)
- Python 3.8 or higher
- WeasyPrint depends on cairo, Pango and GDK-PixBuf which need to be installed separately. Please follow the installation instructions for your platform carefully:
- Explicit support for your mkdocs theme is probably required. As of now, the only supported theme is mkdocs-material. A generic version will just generate the PDF files and put the download link into a
<link>
tag.
Installation
Install package with pip:
Install from source repository in a virtual environment:
cd [YOUR_PROJECT_DIRECTORY]
git clone https://github.com/iSOLveIT/mkdocs-pdf-generate
cd mkdocs-pdf-generate
pip install -e .
Enable the plugin in your mkdocs.yml
:
Note: If you have no
plugins
entry in your config file yet, you'll likely also want to add thesearch
plugin. MkDocs enables it by default if there is noplugins
entry set, but now you have to enable it explicitly.
More information about plugins in the MkDocs documentation.
Contributing
From reporting a bug to submitting a pull request: every contribution is appreciated and welcome. Report bugs, ask questions and request features using Github issues.
If you want to contribute to the code of this project, please read the Contribution Guidelines.
Special thanks
- Terry Zhao the author of the MkDocs PDF Export Plugin the source of our inspiration. We've used some of his code in this project.