Skip to main content

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
  • Powerful - it uses a headless browser and some awesome libraries under the hood to generate PDF files

Prerequisites

  • Python >= 3.8
  • 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:

  • 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 should cover the basic functionalities of this plugin:

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 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_exporter-5.3.1.tar.gz (111.4 kB view hashes)

Uploaded Source

Built Distribution

mkdocs_exporter-5.3.1-py3-none-any.whl (118.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page