Marked: Markdown HTML Parser

semantic-release-bot 47adf92861 chore(release): 16.2.0 [skip ci] 3 days ago
.devcontainer c554f93223 chore: add .devcontainer config (#2700) 2 years ago
.github 193f41e707 chore(deps): Bump actions/checkout from 4 to 5 (#3742) 1 week ago
api a1113e02ca chore: Update dingus.js import json (#3611) 6 months ago
bin 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 month ago
docs 1d687e05ae docs: add marked-html-renderer to known extensions (#3724) 1 month ago
man b8adee7f7c feat: add `--no-clobber` option to CLI (#3025) 1 year ago
src 07691248df feat: add def token in tokens and renderer (#3745) 3 days ago
test 07691248df feat: add def token in tokens and renderer (#3745) 3 days ago
.editorconfig 92f0ae232f style 7 years ago
.gitattributes 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 month ago
.gitignore 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 month ago
.releaserc.json eb84a28925 chore: rename release config 3 years ago
CHANGELOG.md c831f3547e chore: add changelog that points to releases (#3207) 1 year ago
LICENSE.md f17f55f9d9 chore(docs): update versioning and other docs (#1834) 4 years ago
README.md 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 month ago
SECURITY.md 591ad80483 docs: Update authors link in SECURITY.md (#3013) 1 year ago
esbuild.config.js 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 month ago
eslint.config.js 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 month ago
package-lock.json 47adf92861 chore(release): 16.2.0 [skip ci] 3 days ago
package.json 47adf92861 chore(release): 16.2.0 [skip ci] 3 days ago
tsconfig-type-test.json a990c54e0c fix: fix more types (#2893) 2 years ago
tsconfig.json ff1602c178 fix: noImplicitAny: true (#2891) 2 years ago
vercel.json 010c95f090 Use cleanUrls 5 years ago

README.md

Marked

npm install size downloads github actions snyk

  • ⚡ 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

Checkout 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: Not IE11 :)

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

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) 2011-2022, Christopher Jeffrey. (MIT License)