Skip to main content

MdToPdf backend for Foliant documentation generator.

Project description

MdToPdf backend for Foliant

This backend generates a single PDF document from your Foliant project. It uses md-to-pdf library under the hood.

md-to-pdf supports styling with CSS, automatic syntax highlighting by highlight.js, and PDF generation with Puppeteer.

MdToPdf backend for Foliant operates the pdf target.


First install md-to-pdf on your machine:

$ node install -g md-to-pdf

Then install the backend:

$ pip install foliantcontrib.mdtopdf


$ foliant make pdf --with mdtopdf
Parsing config... Done
Applying preprocessor flatten... Done
Applying preprocessor mdtopdf... Done
Applying preprocessor _unescape... Done
Making pdf with md-to-pdf... Done
Result: MyProject.pdf


You don't have to put anything in the config to use MdToPdf backend. If it's installed, Foliant will detect it.

You can however customize the backend with options in backend_config.mdtopdf section:

    mdtopdf_path: md-to-pdf
      body_class: markdown-body
      css: |-
        .page-break { page-break-after: always; }
        .markdown-body { font-size: 11px; }
        .markdown-body pre > code { white-space: pre-wrap; }

mdtopdf_path : is the path to md-to-pdf executable. Default: md-to-pdf

options : is a mapping of options which then will be converted into JSON and fed to the md-to-pdf command. For all possible options consult the md-to-pdf documentation.

Project details

Release history Release notifications

This version


Download files

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

Files for foliantcontrib.mdtopdf, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size foliantcontrib.mdtopdf-1.0.0-py3-none-any.whl (5.8 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size foliantcontrib.mdtopdf-1.0.0.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page