Markdown-it, Marked and Showdown provide conversion-oriented APIs, while Remark organizes Markdown as syntax trees and plugins. Output format, syntax configuration and safe HTML handling must be chosen explicitly.
A one-step Markdown-to-HTML renderer and an AST-processing pipeline are different tools. Markdown-it renders through tokens and configurable rules. Marked provides a lexer/parser/rendering model with extension hooks. Showdown exposes a converter with options and flavors.
The remark package brings together unified, remark-parse and remark-stringify. Its ordinary input and output are Markdown. Producing HTML involves an appropriate bridge and HTML serialization, such as the documented remark-rehype and rehype-stringify pipeline. Linting or formatting Markdown is another valid use that does not require HTML at all.
CommonMark, GitHub-style tables and task lists, embedded HTML and other extensions are not an identical default contract across all four libraries. Remark uses plugins for extensions such as GFM; Markdown-it has presets and token/rule plugins; Showdown has its own options/flavors; Marked exposes supported syntax and renderer/tokenizer extensions.
Test the actual documents, including links, code fences, lists, tables and embedded HTML. A familiar-looking example does not establish that every parser produces the same tree or output for edge cases.
Marked explicitly does not sanitize its rendered HTML, and Showdown's security documentation likewise requires a separate policy for untrusted content. Markdown-it's raw-HTML and plugin configuration affects what it emits. Enabling arbitrary HTML or a plugin changes the safety assumptions even if a default preset is described as safe.
For an HTML-producing Remark pipeline, place appropriate sanitization in the HTML processing stage and account for the plugins that run before and after it. Merely escaping a string before Markdown parsing is not a complete policy for generated links, attributes and HTML. Review the final output's intended insertion context.
The collected Marked v18 package requires Node >=20; Remark's current distribution is ESM. Use release-specific import and plugin APIs rather than mixing old examples into a current toolchain. A conversion from HTML back to Markdown can lose information and need not reproduce the original source exactly.
Choose a direct converter for a direct conversion task, or a structured pipeline when content inspection and transformation justify it. Avoid unsupported performance rankings and automatic claims of safe rendering merely because conversion succeeded.
For Showdown 2.1.0, reviewed advisories identify link/anchor parsing ReDoS, metadata-title injection with completeHTMLDocument, and table-header ID injection under the relevant table/github-flavor settings. The advisories list no patched version. These specific conditions matter when evaluating an existing integration; they do not mean every feature is affected in the same way or that npm has deprecated the whole package.
An appropriate HTML/output policy addresses a different stage from parser CPU exhaustion. Bound untrusted processing and evaluate the enabled options; output sanitization alone does not repair an expensive parsing path. A successful conversion is not proof of safe content or acceptable processing cost.
Choose Marked for its parsing/rendering API and extension hooks when they fit the pipeline. The collected v18 release requires Node >=20 on Node, and rendered HTML is not automatically sanitized.
Choose Markdown-it for configurable Markdown-to-HTML rendering and a token/rule plugin model. Review its preset, raw-HTML setting and plugin behavior rather than treating every extension as a safe default.
Choose Remark when inspecting, transforming or formatting Markdown through AST plugins is central. The remark package itself combines Markdown parsing and stringification; HTML output requires a deliberate plugin pipeline.
Consider the exact Converter/flavor contract for a verified existing workflow, accounting for 2.1.0 link-parsing ReDoS and conditional metadata/table-header XSS risks. No patched version is listed in those advisories; do not treat HTML conversion as sanitization.
Check out the demo page to see Marked in action ⛹️
Our documentation pages are also rendered using marked 💯
Also read about:
Node.js: Only current and LTS Node.js versions are supported. End of life Node.js versions may become incompatible with Marked at any point in time.
Browser: Baseline Widely Available
CLI:
npm install -g marked
In-browser:
npm install marked
DOMPurify.sanitize(marked.parse(`<img src="https://raw.githubusercontent.com/markedjs/marked/HEAD/x" onerror="alert('not happening')">`));
CLI
# Example with stdin input
$ marked -o hello.html
hello world
^D
$ cat hello.html
<p>hello world</p>
# Print all options
$ marked --help
Node.js
import { marked } from 'marked';
const html = marked.parse('# Marked in Node.js');
console.log(html);
Browser
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Marked in the browser</title>
</head>
<body>
<div id="content"></div>
<script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.js"></script>
<script>
document.getElementById('content').innerHTML =
marked.parse('# Marked in the browser\n\nRendered by **marked**.');
</script>
</body>
</html>
or import esm module
<script type="module">
import { marked } from "https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js";
document.getElementById('content').innerHTML =
marked.parse('# Marked in the browser\n\nRendered by **marked**.');
</script>
Copyright (c) 2018+, MarkedJS. (MIT License) Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)