markedjs /marked

A markdown parser and compiler. Built for speed.

★ 37,303⑂ 3,829👁 377⑃ 2,353● 1,698▤ 188
TypeScriptNOASSERTIONCreated 2011-07-24marked.js.org
下载:v18.2.0v18.2.0 ↓18.2.02026-11-09
-1
日增长
+8
周增长
37,303
stars
3,829
forks
377
watchers
2,353
prs
1,698
issues
188
releases

README

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:

 Options
 Extensibility

 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:

sh
npm install -g marked


In-browser:

sh
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());


CLI

 bash
 Example with stdin input
$ marked -o hello.html
hello world
^D
$ cat hello.html
hello world


bash
 Print all options
$ marked --help


Node.js

js
import { marked } from 'marked';
const html = marked.parse(' Marked in Node.js');
console.log(html);


Browser

html



  
  Marked in the browser


  
  
  
    document.getElementById('content').innerHTML =
      marked.parse(' Marked in the browser\n\nRendered by marked.');
  



or import esm module

html

  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.');



 License

Copyright (c) 2018+, MarkedJS. (MIT License)
Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)

Top issues

Discussions

Latest release

v18.2.0 v18.2.0 2026-11-09
18.2.0 (2026-11-09)


 Bug Fixes

 keep hard line breaks in image alt text (4187) (ed54c54)
 let emphasis open after the other delimiter character (4169) (219492a)
 let emphasis open and close in angle brackets that are not html (4190) (7bfa1f7)
 preserve zero from named extension renderers (4199) (b81a00a)
 text after a heading or code block in a nested list item is pulled into the outer item (4179) (4cb767a)


 Features

 add lastToken to lexer state (4160) (e4ab77f)

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON