Marked: Markdown HTML Parser

Tony Brix a990c54e0c fix: fix more types (#2893) 2 ani în urmă
.devcontainer c554f93223 chore: add .devcontainer config (#2700) 2 ani în urmă
.github 610bc45d96 fix: use rollup to output js files (#2916) 2 ani în urmă
.vscode a990c54e0c fix: fix more types (#2893) 2 ani în urmă
api 7fa1f45456 chore: update dingus (#2624) 2 ani în urmă
bin cb549065f1 fix: Migrate to Typescript (#2805) 2 ani în urmă
docs 4e6acc8b85 docs: Tweaks to docs to make them clearer, regarding hooks and options to lexer/parser (#2946) 2 ani în urmă
lib a990c54e0c fix: fix more types (#2893) 2 ani în urmă
man 4afb228d95 fix: Convert to ESM (#2227) 3 ani în urmă
src a990c54e0c fix: fix more types (#2893) 2 ani în urmă
test f3af23ec98 fix: Fix unicode Regex miscounting emoji length (#2942) 2 ani în urmă
.editorconfig 92f0ae232f style 7 ani în urmă
.eslintignore 3dff1e4725 fix eslint config 5 ani în urmă
.eslintrc.json cb549065f1 fix: Migrate to Typescript (#2805) 2 ani în urmă
.gitattributes 22fbcfa180 chore(git): mark `lib/*` as generated in `.gitattributes` (#2908) 2 ani în urmă
.gitignore d559fe16ea chore: add recheck script (#2839) 2 ani în urmă
.releaserc.json eb84a28925 chore: rename release config 3 ani în urmă
LICENSE.md f17f55f9d9 chore(docs): update versioning and other docs (#1834) 4 ani în urmă
Makefile 4afb228d95 fix: Convert to ESM (#2227) 3 ani în urmă
README.md cb549065f1 fix: Migrate to Typescript (#2805) 2 ani în urmă
SECURITY.md 8fafd321e5 Update SECURITY.md 5 ani în urmă
bower.json 4afb228d95 fix: Convert to ESM (#2227) 3 ani în urmă
build-docs.js 89ddeec2a0 docs: fix older versions in demo (#2934) 2 ani în urmă
component.json 4afb228d95 fix: Convert to ESM (#2227) 3 ani în urmă
jasmine.json 4afb228d95 fix: Convert to ESM (#2227) 3 ani în urmă
marked.min.js a990c54e0c fix: fix more types (#2893) 2 ani în urmă
package-lock.json 6c2c64c193 chore(release): 7.0.3 [skip ci] 2 ani în urmă
package.json 6c2c64c193 chore(release): 7.0.3 [skip ci] 2 ani în urmă
rollup.config.js 610bc45d96 fix: use rollup to output js files (#2916) 2 ani în urmă
tsconfig-type-test.json a990c54e0c fix: fix more types (#2893) 2 ani în urmă
tsconfig-types.json a990c54e0c fix: fix more types (#2893) 2 ani în urmă
tsconfig.json ff1602c178 fix: noImplicitAny: true (#2891) 2 ani în urmă
vercel.json 010c95f090 Use cleanUrls 5 ani în urmă

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

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)