Markdown to HTML Converter transforms Markdown syntax into clean, semantic HTML. Paste any Markdown β headings, bold/italic text, links, code blocks, tables, blockquotes, ordered and unordered lists β and see the corresponding HTML output instantly. Supports GitHub Flavored Markdown (GFM) extensions: task lists, strikethrough, tables, and fenced code blocks with language syntax highlighting.
Markdown is a lightweight markup language created by John Gruber (2004) as a plain-text-to-HTML conversion tool. The core syntax: # Heading (h1-h6 with 1-6 #s), **bold**, *italic*, [link text](url), , `inline code`, ```code block```, - unordered list, 1. ordered list, > blockquote, --- horizontal rule. GitHub Flavored Markdown (GFM) extended the spec with: - [x] task lists, ~~strikethrough~~, tables (| col1 | col2 |), and fenced code blocks with syntax highlighting (```python).
Markdown is used in: README files (GitHub, npm, PyPI), documentation (Docusaurus, MkDocs, Sphinx), blog posts (Jekyll, Hugo, Gatsby), wiki pages (GitHub Wiki, Notion, Confluence), and content management (many headless CMSs store content as Markdown). The Markdown ecosystem has evolved with MDX (Markdown with JSX for React) and Markdoc (Stripe's structured Markdown extension).
Heading and paragraph
Result: # Title β
Regular text
Code block with language
Result: ```python\nprint('hello')\n``` β
print('hello')Table
Result: | Col1 | Col2 |\n|------|------|\n| A | B | β
| Col1 | Col2 |
|---|---|
| A | B |
What is the difference between CommonMark and GitHub Flavored Markdown?
CommonMark (commonmark.org, 2014) is a strict, unambiguous specification for Markdown β it resolves the many edge cases and inconsistencies in Gruber's original Markdown spec. GitHub Flavored Markdown (GFM) is a superset of CommonMark that adds: tables, task list items (- [x] done), strikethrough (~~text~~), autolinks, disallowed raw HTML filtering, and fenced code blocks with syntax highlighting. Most modern Markdown processors (GitHub, GitLab, npm, PyPI, VS Code) implement GFM. MDX adds JSX/React components to Markdown.
How do I add syntax highlighting to code blocks?
In Markdown, specify the language after the opening fence: ```javascript (or ```js, ```python, etc.). The converter adds class='language-javascript' to the element. To apply syntax highlighting in the browser: include Prism.js or Highlight.js and their CSS. Prism.js: β it automatically highlights any with a language- class. Shiki is a more modern option that uses VS Code TextMate grammars for accurate highlighting.
How do I use Markdown with React?
Libraries for Markdown in React: react-markdown (most popular, uses remark/rehype pipeline, sanitizes HTML). @tailwindcss/typography (Tailwind plugin that styles rendered Markdown with prose class). MDX (@mdx-js/react): write JSX components directly in Markdown files β used by Nextra, Contentlayer, and Astro. Sanity CMS and Contentful support Markdown/MDX as content types. For static sites: Next.js + next-mdx-remote, Astro with .mdx files, or Docusaurus. For documentation: Starlight (Astro), Nextra (Next.js), Docusaurus (React).
What Markdown extensions are available?
CommonMark extensions: footnotes ([^1] text, ^1: note), definition lists (term: definition), math ($$LaTeX$$, via KaTeX or MathJax), diagrams (```mermaid code blocks rendered as diagrams). GFM adds: tables, task lists, strikethrough, autolinks. remark (JavaScript Markdown parser) has a plugin ecosystem: remark-gfm, remark-footnotes, remark-math, remark-toc, remark-prism. Python-Markdown has similar extensions. Pandoc (document converter) supports the most complete set of Markdown extensions.
Is it safe to render Markdown from user input?
No β not without sanitization. Markdown can contain raw HTML, and many parsers pass HTML through unchanged. A user could inject: in raw HTML, javascript: URLs in links ([click](javascript:alert(1))), or event handlers in HTML attributes. Defense: use a sanitizing parser. DOMPurify: sanitize the HTML output before inserting into the DOM. marked + DOMPurify: marked.parse(md) then DOMPurify.sanitize(html). react-markdown: uses a rehype-sanitize plugin. Never use innerHTML = markdownParser(userInput) without sanitization.