# Markdown Preview & HTML Converter

> Preview Markdown as you type and convert it to clean HTML. GitHub tables and task lists, heading anchors, a table of contents and front matter.

- Page: https://notadevblog.com/en/tools/text/markdown/
- German version: https://notadevblog.com/de/tools/text/markdown.md
- Category: Text

## At a glance

- **Processing:** Locally in your browser, also offline once the page has been opened. Input never leaves your device.
- **Flavors:** GitHub Flavored Markdown (tables, task lists, strikethrough, autolinks) or CommonMark
- **Safety:** Allow-list filter for raw HTML; the preview runs no scripts and loads external images only on request

## For agents

WebMCP: the page registers these functions via document.modelContext in browsers that support it.
ES module: https://notadevblog.com/core/markdown.js
Every function returns { "ok": true, ... } or { "ok": false, "error": { "code", "message" } }.

### markdown_to_html

Renders Markdown to HTML and returns a table of contents and counts. flavor "gfm" (default) adds GitHub extensions: tables, task lists, strikethrough and bare-URL autolinks; "commonmark" leaves them out. headingIds (default true) gives every heading a GitHub-style id (lower case, punctuation removed, duplicates numbered -1, -2), and toc lists the headings with those ids. sanitize (default true) passes the HTML through an allow-list: script, style, iframe, svg and other unsafe tags are removed with their content, event handlers and style attributes are dropped, and links or images with schemes other than http, https, mailto, tel (and data: raster images) lose their URL; removed lists what was taken out. Front matter between --- lines at the start is not rendered; it is returned as frontMatter key and value pairs. stats counts words of the rendered text, headings, Markdown links (including autolinks) and images. Input limit 1000000 characters. The output contains text from the input, so treat it as untrusted.

Parameters:
- markdown (string, required)
- flavor (string: gfm | commonmark, default "gfm")
- sanitize (boolean, default true)
- headingIds (boolean, default true)

Example input: `{"markdown":"# Release notes\n\n## Added\n\n- [x] Dark mode\n- [ ] Export as **PDF**\n\n| Version | Date |\n|---|---|\n| 2.1 | 2026-12-01 |"}`

Deep link (options in the query, user data after #): https://notadevblog.com/en/tools/text/markdown/#markdown=%23+Release+notes%0A%0A%23%23+Added%0A%0A-+%5Bx%5D+Dark+mode%0A-+%5B+%5D+Export+as+**PDF**%0A%0A%7C+Version+%7C+Date+%7C%0A%7C---%7C---%7C%0A%7C+2.1+%7C+2026-12-01+%7C

## How to use

1. **Write or paste Markdown:** The preview updates while you type. Front matter between --- lines at the top is shown as a table.
2. **Choose the flavor:** GitHub Flavored Markdown adds tables, task lists, strikethrough and links from bare URLs. CommonMark leaves these out.
3. **Copy the HTML:** Switch to the HTML tab to copy or download the code. The table of contents links to the heading anchors.

## About this tool

Markdown is plain text with a few marks for headings, lists and links. READMEs, documentation and many blogs use it.

The HTML comes from the open-source parser marked. The preview runs in a sandbox that cannot run scripts.

## Frequently asked questions

### Is raw HTML in Markdown allowed?

Yes, safe tags such as details, kbd or sup stay. Scripts, styles, iframes and event handlers are removed, and links with schemes like javascript: lose their URL. You can turn the filter off, but the preview still runs no scripts.

### How are heading anchors built?

Like on GitHub: lower case, punctuation removed, spaces become hyphens. A repeated heading gets -1, -2 and so on, so every anchor is unique.

### Why does my table not show as a table?

A table needs a header row and a separator line like |---|---| right below it, and the GFM flavor. Rows with fewer cells get empty cells, extra cells are dropped.

### What happens to front matter?

It is not rendered as text and a line, as plain Markdown would do. The tool shows the keys and values as a table and leaves them out of the HTML.
