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

  • :rocket: Fast - PDF documents are generated concurrently!
  • :star: Powerful - it uses a headless browser and some awesome libraries under the hood to generate PDF files
  • :paintbrush: Customizable - full control over the resulting documents
    • Built for and compatible with mkdocs-material
    • Cover pages with templating support (for instance, with the macros plugin)
    • Define custom scripts and stylesheets to customize your PDF documents
    • Define "buttons" at the top of your documentation pages

Prerequisites

  • Python >= 3.7
  • MkDocs >= 1.1

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 others
  • mkdocs/exporter/pdf (optional): plugin that exports your pages as individual PDF documents
  • mkdocs/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
          icon: !!python/name:mkdocs_exporter.plugins.pdf.button.icon
          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

  • Documentation (based on MkDocs and featuring this plugin)
  • Ensure full compatibility with other themes than mkdocs-material
  • 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-1.0.2.tar.gz (106.5 kB view hashes)

Uploaded Source

Built Distribution

mkdocs_exporter-1.0.2-py3-none-any.whl (110.2 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