Metadata-Version: 2.5
Name: mkdocs-exporter
Version: 7.0.0
Summary: Exports MkDocs and Zensical documentation to PDF: a document per page and combined books, printed by Chromium.
Project-URL: Homepage, https://adrienbrignon.github.io/mkdocs-exporter
Project-URL: Documentation, https://adrienbrignon.github.io/mkdocs-exporter
Project-URL: Repository, https://github.com/adrienbrignon/mkdocs-exporter
Project-URL: Issues, https://github.com/adrienbrignon/mkdocs-exporter/issues
Project-URL: Changelog, https://github.com/adrienbrignon/mkdocs-exporter/blob/master/CHANGELOG.md
Author-email: Adrien Brignon <adrien@brignon.dev>
License-Expression: MIT
License-File: LICENSE
Keywords: chromium,exporter,mkdocs,mkdocs-plugin,pdf,playwright,properdocs,zensical
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: MkDocs
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Documentation
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Text Processing :: Markup :: HTML
Requires-Python: >=3.11.5
Requires-Dist: beautifulsoup4>=4.13
Requires-Dist: click>=8.1
Requires-Dist: jinja2>=3.1
Requires-Dist: lxml>=6.1
Requires-Dist: mkdocs<2,>=1.6
Requires-Dist: playwright>=1.53
Requires-Dist: pypdf>=6.16
Requires-Dist: tinycss2>=1.3
Description-Content-Type: text/markdown

# MkDocs Exporter

<div>
  <a href="https://pypi.org/project/mkdocs-exporter">
    <img alt="PyPI version" src="https://img.shields.io/pypi/v/mkdocs-exporter?color=blue">
  </a>
  <a href="https://pypi.org/project/mkdocs-exporter">
    <img alt="Python versions" src="https://img.shields.io/pypi/pyversions/mkdocs-exporter?color=blue">
  </a>
  <a href="https://pypi.org/project/mkdocs-exporter">
    <img alt="Monthly downloads" src="https://img.shields.io/pypi/dm/mkdocs-exporter?color=blue">
  </a>
  <a href="https://github.com/adrienbrignon/mkdocs-exporter/blob/master/LICENSE">
    <img alt="License" align="right" src="https://img.shields.io/github/license/adrienbrignon/mkdocs-exporter?color=white">
  </a>
</div>
<a href="https://adrienbrignon.github.io/mkdocs-exporter/getting-started/">
  <img alt="A page of this documentation and its PDF document" src="https://github.com/adrienbrignon/mkdocs-exporter/assets/10183277/85c768f6-fe27-43a1-998c-ac89e926cba1" align="right" width="350">
</a>
<br />

Exports your [*MkDocs*](https://github.com/mkdocs/mkdocs), [*ProperDocs*](https://github.com/ProperDocs/properdocs) and [*Zensical*](https://zensical.org/) documentation to PDF: a document for each page, and books combining pages into a single document.

- [Documentation](https://adrienbrignon.github.io/mkdocs-exporter)
- [PyPI](https://pypi.org/project/mkdocs-exporter)
- [Examples](https://adrienbrignon.github.io/mkdocs-exporter/examples/)

## Features

- 📚 **Books** - combine pages into PDF documents with bookmarks, a table of contents and working links
- 🎨 **Customizable** - full control over the resulting documents
  - [Cover pages](https://adrienbrignon.github.io/mkdocs-exporter/guide/cover-pages/) written as Jinja templates
  - [Headers and footers](https://adrienbrignon.github.io/mkdocs-exporter/guide/headers-and-footers/) with page numbers
  - Custom [stylesheets, scripts and hooks](https://adrienbrignon.github.io/mkdocs-exporter/guide/styles-and-scripts/)
  - Per-page options in the [front matter](https://adrienbrignon.github.io/mkdocs-exporter/reference/front-matter/)
  - [Buttons](https://adrienbrignon.github.io/mkdocs-exporter/guide/buttons/) at the top of your pages (e.g. to download the page or the book as PDF)
  - Dedicated support for the [`material`](https://github.com/squidfunk/mkdocs-material) and [`readthedocs`](https://www.mkdocs.org/user-guide/choosing-your-theme/#readthedocs) themes, check out [sample PDF documents](https://adrienbrignon.github.io/mkdocs-exporter/examples/#themes)
- ♿ **Accessible** - documents are tagged for screen readers, with bookmarks, their language and document information
- 🚀 **Fast** - documents are rendered concurrently, and unchanged ones are reused from a cache
- ⭐ **Powerful** - documents are printed by Chromium, driven by [*Playwright*](https://github.com/microsoft/playwright-python), with [CSS Paged Media](https://www.w3.org/TR/css-page-3/) support

## Supported tools

| Tool | Support |
|---|---|
| MkDocs `>= 1.6, < 2` | ✅ A plugin, documents are generated while building the website |
| [ProperDocs](https://github.com/ProperDocs/properdocs) | ✅ The same plugin |
| [Zensical](https://zensical.org/) | 🧪 A command, run once the website is built (experimental, see the [Zensical guide](https://adrienbrignon.github.io/mkdocs-exporter/how-to/zensical/)) |
| MkDocs 2.0 | ⏳ Not yet (it doesn't support plugins) |

Requires Python `>= 3.11.5`.

## Installation

The package is hosted on [*PyPI*](https://pypi.org/project/mkdocs-exporter/) and can be installed via `pip` (or your favourite package manager), along with the browser it uses:

```bash
pip install mkdocs-exporter
playwright install --with-deps --only-shell chromium
```

Upgrading from v6? Read the [migration guide](https://adrienbrignon.github.io/mkdocs-exporter/how-to/migrating-to-v7/).

## Usage

The following configuration (adapted from the [`mkdocs.yml`](https://github.com/adrienbrignon/mkdocs-exporter/blob/master/mkdocs.yml) file used by this documentation) covers the main features:

```yaml
plugins:
  - exporter:
      formats:
        pdf:
          enabled: !ENV [MKDOCS_EXPORTER_PDF, true]
          concurrency: 8
          stylesheets:
            - resources/stylesheets/pdf.css
          covers:
            front: resources/templates/covers/front.html.j2
            back: resources/templates/covers/back.html.j2
          footer:
            right: "Page {page} of {pages}"
          books:
            - output: documentation.pdf
              covers: front
              toc:
                enabled: true
```

With MkDocs and ProperDocs, documents are generated by `mkdocs build` (or `properdocs build`).
Zensical doesn't run plugins: it ignores this configuration (also accepted as `[project.plugins.exporter]` in `zensical.toml`), which the `mkdocs-exporter` command reads to export the website once it is built:

```bash
zensical build
mkdocs-exporter build
```

Check out the [examples](https://adrienbrignon.github.io/mkdocs-exporter/examples/): documents generated from a small website (with cover pages, tables of contents, headers and footers...), with their configuration ([`examples/`](https://github.com/adrienbrignon/mkdocs-exporter/tree/master/examples)).

## Roadmap

- [x] Combine all pages into a single PDF document (✅ released in [`v6.0.0`](https://github.com/adrienbrignon/mkdocs-exporter/releases/tag/v6.0.0))
- [x] Bookmarks, table of contents and links in books (✅ released in `v7.0.0`)
- [x] Export websites built by Zensical (🧪 experimental, released in `v7.0.0`)
- [ ] Export websites built by MkDocs 2.0
- [ ] Create a *GitHub* action that includes all dependencies to build the documentation and generate PDF documents

Feel free to request additional features by submitting an issue or contributing through a pull request.

## Contributing

We welcome contributions from the community to enhance MkDocs Exporter.  
Whether you want to report a bug, suggest a feature, improve the documentation, or contribute code, your help is appreciated!
See [`AGENTS.md`](https://github.com/adrienbrignon/mkdocs-exporter/blob/master/AGENTS.md) for how the project is organized, built and tested.

## License

This project is licensed under the `MIT License (MIT)`, which you can read [here](https://github.com/adrienbrignon/mkdocs-exporter/blob/master/LICENSE).
