Marked: Markdown HTML Parser

Tristan F c554f93223 chore: add .devcontainer config (#2700) il y a 2 ans
.devcontainer c554f93223 chore: add .devcontainer config (#2700) il y a 2 ans
.github d1523c8541 GitHub Workflows security hardening (#2570) il y a 3 ans
api 7fa1f45456 chore: update dingus (#2624) il y a 2 ans
bin c26c4abb8c chore: added some jsdoc (#2418) il y a 3 ans
docs df9f2d351f docs: Add marked-emoji to known extensions (#2693) il y a 2 ans
lib a01488a436 🗜️ build [skip ci] il y a 2 ans
man 4afb228d95 fix: Convert to ESM (#2227) il y a 3 ans
src e692634f70 fix: fix tabs at beginning of list items (#2679) il y a 2 ans
test e692634f70 fix: fix tabs at beginning of list items (#2679) il y a 2 ans
.editorconfig 92f0ae232f style il y a 7 ans
.eslintignore 3dff1e4725 fix eslint config il y a 5 ans
.eslintrc.json 803a6a960a chore(dev-deps): remove eslint-plugin-standard (#1849) il y a 4 ans
.gitattributes a34e86ed59 chore: avoid linefeed errors running on windows (#2277) il y a 3 ans
.gitignore 432bb1d9eb Copy license to docs il y a 5 ans
.releaserc.json eb84a28925 chore: rename release config il y a 3 ans
LICENSE.md f17f55f9d9 chore(docs): update versioning and other docs (#1834) il y a 4 ans
Makefile 4afb228d95 fix: Convert to ESM (#2227) il y a 3 ans
README.md 0dcda393dd docs: Info to install @types/marked for ts projects (#2577) il y a 2 ans
SECURITY.md 8fafd321e5 Update SECURITY.md il y a 5 ans
bower.json 4afb228d95 fix: Convert to ESM (#2227) il y a 3 ans
build-docs.js c26c4abb8c chore: added some jsdoc (#2418) il y a 3 ans
component.json 4afb228d95 fix: Convert to ESM (#2227) il y a 3 ans
jasmine.json 4afb228d95 fix: Convert to ESM (#2227) il y a 3 ans
marked.min.js a01488a436 🗜️ build [skip ci] il y a 2 ans
package-lock.json 372433c071 chore(deps): Bump json5 from 1.0.1 to 1.0.2 (#2702) il y a 2 ans
package.json a1f33a7dfb chore(deps-dev): Bump eslint from 8.30.0 to 8.31.0 (#2696) il y a 2 ans
rollup.config.js fdbbec699f chore(deps-dev): Bump rollup from 2.79.1 to 3.2.5 (#2646) il y a 2 ans
vercel.json 010c95f090 Use cleanUrls il y a 5 ans

README.md

Marked

npm gzip size 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
npm install @types/marked # For TypeScript projects

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/marked.min.js"></script>
  <script>
    document.getElementById('content').innerHTML =
      marked.parse('# Marked in the browser\n\nRendered by **marked**.');
  </script>
</body>
</html>

License

Copyright (c) 2011-2022, Christopher Jeffrey. (MIT License)