mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
v18.2.0
# [18.2.0](https://github.com/markedjs/marked/compare/v18.1.3...v18.2.0) (2026-11-09) ### Bug Fixes * keep hard line breaks in image alt text ([#4187](https://github.com/markedjs/marked/issues/4187)) ([ed54c54](https://github.com/markedjs/marked/commit/ed54c541ef75740634a09233c685a5bba1e92944)) * let emphasis open after the other delimiter character ([#4169](https://github.com/markedjs/marked/issues/4169)) ([219492a](https://github.com/markedjs/marked/commit/219492a64e5cd0a7f264678b7a80bdd2201c970b)) * let emphasis open and close in angle brackets that are not html ([#4190](https://github.com/markedjs/marked/issues/4190)) ([7bfa1f7](https://github.com/markedjs/marked/commit/7bfa1f70e8756c6ee3e47c235a34556edbf48b49)) * preserve zero from named extension renderers ([#4199](https://github.com/markedjs/marked/issues/4199)) ([b81a00a](https://github.com/markedjs/marked/commit/b81a00a2e332a47e0ccc0ff376babfe78392f321)) * text after a heading or code block in a nested list item is pulled into the outer item ([#4179](https://github.com/markedjs/marked/issues/4179)) ([4cb767a](https://github.com/markedjs/marked/commit/4cb767a966b496eb74cb2779ff2b8d0054a2a035)) ### Features * add lastToken to lexer state ([#4160](https://github.com/markedjs/marked/issues/4160)) ([e4ab77f](https://github.com/markedjs/marked/commit/e4ab77f6e46d478cfed8697c308dddc60b9ddf99))
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%