Convert Markdown files to PDF from your command line.
pip install markdown-convert
markdown-convert is an elegant command-line tool that converts Markdown files to PDF, powered by the amazing markdown2 and weasyprint libraries.
Unlike other similar tools, it relies solely on Python packages to do the job, eliminating the need for any external system-level dependencies when running on Linux.
If you're running Windows, you only need to install the GTK-3 runtime from the following link: GTK-3 Runtime.
Note: If you just installed the package, you may need to log out and log back in for the
markdown-convertcommand to be registered to your PATH.
Run markdown-convert -h right from your terminal to check out the available options:
Usage:
markdown-convert [markdown_file_path] [options]
Options:
--mode=once|live
Convert the markdown file once (default) or live.
--css=[css_file_path]
Use a custom CSS file.
--out=[output_file_path]
Specify the output file path....or import any of the functions from the package to use them in your own code:
from markdown_convert import convert, live_convert
# Convert your Markdown file to PDF once
convert('README.md', 'style.css', 'README.pdf')
# Convert your Markdown file to PDF every time it changes
live_convert('README.md', 'style.css', 'README.pdf')Right click a Markdown file and Convert to PDF with the markdown_convert_explorer and markdown_convert_nautilus extensions for Windows and Linux.