Standards Compliance
- marked:
markedhas improved CommonMark compliance in recent versions but may still deviate in edge cases. GFM support is built-in. - markdown-it:
markdown-itis CommonMark-compliant by default and passes the official test suite. It also supports GitHub Flavored Markdown (GFM) via plugins. - remark:
remarkparses Markdown into an AST following CommonMark closely (viamdast-util-from-markdown) and supports GFM through optional plugins. - turndown:
turndownfocuses on HTML-to-Markdown fidelity rather than Markdown parsing, so standards compliance isn’t applicable in the same way. - showdown:
showdownis not CommonMark-compliant and has inconsistent behavior with edge cases; it predates CommonMark and uses its own interpretation. - remarkable:
remarkableis not fully CommonMark-compliant but covers most practical use cases. It implements a subset of GFM like tables and strikethrough.
Extensibility & Ecosystem
- marked:
markedallows limited extension via tokenizer and renderer overrides, but lacks a formal plugin system. - markdown-it:
markdown-ithas a rich plugin ecosystem (e.g., for math, emoji, containers) and supports custom syntax via inline rules and block parsers. - remark:
remarkis the most extensible—part of the unified (unified.js) ecosystem, allowing deep transformations using plugins (e.g., linting, formatting, converting to React). - turndown:
turndownsupports custom rules for handling specific HTML elements during conversion, enabling fine-grained control over output Markdown. - showdown:
showdownsupports extensions (e.g., custom parsers, filters), but the extension model is verbose and less intuitive. - remarkable:
remarkableoffers limited extensibility through custom renderers and rules, but no formal plugin architecture.
Performance
- marked:
markedis very fast for basic use cases and has low overhead, making it suitable for high-throughput rendering. - markdown-it:
markdown-itis highly optimized and among the fastest parsers, especially with syntax extensions enabled selectively. - remark:
remarkis slower than raw parsers due to AST construction and transformation pipeline, but this is offset by its flexibility in complex workflows. - turndown:
turndownis efficient for HTML-to-Markdown conversion, but performance depends on input HTML complexity and custom rule logic. - showdown:
showdownis slower than modern alternatives due to its legacy architecture and regex-heavy parsing. - remarkable:
remarkableis designed for speed and benchmarks well, particularly in safe mode with minimal escaping overhead.
Security (XSS Protection)
- marked:
markeddisables HTML by default in newer versions and provides ansanitizeoption (deprecated) or recommends using DOMPurify for output sanitization. - markdown-it:
markdown-itdoes not sanitize HTML by default; use themarkdown-it-sanitizerplugin or post-process output to prevent XSS. - remark:
remarkdoes not render HTML directly, so XSS risk depends on downstream renderers (e.g.,rehype-stringify). Safe handling requires explicit sanitization. - turndown:
turndownis not a rendering library, so XSS is not a concern during conversion—but the resulting Markdown could produce unsafe HTML if rendered unsafely later. - showdown:
showdownallows HTML by default; XSS must be mitigated manually via escaping or external sanitizers. - remarkable:
remarkableincludes built-in, optional HTML escaping and a ‘safe’ mode that strips dangerous tags, offering strong out-of-the-box XSS protection.
Code Examples
- marked:
markedexampleconst marked = require('marked'); const html = marked.parse('# Hello\n\nThis is **bold**.'); console.log(html); - markdown-it:
markdown-itexampleconst MarkdownIt = require('markdown-it'); const md = new MarkdownIt(); const html = md.render('# Hello\n\nThis is **bold**.'); console.log(html); - remark:
remarkexampleconst remark = require('remark'); const html = require('remark-html'); const processor = remark().use(html); const result = processor.processSync('# Hello\n\nThis is **bold**.').toString(); console.log(result); - turndown:
turndownexampleconst Turndown = require('turndown'); const turndown = new Turndown(); const markdown = turndown.turndown('<h1>Hello</h1><p>This is <strong>bold</strong>.</p>'); console.log(markdown); - showdown:
showdownexampleconst showdown = require('showdown'); const converter = new showdown.Converter(); const html = converter.makeHtml('# Hello\n\nThis is **bold**.'); console.log(html); - remarkable:
remarkableexampleconst Remarkable = require('remarkable'); const md = new Remarkable(); const html = md.render('# Hello\n\nThis is **bold**.'); console.log(html);