Metadata-Version: 2.1
Name: mkdocs-exporter
Version: 5.2.1
Summary: A highly-configurable plugin for MkDocs that exports your pages to PDF files.
Home-page: https://github.com/adrienbrignon/mkdocs-exporter
Keywords: mkdocs,pdf,exporter
Author: Adrien Brignon
Author-email: adrien@brignon.dev
Requires-Python: >=3.8
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Documentation
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Text Processing :: Markup :: HTML
Requires-Dist: beautifulsoup4 (>=4.12.2)
Requires-Dist: importlib-metadata (>=6.0)
Requires-Dist: importlib-resources (>=5.0)
Requires-Dist: libsass (>=0.22.0)
Requires-Dist: lxml (>=4.9)
Requires-Dist: mkdocs (>=1.4)
Requires-Dist: mkdocs-material[imaging] (>=9.4.14,<10.0.0)
Requires-Dist: nest-asyncio (>=1.5.6)
Requires-Dist: playwright (>=1.33)
Project-URL: Bug Tracker, https://github.com/adrienbrignon/mkdocs-exporter/issues
Project-URL: Repository, https://github.com/adrienbrignon/mkdocs-exporter
Description-Content-Type: text/markdown

# MkDocs Exporter

<div>
  <a href="https://pypi.org/project/mkdocs-exporter">
    <img src="https://img.shields.io/pypi/v/mkdocs-exporter?color=blue">
  </a>
  <a href="https://pypi.org/project/mkdocs-exporter">
    <img src="https://img.shields.io/pypi/pyversions/mkdocs-exporter?color=blue">
  </a>
  <a href="https://pypi.org/project/mkdocs-exporter">
    <img src="https://img.shields.io/pypi/dm/mkdocs-exporter?color=blue">
  </a>
  <a href="https://github.com/adrienbrignon/mkdocs-exporter/blob/master/LICENSE">
    <img 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 src="https://github.com/adrienbrignon/mkdocs-exporter/assets/10183277/85c768f6-fe27-43a1-998c-ac89e926cba1" align="right" width="350">
</a>
<br />

A highly-configurable plugin for [*MkDocs*](https://github.com/mkdocs/mkdocs) that exports your pages to PDF files.

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

## Features

- 🚀 **Fast** - PDF documents are generated concurrently!
- 🎨 **Customizable** - full control over the resulting documents
  - Cover pages (supports [`macros`](https://github.com/fralau/mkdocs_macros_plugin) plugin)
  - Define custom scripts and stylesheets to customize your PDF documents
  - Define "buttons" at the top of your documentation pages ([example](https://adrienbrignon.github.io/mkdocs-exporter/setup/setting-up-buttons/))
  - Compatible with [`material`](https://github.com/squidfunk/mkdocs-material) and [`readthedocs`](https://www.mkdocs.org/user-guide/choosing-your-theme/#readthedocs) themes
    - Check out some sample PDF documents [here](./examples/themes)
- ⭐ **Powerful** - it uses a headless browser and some awesome libraries under the hood to generate PDF files
  - [*Playwright*](https://github.com/microsoft/playwright-python) to automate browsers
  - [*Paged.js*](https://github.com/pagedjs/pagedjs) polyfills are included ([Paged Media](https://www.w3.org/TR/css-page-3/) and [Generated Content](https://www.w3.org/TR/css-gcpm-3/) CSS modules)
  - [*Sass*](https://sass-lang.com/) support (via [`libsass`](https://github.com/sass/libsass-python)) for your stylesheets

## Prerequisites

- Python `>= 3.8`
- MkDocs `>= 1.4`

## Installation

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

```bash
pip install mkdocs-exporter
```

## Usage

Three plugins are currently available:

- `exporter` (*required*): base plugin which must precede the others
- `exporter-pdf` (*optional*): plugin that exports your pages as individual PDF documents
- `exporter-extras` (*optional*): provides extra functionalities (buttons, HTML utilities...)

### Example

The following configuration excerpt from [`mkdocs.yml`](./mkdocs.yml) should cover the basic functionalities of this plugin:

```yaml
plugins:
  - exporter
  - exporter-pdf:
      concurrency: 8
      covers:
        front: resources/templates/covers/front.html.j2
        back: resources/templates/covers/back.html.j2
      stylesheets:
        - resources/stylesheets/pdf.scss
  - 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](examples/example.pdf) from the default page of the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material) 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](LICENSE).

