Skip to main content

markdown-convert

Convert Markdown files to PDF from your command line.

pip install markdown-convert


Button Hover Button Hover




Why markdown-convert?

Unlike other similar tools, markdown-convert:

  • Can be fully installed via pip install markdown-convert, with no external system-level dependencies.

  • Comes with a sensible default CSS stylesheet out of the box.

  • Supports:

    Feature Example
    LaTeX Math Equations $E=mc^2$ is rendered as a math equation.
    Mermaid, Vega-Lite and Schemdraw Diagrams ```mermaid ... is rendered as a diagram.
    Syntax-Highlighted Code Blocks ```python ... gets syntax highlighting.
    Admonitions !!! note ... is styled as a note box.
    Dynamic Table of Contents [TOC] inserts a Table of Contents.
    Image Attributes ![::shadow::](sky.png) shows a shadow behind the image.
    Captions ![sky](sky.png)_A beautiful sky_ shows a caption, centered below the image.
    Tables and Queries > [my_table] under your table gives it a name,
    [query:select ... from my_table] queries it.
    Live Conversion markdown-convert file.md --mode=live updates the PDF every time the Markdown file changes.
    Custom CSS markdown-convert file.md --css=style.css extends the default CSS with your own stylesheet.
    Task Lists, Containers, CSS Paged Media and more! ...

    Check out CUSTOM_SYNTAX.md for all the extra features and how to use them.

Installation

markdown-convert is available on PyPI and can be installed via pip:

pip install markdown-convert

Usage

1. From your terminal

Simply run markdown-convert file.md to convert file.md to file.pdf.

You can specify the following options:

Usage:
  markdown-convert [markdown_file_path] [options]

Options:
  --mode=once|live|debug
      Convert the markdown file once (default) or live.
      Use debug to preserve the intermediate html file.
  --css=[css_file_path]
      Use a custom CSS file.
  --out=[output_file_path]
      Specify the output file path.
  --extras=[extra1,extra2,...]
      Specify the extras to use. Uses all extras if not specified.
      Supported extras:
        admonitions,anchors,task-lists,math,custom-spans,highlights,
        syntax-highlighting,table-of-contents,vega-lite,inline-math,
        block-math,schemdraw,mermaid,dynamic-tables,dynamic-queries
  --security=basic|default|strict
      Specify the security level.
      Basic:
        - Inline HTML:   No restrictions.
        - JS:            Restricted to extras.
        - Remote files:  Restricted to images and fonts via https.
        - Local files:   No restrictions.
      Default:
        - Inline HTML:   Disabled.
        - JS:            Restricted to extras.
        - Remote files:  Restricted to images and fonts via https.
        - Local files:   Restricted to files inside the base directory.
      Strict:
        - Inline HTML:   Disabled.
        - JS:            Disabled (may break some extras).
        - Remote files:  Disabled (internet access completely disabled).
        - Local files:   Restricted to files inside the base directory.

For example: markdown-convert README.md --mode=live --css=style.css --out=output.pdf will convert README.md to output.pdf using style.css and update the PDF live as you edit the Markdown file.

2. As a Python library

You can also use markdown-convert as a library in your Python code:

from markdown_convert import convert, convert_text, live_convert

# Convert your Markdown file and save it as a PDF file
convert('README.md', 'style.css', 'README.pdf')

# Convert your Markdown string and get the PDF bytes
pdf_bytes = convert_text('# Hello World', 'h1 { color: red; }')

# Convert your Markdown file to PDF every time it changes
live_convert('README.md', 'style.css', 'README.pdf')

3. From the context menu of your file explorer

Install the extension of your choice:

Then right click any Markdown file and select Convert to PDF to convert it.

Download files

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

Source Distribution

markdown_convert-2.0.13.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

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

markdown_convert-2.0.13-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file markdown_convert-2.0.13.tar.gz.

File metadata

  • Download URL: markdown_convert-2.0.13.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for markdown_convert-2.0.13.tar.gz
Algorithm Hash digest
SHA256 48625c95017acf97ed7b6994b5ba3202a7586b7a3d3d4688bcb3d7f212284482
MD5 d9d105dc4d36f8737f3f3e006ca22841
BLAKE2b-256 5f7595d9fd678557c48d5de433f7a947491d9e2d80b3f483ae164156082d6895

See more details on using hashes here.

File details

Details for the file markdown_convert-2.0.13-py3-none-any.whl.

File metadata

  • Download URL: markdown_convert-2.0.13-py3-none-any.whl
  • Upload date:
  • Size: 30.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for markdown_convert-2.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 be66488ab6cd21ae52d923352672f17a9e4ff8b5bf8b1b115d547791acde46ec
MD5 a39725ece178e918dd4ef3511ad68851
BLAKE2b-256 120940ec5592acde14e345e28a66f5596e4114d0334c94e15c8d837ef6322c85

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.13 This release

2 files

2.0.12

2 files

2.0.11

2 files

2.0.10

2 files

2.0.9

2 files

2.0.8

2 files

2.0.7

2 files

2.0.6

2 files

2.0.5

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.2.66

2 files

1.2.65

2 files

1.2.64

2 files

1.2.63

1 file

1.2.62

2 files

1.2.61

2 files

1.2.60

2 files

1.2.59

2 files

1.2.58

2 files

1.2.57

2 files

1.2.56

2 files

1.2.55

2 files

1.2.54

2 files

1.2.53

2 files

1.2.52

2 files

1.2.51

2 files

1.2.50

2 files

1.2.49

2 files

1.2.48

2 files

1.2.47

2 files

1.2.46

2 files

1.2.45

2 files

1.2.44

2 files

1.2.43

2 files

1.2.42

2 files

1.2.41

2 files

1.2.40

2 files

1.2.39

2 files

1.2.38

2 files

1.2.37

2 files

1.2.36

2 files

1.2.35

2 files

1.2.34

2 files

1.2.33

2 files

1.2.32

2 files

1.2.31

2 files

1.2.30

2 files

1.2.29

2 files

1.2.28

2 files

1.2.27

2 files

1.2.26

2 files

1.2.25

2 files

1.2.23

2 files

1.2.22

2 files

1.2.21

2 files

1.2.20

2 files

1.2.19

2 files

1.2.18

2 files

1.2.17

2 files

1.2.16

2 files

1.2.15

2 files

1.2.14

2 files

1.2.13

2 files

1.2.12

2 files

1.2.11

2 files

1.2.10

2 files

1.2.7

2 files

1.2.6

2 files

1.2.5

2 files

1.2.4

2 files

1.2.3

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.9

2 files

1.1.8

2 files

1.1.7

2 files

1.1.6

2 files

1.1.5

2 files

1.1.4

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.9.9

2 files

0.9.8

2 files

0.9.6

2 files

0.9.5

1 file

0.9.4

1 file

0.9.3

1 file

0.9.2

1 file

0.9.1

1 file

0.9.0

1 file

Supported by

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