Marked: Markdown HTML Parser

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

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)