A highly-configurable plugin for MkDocs that exports your pages to PDF files.
Project description
MkDocs Exporter
A highly-configurable plugin for MkDocs that exports your pages to PDF files.
Features
- 🚀 Fast - PDF documents are generated concurrently!
- 🎨 Customizable - full control over the resulting documents
- Cover pages (supports
macros
plugin) - Define custom scripts and stylesheets to customize your PDF documents
- Define "buttons" at the top of your documentation pages (example)
- Compatible with
material
andreadthedocs
themes- Check out some sample PDF documents here
- Cover pages (supports
- ⭐ Powerful - it uses a headless browser and some awesome libraries under the hood to generate PDF files
- Playwright to automate browsers
- Paged.js polyfills are included (Paged Media and Generated Content CSS modules)
- Sass support (via
libsass
) for your stylesheets
Prerequisites
- Python
>= 3.7
- MkDocs
>= 1.4
Installation
The plugin is hosted on PyPI and can be installed via pip
(or your favourite package manager):
pip install mkdocs-exporter
Usage
Three plugins are currently available:
mkdocs/exporter
(required): base plugin which must precede the othersmkdocs/exporter/pdf
(optional): plugin that exports your pages as individual PDF documentsmkdocs/exporter/extras
(optional): provides extra functionalities (buttons, HTML utilities...)
Example
The following configuration excerpt from mkdocs.yml
should cover the basic functionalities of this plugin:
plugins:
- mkdocs/exporter
- mkdocs/exporter/pdf:
concurrency: 8
covers:
front: resources/templates/covers/front.html.j2
back: resources/templates/covers/back.html.j2
stylesheets:
- resources/stylesheets/pdf.scss
- mkdocs/exporter/extras:
buttons:
- title: Download as PDF
enabled: !!python/name:mkdocs_exporter.plugins.pdf.button.enabled
icon: !!python/name:mkdocs_exporter.plugins.pdf.button.icon
attributes:
href: !!python/name:mkdocs_exporter.plugins.pdf.button.href
download: !!python/name:mkdocs_exporter.plugins.pdf.button.download
Check out a sample PDF generated by this plugin from the default page of the Material for MkDocs theme.
It has been built with some custom CSS and features cover pages.
Roadmap
- Combine all pages as one PDF
Feel free to request additional features by submitting an issue or by contributing through a pull request.
License
This project is licensed under the MIT License (MIT)
, which you can read here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mkdocs_exporter-4.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 179174cf6246488ce5b8b3ff7715e007dce354a9b0d1864986692a9650fae0e6 |
|
MD5 | 4cb840f7b63b6d5812e744034eaeca6d |
|
BLAKE2b-256 | 65eb0701e8a519b44504dcf8bd9959fc5ea433802fb297844a81b22e477a8ab1 |