Skip to main content

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.

Installation

First install md-to-pdf on your machine:

$ node install -g md-to-pdf

Then install the backend:

$ pip install foliantcontrib.mdtopdf

Usage

$ 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

Config

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:

backend_config:
  mdtopdf:
    mdtopdf_path: md-to-pdf
    options:
      stylesheet: https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.10.0/github-markdown.min.css
      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.

Metadata

Release files for foliantcontrib.mdtopdf 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for foliantcontrib.mdtopdf 1.0.0
File Size Uploaded
foliantcontrib.mdtopdf-1.0.0.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for foliantcontrib.mdtopdf 1.0.0
File Interpreter ABI Platform
foliantcontrib.mdtopdf-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / foliantcontrib.mdtopdf-1.0.0.tar.gz

Download URL foliantcontrib.mdtopdf-1.0.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
df08c8dbf55cad24d4f5d6c17713884720f8e9b8f35bcc6faee9ecb0c3083355
BLAKE2b-256 checksum
How to use checksums
bc5baa5941f700f8e00d8f2ec9a95a5f5590f092f69f116236bfe9af092e093e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.1

Release files / foliantcontrib.mdtopdf-1.0.0-py3-none-any.whl

Download URL foliantcontrib.mdtopdf-1.0.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a51f3fe7e9f93fc8131f5c575cfa843ea5dfbfccfdb6d3249c6f52b4547d379
BLAKE2b-256 checksum
How to use checksums
c166f765f5ff4dfcc19efe134377cb59dc71c2d79967fe0a37ee02f80d703b65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.1

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page