In this post, we will see how to convert a markdown app to a pdf file with the Pandoc conversion tool.
Pandoc is an open-source document conversion tool that is used to convert files from one markup format to another.
Pandoc is available for Windows, Mac, and Linux.
Download Links for Pandoc
Using Pandoc, we can convert a markdown file into pdf, Docx, HTML, and many other formats. More details https://pandoc.org/index.html
Here, we will just convert a markdown file to pdf and even see how we can merge two markdown files together.
To convert a markdown file (
post.md) to a PDF document, we will use the following command
pandoc -s -o document.pdf post.md
So, this command will generate a PDF document named
document.pdf as an output.
We can also use pandoc to merge files too. Suppose we have two markdown files:
So to convert it into one pdf document, we will use the command:
pandoc -s -o document.pdf article1.md article2.md
Pandoc will merge and generate the
document.pdf as the output in your directory.
So this is a very easy way to convert a markdown document to pdf offline using the command line in your windows, macOS, and Linux operating system.