How to Convert Markdown to PDF: The Complete Guide
Published with
RenderMark
How to Convert Markdown to PDF: The Complete Guide
Markdown is the go-to format for developers, writers, and anyone who values clean, readable text. But when it's time to share your work professionally, you often need a PDF. This guide covers every method for converting Markdown to PDF—from the easiest one-click solutions to command-line tools for automation.
Why Convert Markdown to PDF?
While Markdown is perfect for writing and version control, PDFs are the universal standard for:
- Professional documents — Reports, proposals, specifications, and client deliverables
- Sharing with non-technical users — Not everyone has a Markdown viewer or GitHub access
- Printing — PDFs preserve formatting identically across all devices and printers
- Archiving — A stable format that won't change or require specific software to open
- Email attachments — The most universally accepted document format
The challenge? Most Markdown-to-PDF tools sacrifice features. They'll handle basic formatting but choke on tables, break your code highlighting, or strip out extended syntax entirely.
Method 1: RenderMark (Best for Full Markdown Support)
RenderMark is purpose-built for converting Markdown to beautiful, shareable documents. Unlike other tools, it supports complete extended Markdown syntax—everything renders in your PDF exactly as you'd expect.
Why RenderMark Produces the Best PDFs
Most converters struggle with advanced Markdown. RenderMark handles it all:
| Feature | RenderMark | Pandoc | VS Code | Browser Print |
|---|---|---|---|---|
| Basic Markdown | ✓ | ✓ | ✓ | ✓ |
| GitHub Flavored Markdown | ✓ | ✓ | Partial | Partial |
| Tables with alignment | ✓ | ✓ | ✓ | Varies |
| Syntax-highlighted code | ✓ | Requires setup | ✓ | No |
| Task lists (checkboxes) | ✓ | ✓ | ✓ | Varies |
| Embedded images | ✓ | ✓ | ✓ | ✓ |
| HTML elements | ✓ | Limited | No | ✓ |
| Footnotes | ✓ | ✓ | No | No |
| Definition lists | ✓ | ✓ | No | No |
| Strikethrough | ✓ | ✓ | ✓ | Varies |
| Highlighting (text) | ✓ | No | No | No |
| Subscript/Superscript | ✓ | ✓ | No | No |
| Collapsible sections | ✓ | No | No | Varies |
| Table of contents | ✓ | Manual | Extension | No |
What Makes RenderMark Different
Full Extended Syntax Support
RenderMark renders all extended Markdown features in your PDF:
- Highlighting:
==highlighted text==renders with a yellow background - Subscript/Superscript: H
~2~O and X^2^work perfectly - Footnotes: Full support with properly formatted references
- Definition lists: Clean formatting for glossaries and references
HTML Elements Work
Need centered content? Keyboard keys? Custom styling? HTML in your Markdown just works:
<div align="center">
<strong>Centered content</strong>
</div>
Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy
This renders correctly in RenderMark PDFs—most other tools strip it out.
Embedded Images with Proper Sizing
Images from URLs, relative paths, or base64 encoding all work. Large images are automatically scaled to fit the page width while maintaining aspect ratio.
Syntax Highlighting for 100+ Languages
Code blocks render with full syntax highlighting:
def convert_markdown_to_pdf(content: str) -> bytes:
"""Convert Markdown content to a PDF document."""
rendered = render_markdown(content)
return generate_pdf(rendered)
The highlighting is preserved in the PDF, making technical documentation actually readable.
How to Convert with RenderMark
- Go to RenderMark
- Paste your Markdown or import from GitHub
- Preview your document in real-time
- Click Export to PDF
- Done—your PDF downloads immediately
No installation. No configuration. No LaTeX dependency hell.
When to Use RenderMark
- You want the highest-fidelity PDF output
- Your Markdown uses extended syntax (tables, footnotes, HTML, highlighting)
- You need syntax-highlighted code blocks
- You're sharing technical documentation with non-technical stakeholders
- You want a live preview before exporting
- You need to import directly from GitHub (including private repos)
Method 2: Pandoc (Command Line)
Pandoc is the Swiss Army knife of document conversion. It's powerful but requires setup.
Installation
# macOS
brew install pandoc
# Ubuntu/Debian
sudo apt-get install pandoc
# Windows
choco install pandoc
For PDF output, you also need a LaTeX distribution:
# macOS
brew install --cask mactex
# Ubuntu/Debian
sudo apt-get install texlive-xetex
# Windows
# Download MiKTeX from miktex.org
Basic Usage
pandoc input.md -o output.pdf
With Better Formatting
pandoc input.md -o output.pdf \
--pdf-engine=xelatex \
-V geometry:margin=1in \
-V fontsize=11pt \
--highlight-style=tango
Pros and Cons
Pros:
- Extremely powerful and customizable
- Works offline
- Great for automation and CI/CD pipelines
- Supports many input/output formats
Cons:
- Requires LaTeX installation (2-4GB)
- Steep learning curve
- Extended Markdown support requires additional configuration
- No live preview
When to Use Pandoc
- You need automated batch conversion
- You're building CI/CD documentation pipelines
- You require offline capability
- You're comfortable with command-line tools
Method 3: VS Code Extensions
If you live in VS Code, extensions can add PDF export functionality.
Popular Extensions
Markdown PDF (yzane.markdown-pdf)
- Simple right-click export
- Basic styling options
- No extended syntax support
Markdown Preview Enhanced (shd101wyy.markdown-preview-enhanced)
- Better preview features
- Export to PDF via Puppeteer
- Some extended syntax support
Installation
- Open VS Code
- Go to Extensions (Cmd/Ctrl + Shift + X)
- Search for "Markdown PDF"
- Install and reload
Usage
- Open your Markdown file
- Right-click in the editor
- Select "Markdown PDF: Export (pdf)"
Pros and Cons
Pros:
- Integrated into your editor
- No separate tool to open
- Quick for simple documents
Cons:
- Limited styling options
- No extended syntax support (no footnotes, no highlighting)
- HTML elements often don't render
- Code highlighting quality varies
When to Use VS Code Extensions
- You need a quick, basic PDF from your editor
- Your Markdown is simple (no advanced features)
- You don't want to leave VS Code
Method 4: Browser Print to PDF
The simplest method—but with the most limitations.
How It Works
- Open your Markdown in a renderer (GitHub, GitLab, a preview tool)
- Press Cmd/Ctrl + P
- Select "Save as PDF"
Pros and Cons
Pros:
- No installation required
- Works anywhere with a browser
Cons:
- Headers, footers, and URLs clutter the output
- Page breaks are often awkward
- No control over styling
- Syntax highlighting may not transfer
- Tables often break across pages poorly
When to Use Browser Print
- You need a quick reference copy
- Formatting quality doesn't matter
- It's a one-time, informal need
Method 5: Online Converters
Various websites offer Markdown-to-PDF conversion.
Examples
- Dillinger.io
- StackEdit
- Markdown to PDF (various)
Pros and Cons
Pros:
- No installation
- Usually free
Cons:
- Privacy concerns — your content goes to a third-party server
- Limited or no extended syntax support
- Often add watermarks or branding
- Inconsistent quality
- May have file size limits
When to Use Online Converters
- The content isn't sensitive
- You need a quick one-off conversion
- Quality isn't critical
Method 6: Obsidian with Plugins
Obsidian is a popular Markdown editor with PDF export via plugins.
Setup
- Install Obsidian
- Go to Settings → Community Plugins
- Install "Pandoc Plugin" or "Better Export PDF"
- Configure the plugin
Pros and Cons
Pros:
- Good for Obsidian users
- Some extended syntax support
- Nice preview
Cons:
- Requires Obsidian installation
- Plugin configuration needed
- Pandoc dependency for best results
Comparison: All Methods
| Method | Setup Time | Extended Syntax | Code Highlighting | HTML Support | Best For |
|---|---|---|---|---|---|
| RenderMark | None | ✓ Full | ✓ Full | ✓ Full | Best quality, easiest |
| Pandoc | 30-60 min | Partial | Configurable | Limited | Automation |
| VS Code | 5 min | Limited | Partial | No | Quick basic exports |
| Browser Print | None | Depends | Varies | Varies | Informal copies |
| Online Tools | None | Limited | Varies | No | One-off, non-sensitive |
| Obsidian | 15 min | Partial | Plugin-dependent | Partial | Obsidian users |
Tips for Better PDF Output
Regardless of which tool you use, these tips will improve your results:
1. Use Proper Heading Hierarchy
Start with one H1 for the title, use H2 for major sections, H3 for subsections. This creates a logical document structure and enables automatic table of contents generation.
2. Preview Before Exporting
Always preview your document before generating the PDF. What looks fine in a text editor may have formatting issues when rendered.
3. Optimize Images
- Use appropriate image sizes (don't embed 4000px images for a small figure)
- Ensure images are accessible (hosted URLs or embedded)
- Add alt text for accessibility
4. Consider Page Breaks
For long documents, think about where pages will break. Some tools let you force page breaks with HTML:
<div style="page-break-after: always;"></div>
5. Test Code Block Length
Very long code blocks may not wrap well. Consider breaking them up or using shorter examples.
6. Use Tables Wisely
Tables with many columns may not fit on a page. Keep tables focused and consider splitting wide tables.
Conclusion
For most users, RenderMark offers the best balance of ease-of-use and output quality. It's the only tool that supports complete extended Markdown syntax—including HTML elements, highlighting, footnotes, and full syntax-highlighted code blocks—without any setup.
If you need automation for CI/CD pipelines, Pandoc is powerful but requires significant setup. For quick basic exports, VS Code extensions work but sacrifice features.
Ready to convert your Markdown to a professional PDF?
Try RenderMark free — paste your Markdown and export in seconds. No signup required for your first document.
RenderMark.app