~/TechPurAI
~/tools/markdown-previewer
Content Utilities

Markdown Previewer

Preview

Markdown is a lightweight, plain-text formatting syntax that converts into HTML — headings, bold and italic text, lists, links, code blocks, and more, all written with minimal, easy-to-remember punctuation instead of HTML tags. This tool renders whatever Markdown you type into live, formatted preview on the other side of the screen, updating as you type.

Why Markdown exists, and what problem it actually solves

Before Markdown, writing formatted text for the web generally meant writing HTML directly — wrapping every heading in <h2> tags, every bold word in <strong> tags, every link in a full <a href="..."> tag. That's precise and fully capable, but it's genuinely unpleasant to write and, more importantly, hard to read in its raw, unrendered form — a paragraph full of inline HTML tags is visually cluttered compared to the same paragraph in plain prose. John Gruber created Markdown in 2004 with an explicit design goal: a formatting syntax readable as-is, in plain text, even by someone who's never seen it before and has no rendering tool at hand. A line starting with # obviously reads as a heading even unrendered; text wrapped in **asterisks** obviously reads as emphasized even before any tool converts it to bold. That readability-first design is Markdown's entire reason for existing, and it's why it spread so widely — documentation, README files, comments on code-hosting platforms, note-taking apps, blog platforms, and messaging apps all converged on some form of Markdown specifically because it's fast to write, easy to read in raw form, and still converts cleanly into properly formatted output.

CommonMark and the fragmentation problem

Markdown's original specification, written by Gruber, was intentionally loose and left a number of edge cases genuinely ambiguous — what happens with a list item that spans multiple paragraphs, exactly how nested blockquotes should behave, precise rules around when a line break inside a paragraph should or shouldn't render as a line break in the output. Because different implementations resolved those ambiguities differently, Markdown fragmented over the following decade into a family of subtly incompatible dialects — the same source text could render slightly differently depending on which specific parser processed it. CommonMark emerged specifically to fix this: a rigorously specified, unambiguous version of Markdown's core syntax, with a complete test suite that any implementation can be checked against, created by a group of prominent Markdown implementers (including Gruber himself) specifically to end the fragmentation. This tool's preview is built on a CommonMark-compliant parser, which means it reflects the closest thing Markdown has to an authoritative, unambiguous standard — and gives you the most reliable general-purpose preview of how a given piece of Markdown will render across the wide range of platforms and tools that have adopted CommonMark as their baseline, even before accounting for each platform's own specific extensions on top of it.

GitHub Flavored Markdown and the extensions almost everyone actually uses

In practice, very few platforms use bare CommonMark alone — the extension set known as GitHub Flavored Markdown (GFM) has become almost as much a de facto standard as CommonMark itself, since it's what GitHub, and by extension a huge share of developer-facing documentation and README files, actually runs on. GFM adds several genuinely useful constructs on top of base CommonMark: tables, built using pipe characters to separate columns and a row of dashes to mark the header boundary; strikethrough text, wrapped in double tildes; automatic linking of bare URLs without needing the full link syntax; and task lists, written as a dash followed by [ ] or [x], which render as actual interactive-looking checkboxes. This tool's renderer supports the GFM extensions on top of CommonMark specifically because, in practice, that combination — not bare, unextended CommonMark — is what the overwhelming majority of real-world Markdown actually relies on.

The security consideration behind the sanitization step

Markdown, by design, allows raw HTML to be embedded directly inside it — this was true even in Gruber's original spec, as an intentional escape hatch for anything Markdown's own syntax couldn't express. That's a reasonable design choice for trusted content, but it becomes a genuine security problem the moment a tool renders someone else's Markdown input as live HTML without sanitizing it first: raw HTML can include <script> tags, event-handler attributes, and other constructs capable of executing arbitrary code in the context of the page rendering it — the well-known cross-site scripting (XSS) vulnerability class. Any Markdown renderer that converts user-supplied text straight to innerHTML without a sanitization pass in between is, technically, exposed to this. This tool runs its rendered output through a dedicated HTML-sanitization library before ever displaying it, stripping anything with code-execution potential while preserving all of Markdown's legitimate formatting output — the same defensive step any Markdown-consuming platform (a comment system, a documentation site, a note-taking app) should be taking internally, whether or not that step happens to be visible to the person using it.

Where a live preview actually earns its keep

Writing a README file or piece of technical documentation and wanting to check exactly how a nested list, a code block, or a table will actually render before committing it — Markdown's plain-text form is readable, but subtle formatting mistakes (a missing blank line before a list, an unescaped underscore inside a word) are easy to make and easy to miss without seeing the rendered output. Drafting content for any platform that accepts Markdown input — a blog, a wiki, a chat platform, an issue tracker — and wanting a fast way to preview formatting choices before pasting the final version into that platform's own, sometimes slower or less convenient, preview tool. Learning Markdown syntax itself: typing a construct and immediately seeing what it produces is a considerably faster way to build an intuition for the syntax than reading a reference document and trying to hold the mental model in your head.

Blank lines matter more than you'd expect

A huge share of "why isn't this rendering the way I expected" confusion in Markdown comes down to missing blank lines — a list, a heading, or a code block often needs a blank line separating it from the surrounding paragraph text to be recognized correctly, and a paragraph accidentally joined onto the line above it (no blank line between them) will often just merge into one continuous paragraph instead of rendering as two distinct elements. If something isn't rendering as expected, checking for a missing blank line above or below it is the first thing worth trying.

Frequently asked questions

Is the preview I see here exactly how the Markdown will render everywhere else?

Close, but not guaranteed identical. Markdown isn't a single, perfectly standardized format — it started as a simple set of conventions by John Gruber in 2004, and different platforms (GitHub, Slack, Reddit, various static site generators) have each extended or slightly reinterpreted parts of it since. This tool follows the widely-used CommonMark specification, which is the closest thing Markdown has to a rigorous standard and the basis most modern implementations build on, so the preview will match the vast majority of platforms closely — but a platform with unusual custom extensions (a specific emoji shortcode syntax, a custom callout block, platform-specific mention syntax) may render a small handful of edge cases differently from what you see here.

Why doesn't the preview show a script or embedded HTML I typed exactly as I typed it?

Because the rendered HTML is passed through a sanitization step before being displayed, which strips anything that could execute code in the page — script tags, event handlers, and similar constructs specifically. This is a deliberate safety measure: rendering arbitrary HTML from user-typed Markdown without sanitizing it first is a well-known security risk (a form of cross-site scripting), so this tool sanitizes the output the same way any responsible Markdown renderer should, even though the practical risk to you personally, in a tool that only renders your own input back to you, is low. It's implemented correctly here so the tool itself never becomes an example of the mistake it's protecting against.

Does indentation matter in Markdown the way it does in some programming languages?

Yes, in specific and sometimes surprising ways. Four spaces of indentation (or a tab) at the start of a line, outside of a list, is interpreted as a code block in standard Markdown — a common source of confusion for anyone pasting in already-indented text and wondering why it suddenly rendered as a monospaced code block instead of a normal paragraph. Inside a nested list, indentation is what determines nesting depth. Getting comfortable with exactly when whitespace matters and when it doesn't is one of the more common friction points for people new to Markdown, and a live preview like this one is one of the fastest ways to build that intuition — you see the effect of indentation immediately rather than guessing.

Can I write tables in Markdown, and why might they not show up?

Tables are part of GitHub Flavored Markdown (GFM), a widely adopted extension to the base CommonMark specification, and this tool's renderer supports them using the standard pipe-and-hyphen syntax. If a table isn't rendering as expected, the most common cause is a missing or malformed header-separator row — the line of dashes and pipes directly under the header row (like |---|---|) is what actually tells the parser 'this is a table,' and Markdown table syntax is stricter about this than it might look at a glance.

Why write in Markdown at all instead of just writing HTML directly?

Markdown was deliberately designed to be readable and writable as plain text, without needing to know HTML tags at all — a heading is just a line starting with a #, a bold word is just wrapped in **asterisks**, a link is just [text](url). That readability is the entire point: a Markdown document looks almost like the formatted output even before it's rendered, which makes it dramatically faster to write and easier to review in its raw form than the equivalent HTML, while still converting cleanly into real, valid HTML wherever it needs to be displayed.