How to use the markdown linter
- Paste or type your Markdown text into the Markdown source field.
- The markdown linter immediately parses the input and checks for syntax issues.
- Review any warnings listed at the top of the result area.
- Examine the rendered HTML below the warnings to verify formatting.
- Fix any reported issues in your source text and watch the output update live.
Supported CommonMark Subset
This markdown linter evaluates a specific subset of CommonMark. The supported elements are:
- Headings: ATX style only (
# H1through###### H6). A space after the hash marks is required. - Emphasis and strong: Asterisks for italic (
*text*) and bold (**text**). - Inline code: Backticks (
`code`). - Fenced code blocks: Three backticks (
```) on their own lines. - Links and images:
[text](url)and. - Unordered lists: Lines starting with
-,*, or+. - Ordered lists: Lines starting with digits followed by
.. - Blockquotes: Lines starting with
>. - Horizontal rules: Three or more hyphens, asterisks, or underscores on a line by themselves.
- Tables: Pipe-delimited rows with a separator row of hyphens.
The document is parsed with the full CommonMark rules (setext headings, nested lists, reference links and indented code included) plus GitHub-style tables, strikethrough and task lists, and rendered to HTML. The lint checks themselves are limited to the issues listed below. If you need to convert from HTML instead, use the html to markdown tool.
How the Linting Rules Work
The checker scans each line outside fenced code before parsing and reports a heading without a space after the hash marks, raw HTML tags, trailing whitespace that is not a hard line break, and emphasis delimiters that never found a partner. For example, if it encounters #Heading without a space, it flags a warning because standard Markdown renderers will treat it as plain text rather than a heading. Similarly, raw HTML tags like <div> trigger a warning because they are escaped in the output for security.
Consider this input: #Bad heading followed by a blank line, then Good paragraph, then <b>raw html</b>. The linter produces two warnings: one for the missing space on line 1, and one for the raw HTML on line 3. The rendered output escapes the HTML entities so no scripts or unexpected markup can execute. This makes the tool useful for checking documents before publishing them on platforms that sanitize user input.
Common Markdown Mistakes
When using a markdown linter, several recurring mistakes appear across documents:
- Missing spaces after heading markers. Writing
##Titleinstead of## Titleprevents the parser from recognizing a heading. - Mismatched emphasis delimiters. Opening with
*but closing with_leaves the text unformatted. - Forgetting blank lines between blocks. Paragraphs, lists, and headings usually require an empty line separating them to parse correctly.
- Using raw HTML. While some parsers allow it, many environments strip or escape HTML tags. This tool always escapes them.
- Incorrect table alignment rows. The separator row must contain at least three hyphens per column, such as
| --- | --- |.
Catching these early saves time. If you just need to strip all formatting entirely, try the markdown to text converter.
Reference Table of Valid Syntax
The following table shows the exact syntax this markdown linter accepts and the HTML it produces.
| Element | Markdown Input | HTML Output |
|---|---|---|
| Heading 1 | # Text | <h1>Text</h1> |
| Heading 2 | ## Text | <h2>Text</h2> |
| Bold | **text** | <strong>text</strong> |
| Italic | *text* | <em>text</em> |
| Inline code | `code` | <code>code</code> |
| Link | [t](u) | <a href="u">t</a> |
| Image |  | <img src="u" alt="a" /> |
| Unordered list | - item | <ul><li>item</li></ul> |
| Ordered list | 1. item | <ol><li>item</li></ol> |
| Blockquote | > text | <blockquote><p>text</p></blockquote> |
| Horizontal rule | --- | <hr /> |
For generating a table of contents from your headings, use the markdown toc generator.
Security and HTML Escaping
A critical feature of this markdown linter is its strict handling of HTML. Raw HTML in the source text is escaped (angle brackets become entities) and links whose address is not http, https, mailto, tel, ftp or relative lose their target before rendering. This prevents cross-site scripting when the output is embedded in a web page.
If your workflow requires converting existing HTML documents into Markdown first, use the html to markdown tool. Conversely, if you need to produce clean HTML from validated Markdown for a static site, the markdown to html converter handles that transformation. When sharing Markdown in chat applications that do not support standard syntax, the markdown to slack formatter adapts the syntax accordingly.
Worked examples
| Example | Input | Result |
|---|---|---|
| Valid document | Markdown source: # Hello World / This is a **valid** paragraph with a [link](https://example.com). / - Item one / - Item two / | <h1>Hello World</h1> / <p>This is a <strong>valid</strong> paragraph with a <a href="https://example.com">link</a>.</p> / <ul> / <li>Item one</li> / <li>Item two</li> / </ul> |
| Document with issues | Markdown source: #Bad heading / Unclosed *emphasis here / <script>alert(1)</script> / | Missing space after '#' on line 1, Raw HTML detected on line 5 and will be escaped., Unmatched '*' delimiter near "Unclosed *emphasis here". |
| Table and code | Markdown source: | Name | Age | / | --- | --- | / | Alice | 30 | / ``` / code block / ``` / | <table> / <thead> / <tr><th>Name</th><th>Age</th></tr> / </thead> / <tbody> / <tr><td>Alice</td><td>30</td></tr> / </tbody> / </table> / <pre><code>code block / </code></pre> |
FAQ
What does this markdown linter check?
It checks for missing spaces after heading markers, raw HTML tags, trailing whitespace and unmatched emphasis delimiters, outside code blocks.
Is my text sent to a server?
No. The entire parsing and linting process happens locally in your browser. Your text is never uploaded anywhere.
Why is my raw HTML being escaped?
For security reasons, this tool does not pass through raw HTML. All angle brackets are escaped to prevent script execution in the rendered output.
Does it support nested lists or setext headings?
Yes. Nested lists, setext headings, reference links, indented code, tables, blockquotes and fenced code blocks are all parsed; the warnings cover a short list of common mistakes rather than every style rule. This linter supports a flat subset of CommonMark including ATX headings, basic lists, tables, blockquotes, and fenced code blocks. Nested structures are not parsed.
Can I use this to validate Markdown files before committing them?
Yes. Paste your file contents into the source field to catch syntax issues. For automated pipelines, consider integrating a CLI-based markdown linter alongside this manual check.
How do I fix a missing space warning on a heading?
Add a single space between the hash characters and the heading text. For example, change #Title to # Title.