Polyatic Markdown Previewer

Markdown Previewer

Write GitHub-Flavored Markdown on the left and watch the sanitized HTML render live on the right. Copy the HTML, download the .md, export a self-contained .html file, or print / save the preview as a PDF — nothing is uploaded.

Markdown
Characters 0 Words 0 Lines 0
Preview
Standalone file

Wraps the preview in one self-contained .html file: inline styles, no scripts, no external references in the shell — it opens offline. The body is the DOMPurify-sanitized preview markup (scripts, event handlers and javascript: links are already stripped; nothing unsanitized is exported). The <title> comes from your first heading, or “Markdown document” if there is none. If your Markdown embeds images by URL, those URLs stay in the body — only the shell is guaranteed reference-free.

Print / PDF

Runs entirely in your browser — nothing is uploaded. The markdown parser and the HTML sanitizer are vendored into this page; there are no network requests and no analytics on this tool. Every render is passed through DOMPurify before it touches the page, so pasted content can't run scripts.

What GitHub-Flavored Markdown is

Markdown is a plain-text formatting syntax: you write **bold** or # Heading and a renderer turns it into HTML. GitHub-Flavored Markdown (GFM) is the dialect GitHub uses — the CommonMark specification plus a handful of practical extensions: pipe tables, task lists with [ ] / [x] checkboxes, strikethrough with ~~text~~, and automatic linking of bare URLs. It has become the de-facto standard for READMEs, issues, pull-request descriptions, wikis and static-site content, which is why previewing it accurately is useful before you commit or publish.

How the live preview works

Two small libraries do the work, both vendored into this page so nothing loads from a CDN. On every keystroke, marked (v12, MIT-licensed) parses your Markdown into an HTML string, following the CommonMark and GFM rules. That string is then handed to DOMPurify (v3, Apache-2.0 / MPL) which sanitizes it — parsing the HTML, walking every node, and removing anything unsafe — before the cleaned markup is assigned to the preview. Only after that round-trip does the HTML reach the page, so you always see rendered output, never the raw tags, and never anything executable.

Why sanitizing matters

Markdown is allowed to contain raw HTML, and raw HTML is where cross-site-scripting (XSS) lives. A snippet like <img src=x onerror=alert(1)> or a bare <script> tag is perfectly valid Markdown, and a naïve previewer that drops marked's output straight into innerHTML would execute it. This tool never does that: DOMPurify strips <script> elements, on* event-handler attributes and javascript: URLs, so a hostile snippet you paste from a stranger's README renders as inert text or vanishes, rather than running in your browser. The sanitizer runs on your machine, so the check costs nothing and needs no server.

What GFM syntax is supported

FeatureWrite
Heading# H1#### H4
Bold / italic**bold** *italic*
Strikethrough~~gone~~
Link / image[text](url) ![alt](url)
Inline / block code`code` and ``` fences
Blockquote> quoted
Task list- [x] done
Table| a | b | rows

Everything in the table above appears in the sample document loaded on the left, so you can see each one rendered and tweak it in place.

Copy the HTML, export a file, or keep the Markdown

Copy body HTML puts the sanitized HTML fragment — exactly what the preview shows — on your clipboard, ready to paste into a CMS, an email template or a web page where you supply the surrounding document. Download .md saves the editor's contents as a document.md file, so you can draft here and commit the Markdown to a repo. Because the output is already sanitized, the copied HTML is safe to embed; you will normally wrap it in your own container and apply your own CSS, since the styling you see here comes from Polyatic's stylesheet and is for display only.

What the standalone .html export contains

Copy HTML and Download .html produce a complete document you can open by double-clicking, attach to an email, or drop on any static host. The shell is deliberately minimal and fully self-contained: an HTML5 doctype, a utf-8 charset meta, a viewport meta, a <title> taken from the first heading in your document (with the stated fallback “Markdown document” when there is no heading), one small inline stylesheet (~1 KB, with a dark-mode variant via prefers-color-scheme), and a comment naming this tool as the generator. It loads nothing from the network — no fonts, no scripts, no external CSS — so the file keeps working offline and never phones home. The body between the tags is byte-for-byte the sanitized preview markup; the exporter does not re-render or reformat it. One honest caveat: if your Markdown references images by URL (![alt](https://…)), those URLs remain in the body — self-containment is a guarantee about the shell, not about content you linked yourself.

Markdown to PDF, without a PDF engine

The Print / Save as PDF button is the honest answer to “how do I turn this Markdown into a PDF”: it calls window.print(), and every modern browser can print a page straight to a PDF file — the destination is called Save as PDF in Chrome and Edge, and Firefox and Safari offer the same via their print dialogs. A print stylesheet on this page hides everything except the sanitized preview (no editor, no buttons, no site chrome), sets 1.5 cm page margins, always prints dark text on a white page even if your screen theme is dark, and applies CSS fragmentation rules: break-after: avoid keeps each heading with the paragraph that follows it, and break-inside: avoid asks the browser not to slice code blocks, tables, blockquotes or images across a page boundary. Those rules steer pagination; the final page layout, fonts, headers/footers and PDF metadata are decided by the browser and your print settings, not by this tool. Because both the render and the printing happen locally, nothing is uploaded — the whole path works offline. If you need byte-exact, template-controlled PDFs (letterheads, forced page sizes, embedded fonts), use a dedicated document processor; for READMEs, notes and documentation, the browser's PDF is accurate and instant.

Honest limits

This is a standard GFM renderer, not a full GitHub emulation. Platform-specific niceties are deliberately out of scope: @mentions, issue references like #123, emoji shortcodes such as :smile:, footnotes, collapsible alert boxes and math ($…$) are not rendered, because they are features GitHub layers on top of Markdown rather than parts of the spec. Syntax highlighting inside code fences is not applied — the language label is preserved but the code is shown in a single monospace colour to keep the page dependency-free. The preview also does not sync its scroll position with the editor. What you get is an accurate, safe render of the core Markdown that travels between tools; for the last few GitHub-only touches, preview on GitHub itself.