mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
v18.0.7
## [18.0.7](https://github.com/markedjs/marked/compare/v18.0.6...v18.0.7) (2026-07-21) ### Bug Fixes * Avoid O(n^2) backtracking in HTML block close and tilde interrupt regexes ([#4014](https://github.com/markedjs/marked/issues/4014)) ([f945fc5](https://github.com/markedjs/marked/commit/f945fc5e106c9bbeac833c60edc543aa5ab3222c)), closes [#3991](https://github.com/markedjs/marked/issues/3991) * Avoid O(n^2) masked source rebuild in inline tokenizer ([#4017](https://github.com/markedjs/marked/issues/4017)) ([9154f8f](https://github.com/markedjs/marked/commit/9154f8f3cb2fa136d85b61e1eacc4ef381a3b629)) * keep empty list after blockquote as a sibling block ([#4004](https://github.com/markedjs/marked/issues/4004)) ([3f144a0](https://github.com/markedjs/marked/commit/3f144a0e93b515877d5f55b92039d87eea9a6b04)) * preserve code spans adjacent to tildes ([#4012](https://github.com/markedjs/marked/issues/4012)) ([0de7188](https://github.com/markedjs/marked/commit/0de7188bf1f30511490c961d53865390e7ede956)) * Recognize setext headings whose first line starts with # ([#4015](https://github.com/markedjs/marked/issues/4015)) ([f056437](https://github.com/markedjs/marked/commit/f056437b389407ab3a29fe9cb61a989f043edb3e)), closes [#1](https://github.com/markedjs/marked/issues/1) * treat a line of only tabs as a blank line between paragraphs ([#4007](https://github.com/markedjs/marked/issues/4007)) ([bc2f121](https://github.com/markedjs/marked/commit/bc2f121456d152fafd7d2cbd2c21b273ca4c6862))
Marked
- ⚡ built for speed
- ⬇️ low-level compiler for parsing markdown without caching or blocking for long periods of time
- ⚖️ light-weight while implementing all markdown features from the supported flavors & specifications
- 🌐 works in a browser, on a server, or from a command line interface (CLI)
Demo
Check out the demo page to see Marked in action ⛹️
Docs
Our documentation pages are also rendered using marked 💯
Also read about:
Compatibility
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
Installation
CLI:
npm install -g marked
In-browser:
npm install marked
Usage
Warning: 🚨 Marked does not sanitize the output HTML. Please use a sanitize library, like DOMPurify (recommended), sanitize-html or insane on the output HTML! 🚨
DOMPurify.sanitize(marked.parse(`<img src="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>
License
Copyright (c) 2018+, MarkedJS. (MIT License) Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
Languages
TypeScript
37.1%
JavaScript
36.6%
HTML
26.3%