Markdown to PDF Installation. After this, the commands md-to-pdf and md2pdf (as a shorthand) are globally available in your cli. If you installed via npm, run npm i -g md-to-pdf@latest in your CLI. If you cloned this repository instead, you. Output usage information -v, -version. This post reviews several methods for converting a Markdown (.md) formatted file to PDF, from UNIX or Linux machines. Using Pandoc: $ pandoc HowIgotsvg-resizerworkingonMacOSX.md -s -o test1.pdf. Markdown is a popular Markup Language. Several static site renderers like Gatsby take in markdown and split out web pages. Dev.to uses markdown for its blog posts. I use markdown to take notes. Github uses markdown in Gists, Pull Requests, Issues and README files. In this cheat-sheet, I have selected the most used markdown syntax.
Similar topics are coming up often on HN recently. I think it's time Markdown should be supported natively by browsers. Until then, there are things like:If you need Markdown+PDF (compatible with pdf generation in pandoc), use -p. Look for npm modules prefixed with exemd. Npm install -g pretty-markdown-pdf Command Line. To convert a markdown file to PDF, simply run: pretty-md-pdf -i my-doc.md Run with -help to see all the options available. This will output a file my-doc.pdf in the directory where my-doc.md resides. To specify an output path as my-exported-doc.pdf, run: pretty-md-pdf -i my-doc.md -o my-exported-doc.pdf.
TeXMe (https://github.com/susam/texme): This is my personal favorite because it supports the CommonMark standard of Markdown and also LaTeX via MathJax. I like standards so that I know that the Markdown I write (especially nested lists, code within nested lists, etc.) get rendered the same way everywhere. I write some math too, so MathJax support is useful. If you are looking for something where you can just slap together Markdown and LaTeX and turn the document instantly into a paper-like finish, this is a good choice. The output can be saved as PDF or printed too just like you would print any paper.
MdMe (https://github.com/susam/mdme): This is pretty much TeXMe without MathJax support.
Markdeep (https://casual-effects.com/markdeep/): This is like TeXMe but it supports a lot of features like diagrams, tables, etc. But it comes at the cost of standard conformance. Markdeep does not conform to CommonMark. I don't need these additional features for most of my writing but I care about standard conformance, so I go with TeXMe but if you need these features then Markdeep is a good choice.
Comparison of TeXMe vs. Markdeep by the author: https://news.ycombinator.com/item?id=18314175
If you are doing some books/docs writing or attempting to create your first book, you might get interested in this exceptionally nice tool – gitbook. It is a technical book building tool that allows you to embed code samples and exercises, and then generate a great online book that can be hosted on GitHub or any other web hosting.Moreover, from a loosely structured bunch of MarkDown files, you can customize output format to generate not only a static site, but also PDF, eBook, json or single HTML page. No manual markup and styling required. You get a clean and pretty usable interface right out of the box.Simple setup
Gitbook is a node.js package. So, in order to use it, you should have **npm** installed. You can serve a repository as a book by using: To start your first book, you have to create 2 files –README.md
and SUMMARY.md
. First one is a preface and second one is the main file which is going to be used to build the book structure. And it looks like this: You can easily build a static website using: