mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
v18.1.2
## [18.1.2](https://github.com/markedjs/marked/compare/v18.1.1...v18.1.2) (2026-10-26) ### Bug Fixes * allow a tab or end of input after a type 6 html block tag name ([#4128](https://github.com/markedjs/marked/issues/4128)) ([e09c40d](https://github.com/markedjs/marked/commit/e09c40dfc78aa284a33b11a65bc5e16365069f46)) * apply emphasis flanking and rules 9-10 to the whole delimiter run ([#4145](https://github.com/markedjs/marked/issues/4145)) ([5d8e234](https://github.com/markedjs/marked/commit/5d8e2340d78c25c611e1d8215b302fd48f01a601)) * **cli:** await config functions before parsing ([#4138](https://github.com/markedjs/marked/issues/4138)) ([3a11ad1](https://github.com/markedjs/marked/commit/3a11ad148397b7628256f5e5d76a454213480c63)) * **cli:** create no-clobber output files atomically ([#4135](https://github.com/markedjs/marked/issues/4135)) ([e7c4f64](https://github.com/markedjs/marked/commit/e7c4f64c433c46044fc1aba451ab1c162af704a7)) * do not continue a block quote paragraph from a whitespace-only line ([#4134](https://github.com/markedjs/marked/issues/4134)) ([42f34a8](https://github.com/markedjs/marked/commit/42f34a8411c4c14ca2019d69e6b1771f663248f9)) * expand a tab after the block quote marker to the next tab stop ([#4110](https://github.com/markedjs/marked/issues/4110)) ([2d3899b](https://github.com/markedjs/marked/commit/2d3899bf7c9e604805c4937b16dd0022480e64ce)) * honor per-call async options when composing hooks ([#4139](https://github.com/markedjs/marked/issues/4139)) ([379be9d](https://github.com/markedjs/marked/commit/379be9d65609d4c8c017ac873801573fe77420d4)) * keep a line starting with # but no space in the list item ([#4127](https://github.com/markedjs/marked/issues/4127)) ([6b63189](https://github.com/markedjs/marked/commit/6b63189546f7dd842adac65c799c749a00bdd598)) * keep duplicate link definitions in the tokens ([#4132](https://github.com/markedjs/marked/issues/4132)) ([2784acc](https://github.com/markedjs/marked/commit/2784acce375c8529071c04ae90a05814d02fad7a)) * keep lazy lines after a list in a nested blockquote ([#4137](https://github.com/markedjs/marked/issues/4137)) ([38c7e55](https://github.com/markedjs/marked/commit/38c7e552072e60681369c4ea393787f49fd761bb)) * keep lazy setext underlines in list items as text ([#4126](https://github.com/markedjs/marked/issues/4126)) ([398234c](https://github.com/markedjs/marked/commit/398234ccea3b3a4f2353fef1decda29a60f29486)) * render nested image alt formatting as plain text ([#4131](https://github.com/markedjs/marked/issues/4131)) ([15f59bb](https://github.com/markedjs/marked/commit/15f59bb88bd462876cbc3af075baf73ec9337e31)) * stop an unclosed inline raw tag from unescaping later blocks ([#4130](https://github.com/markedjs/marked/issues/4130)) ([4562b6f](https://github.com/markedjs/marked/commit/4562b6f97988a75a9f20234626f8bbaab72af927)) ### Performance Improvements * ~16% faster parsing by skipping em/strong masking for runs without *, _ or ~ ([#4142](https://github.com/markedjs/marked/issues/4142)) ([f0fd3e0](https://github.com/markedjs/marked/commit/f0fd3e0e22c1acc7b5a65ebfe54138af38955e10))
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
- 🛠️ easily adaptable with custom extensions
- 🌐 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%