Will take a markdown file as input and then create a PDF file with the markdown formatting.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Many people love using markdown to take notes and write documentation. But when it comes to sharing it, they need to convert it to PDF. md2pdf
is a simple tool which does exactly that.
Currently, it supports:
Features | Support |
---|---|
Headings (L1 - L6) | ✔️ |
Paragraph | ✔️ |
Blockquotes | ✔️ |
Bold | ✔️ |
Italic | ✔️ |
Code | ✔️ |
Link | ✔️ |
Images | ✔️ |
CodeBlock | ⬛ |
Lists (Ordered and Unordered) | ⬛ |
Horizontal Rules | ⬛ |
Tables | ⬛ |
Take a look at the PDF generated from the sample markdown file.
PDF File | Markdown File |
---|---|
$ md2pdf -h
Usage of md2pdf:
-file string
Name of the markdown file to read
-output string
Name of the PDF file to be exported (default: <input-file-name>.pdf)
Example:
md2pdf -file=MyFile.md -output=MyFile.pdf
We can look at the markdown file as a bunch of lines, and each lines are further a collection of tokens. Tokens refer to the smallest/atomic unit of markdown. Each token has it's own style, content and alternate content (altContent is optional).
For example, a token can be a heading, a paragraph, a bold text, an image, a
code block, a list, etc. The token for heading will have the text in the
content
, the respective style like being bold, a larger font etc in the
style
.
Alternate content of the token is used in cases of images and links. For example, the alternate content of an image will be the image URL.
Parser first reads the markdown file splits it by lines and then further splits the lines by tokens.
This list of list of tokens are then passed to the Writer to generate the final PDF.
This project follows the standard markdown guidelines.