Marked: Markdown HTML Parser

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

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)