Skip to main content

Python command line application to convert Markdown to PDF.

Project description

mdpdf

License: MIT Code style: black

Python command line application to convert Markdown to PDF.

Project Features

  • Bare-bones: Only supports basic CommonMark
  • "One-size-fits-all" style: Left-aligned, PDF-base14 fonts. Reasonably pretty, but if you want more control, see alternatives below.
  • Headings are transformed to PDF bookmarks.
  • File links are transformed into attachments with PDF links.
  • Images links are transformed into embedded images with optional captions and width specifier.
  • Minimal requirements

Alternatives

There are several projects that can be considered if you need something with more features. Of note:

Installation

$ pip install mdpdf

Usage

$ mdpdf [OPTIONS] [INPUTS]...

Options:

  • -o, --output FILE Destination for file output. [required]
  • -h, --header <template> Sets the header template.
  • -f, --footer <template> Footer template.
  • -t, --title TEXT PDF title.
  • -s, --subject TEXT PDF subject.
  • -a, --author TEXT PDF author.
  • -k, --keywords TEXT PDF keywords.
  • -p, --paper [letter|A4] Paper size (default letter).
  • --version Show the version and exit.
  • --help Show this message and exit.

Templates:

The <template> is a quoted, comma- delimited string, containing the left, centre, and right, fields for the header/footer. Format is "[left],[middle],[right]".

Possible values to put here are:

  • Empty string
  • Arbitrary text
  • Special variables:
    • {page} current page number
    • {header} current top-level body text heading
    • {date} current date

Example:

$ mdpdf -o article.pdf article.md

$ mdpdf -o article.pdf --footer "{date},{heading},{page}" article.md

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

mdpdf-0.0.17.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdpdf-0.0.17-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file mdpdf-0.0.17.tar.gz.

File metadata

  • Download URL: mdpdf-0.0.17.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for mdpdf-0.0.17.tar.gz
Algorithm Hash digest
SHA256 be0c3814ee4579e4604fa90a0a2b063d98aa3472f11174021e56190138a2ca1d
MD5 162a99f7f310b32d1a5cd351f76a69c1
BLAKE2b-256 fe383e7aebc7e8a805ffb10e1e0a8b5e3d35be54d7ee32183b6f4cec72e37f9e

See more details on using hashes here.

File details

Details for the file mdpdf-0.0.17-py3-none-any.whl.

File metadata

  • Download URL: mdpdf-0.0.17-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for mdpdf-0.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 7047d5829ae184b2aff9204facb8e3d7af43ce72e4073c7aae56952522baf69a
MD5 1bf1faa81a02d43bb5d833432ce2526a
BLAKE2b-256 a6e1eae2995b803d3d82b87b1619748c9fb0b36f349b734be5bae4b628a71981

See more details on using hashes here.

Supported by

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