From Markdown to PDF
dev.to·1d·
Discuss: DEV
📝Markdown
Preview
Report Post

Today I wanted to print a markdown file and found out there was no straightforward way to do it from my code editor. Even though they have beautiful markdown previews, they won’t let you print them.

That’s when I found pandoc. Pandoc is a document converter that can turn markdown into PDF. It does this by converting markdown to LaTeX first, then using LaTeX to generate the PDF.

I don’t miss struggling with LaTeX from my computer science student days, but it always produced beautiful documents (when I didn’t mess anything up).

Here is the setup on macOS:

brew install pandoc
brew install basictex

After installing basictex, restart your terminal to get the LaTeX binaries in your path.

Then:

pandoc file.md ...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help