Markdown Print: Print a .md File With Formatting

September 11, 2026 · 9 min read

Markdown Print: How to Print a .md File With Formatting

A markdown print job goes wrong for one reason: you printed the source file. A .md file is plain text, so a text editor sends the asterisks and hash marks to the printer as-is. Render the file to HTML first, then print the rendered page from your browser. This tutorial covers three ways to do that, the print dialog settings that matter, and page breaks.

Why Does My Printout Show ## and ** Instead of Formatting?

Markdown is a set of conventions for plain text. Nothing in the file says "make this bold"; a renderer reads **bold** and produces an HTML <strong> tag, and only then does anything look formatted. When you open notes.md in Notepad, TextEdit, or a code editor and press Ctrl+P, no renderer is involved. The printer gets exactly what's in the file, syntax and all.

That's also why the fix is always the same. Get the Markdown into something that renders it, whether that's a browser, an editor with a preview pane, or a PDF, and print that. The three methods below are the same idea with different tools. If you're not sure what the file even is, What is Markdown? covers that first.

Three Ways to Print Markdown With Formatting

Each method renders the file, then prints the rendered version. Pick by where the file lives and what you have installed.

Method 1: Print Markdown From an Online Editor

The fastest route needs nothing installed. Open the editor, paste the contents of your .md file, and check the preview on the right. That preview is the rendered HTML you want on paper. Then use the Download / Export menu. Export as HTML gives you a standalone page to open in your browser and print with Ctrl+P (Cmd+P on a Mac). Export as PDF gives you a file that prints identically on any machine.

We prefer the HTML route when the document is going straight to paper. The browser's print dialog gives you control over margins, scale, and background colours, which a PDF fixes in place. The PDF route is better when someone else is doing the printing. The free plan caps exports per day, so for a long batch of documents, export one HTML file with everything in it rather than one per file.

The sample below has the elements that most often print badly: a table, a shaded code block, and a page break. Click Export PDF and open the result, or read on for the print settings.

Quarterly summary

Rendered, then printed. The syntax characters never reach the printer.

Figures

Region Revenue Change
Europe 1.2M +4%
Asia 0.9M +11%

Notes

Code blocks keep their shading only when
Background graphics is ticked in the print dialog.

Appendix

This heading starts on page two.

67 words404 characters23 lines
Markdown

Method 2: Print Markdown From VS Code

VS Code has a built-in Markdown preview (Ctrl+Shift+V, or Cmd+Shift+V on a Mac) but no built-in print command for it. The usual answer is to install an extension. The one most people use is Markdown PDF by yzane.

After installing it, open the file, press F1 or Ctrl+Shift+P, type export, and pick markdown-pdf: Export (pdf). The extension bundles Chromium to render the file, so the output matches what a browser prints, and it also offers HTML, PNG, and JPEG exports.

The extension's settings include page size, margins, and a header and footer template, which is more control than the browser dialog gives you. It's the right choice if you print from VS Code every week. For occasional jobs, the online route above is quicker than waiting for the extension's Chromium download. Our VS Code Markdown guide covers the preview and the other extensions worth having.

Method 3: Print a Markdown File From GitHub

If the file lives in a repository, GitHub already renders it. Open the file in your browser, and the page shows formatted headings, tables, and code. Pressing Ctrl+P there prints the rendered content, but it also prints GitHub's header, sidebar, and file toolbar around it.

Two ways round that. Select the rendered content with the mouse and tick Selection only in the print dialog (Chrome shows this under More settings when text is selected). Or open the raw file, copy the source, and paste it into an editor as in Method 1. The GitHub Markdown cheat sheet lists the GitHub-only syntax, such as alerts and task lists, that other renderers may print differently.

Which Print Dialog Settings Matter for Markdown?

Whichever method produced the rendered page, the browser's print dialog decides how the markdown print looks on paper. In Chrome, click More settings to expose these; Google's Chrome print help covers the Save as PDF destination. Firefox's dialog has the same controls under slightly different names.

SettingWhat to chooseWhy
DestinationYour printer, or Save as PDFSave as PDF gives you a file to check before you waste paper
LayoutPortraitLandscape only for wide tables
MarginsDefault, or Minimum for wide codeMinimum can clip the last column of a table on some printers
Scale100, or Fit to page widthShrinking below 80 makes code blocks hard to read
Options: Background graphicsOnCode block shading and table stripes are backgrounds; off means white boxes
Options: Headers and footersOffOtherwise the URL and date print on every page
Pages per sheet1Two-up is fine for drafts, not for anything with tables

Background graphics is the one people miss. With it off, fenced code blocks lose their grey background and blockquotes lose their left border, and a document that looked right on screen prints as undifferentiated text. Our Markdown code block guide shows what the rendered block should look like so you can compare.

One limitation of printing from a browser: fonts. If the rendered page uses a web font that isn't installed locally, Save as PDF embeds it, but a physical printer driver sometimes substitutes. If a code font comes out wrong, print to PDF first and print the PDF.

How Do You Force a Page Break in Markdown?

Markdown has no page-break syntax, so you add a one-line HTML element that the renderer passes through and the browser's print engine understands:

Text on page one.

<div style="page-break-after: always;"></div>

## This heading starts on page two

MDN documents page-break-after as a legacy alias for the modern break-after: page, and browsers still honour both. This div works in browser-based exporters, including our own converter and VS Code's Markdown PDF. It does nothing on GitHub, which strips inline styles, and nothing in Pandoc's LaTeX route, which needs \newpage instead. The Markdown page-break guide covers every exporter's variant; this post only needs the browser form.

How Do You Print Markdown Source With the Syntax Visible?

Sometimes you want the opposite: a printout that shows ## Heading and **bold** literally, for teaching Markdown or reviewing a file's structure. The trick is to render the source as a code block. Wrap the whole file in a fence:

```markdown
# Title

Some **bold** text and a [link](https://example.com).
```

Rendered, that produces a monospace block with every character visible, and the markdown print comes out exactly that way. In VS Code, printing the editor pane itself (with an extension such as Print Code) does the same job with syntax colours. For a side-by-side handout, paste the source into the left pane of the editor and screenshot both panes, since neither the browser nor the extensions print two columns.

Common Mistakes When Printing .md Files

Printing from the text editor. The classic, and the reason people go looking for a markdown printer app that doesn't need to exist. Any app that shows you the syntax while you type is showing you the source; print from a preview or an exported file instead.

Leaving Headers and footers on. The browser adds the page title, URL, date, and page count in the margins. For a document you're handing to someone, turn it off and add your own footer in the Markdown if you need one.

Wide tables in portrait. A six-column table renders fine on a 1,400-pixel screen and gets clipped or squashed on A4 portrait. Switch to landscape for that document, or split the table. The Markdown to PDF guide has more on sizing when the destination is a file rather than paper.

Markdown Printing FAQ

Every markdown print problem comes back to rendering: get the file into a browser or a PDF as formatted HTML, tick Background graphics, untick Headers and footers, and add a page-break div where a section should start fresh. Paste your file into the editor, check the preview, and export as HTML or PDF. The Markdown to PDF tool is the one-click version when a file is all you need.