Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

treyerl/markdown-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Markdown PDF

Use .md files as source files to produce simple PDF files. Similar to (La)Tex, this allows to have plain text source files and generate PDF from it. Ingredients:

  • Visual Studio Code (incl. vscode-pdf plugin and perhaps mermaid-plugin if you use mermaid)

  • remark and its plugins:

    npm install -g remark remark-cli remark-html remark-highlight.js remark-toc mermaid.cli remark-mermaid

    Delete from the command / omit if you don't need:

    • highligh.js Code Syntax Highlighting
    • toc Table of Contents (very little configuration possibilities)
    • mermaid "Write graphs" in markdown.
  • weasyprint to convert .html to .pdf; When installing python on windows make sure to install python 64bit version if you have a 64bit machine

Size on disk: ~350MB - 550MB (see Installation Size). As compared to 1.5GB of Latex (with Editor). Use this project as a template.

Result

Visual Studio Code: Live Markdown Preview:
md-preview

Visual Studio Code: PDF Preview (using vscode-pdf plugin):
pdf-preview

Installation Size

Software Size
Visual Studio Code 220MB
vscode-pdf plugin 3MB
Node/npm (markdown-it) 40MB (~100kb)
weasyprint ~100MB - 250MB (incl. python3 and GTK3+; larger on Windows)

Issues / Limitations

  • Check out windows-specific branch when using powershell (on Windows)

  • When using a font family on pre-tag weasprint/pango fails to handle empty lines. As a workaround we only use a single font for pre-tags. Adjust the css according to your font available. (see #415)

  • Not all SVG's are printed correctly ('NoneType' object has no attribute 'get').

  • weasyprint does not support MathML, but packages like MathJAX would be able to convert Tex, AsciiMath, and MathML to SVG - unfortunately not remark plugin on that end.

About

Convert .md files to PDF using weasyprint. A PDF workflow template for Visual Studio Code.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published