Marked: Markdown HTML Parser

semantic-release-bot 2b47cced19 chore(release): 16.0.0 [skip ci] 1 ヶ月 前
.devcontainer c554f93223 chore: add .devcontainer config (#2700) 2 年 前
.github 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 ヶ月 前
api a1113e02ca chore: Update dingus.js import json (#3611) 6 ヶ月 前
bin 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 ヶ月 前
docs 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 ヶ月 前
man b8adee7f7c feat: add `--no-clobber` option to CLI (#3025) 1 年間 前
src 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 ヶ月 前
test 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 ヶ月 前
.editorconfig 92f0ae232f style 7 年 前
.gitattributes 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 ヶ月 前
.gitignore 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 ヶ月 前
.releaserc.json eb84a28925 chore: rename release config 3 年 前
CHANGELOG.md c831f3547e chore: add changelog that points to releases (#3207) 1 年間 前
LICENSE.md f17f55f9d9 chore(docs): update versioning and other docs (#1834) 4 年 前
README.md 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 ヶ月 前
SECURITY.md 591ad80483 docs: Update authors link in SECURITY.md (#3013) 1 年間 前
esbuild.config.js 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 ヶ月 前
eslint.config.js 0a35d8f28b fix: remove cjs build & update min node to 20 (#3687) 1 ヶ月 前
package-lock.json 2b47cced19 chore(release): 16.0.0 [skip ci] 1 ヶ月 前
package.json 2b47cced19 chore(release): 16.0.0 [skip ci] 1 ヶ月 前
tsconfig-type-test.json a990c54e0c fix: fix more types (#2893) 2 年 前
tsconfig.json ff1602c178 fix: noImplicitAny: true (#2891) 2 年 前
vercel.json 010c95f090 Use cleanUrls 5 年 前

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)