Marked: Markdown HTML Parser

semantic-release-bot d5bc76eb3c chore(release): 15.0.10 [skip ci] 4 місяців тому
.devcontainer c554f93223 chore: add .devcontainer config (#2700) 2 роки тому
.github f9f3be8ff7 chore(ci): Publish with Provenance (#3305) 1 рік тому
api a1113e02ca chore: Update dingus.js import json (#3611) 6 місяців тому
bin b1fd3eafd8 fix: kill SIGINT signal at man for marked --help (#3483) 10 місяців тому
docs d120e014d3 chore(docs): Add marked-typograf extension to the docs (#3649) 4 місяців тому
man b8adee7f7c feat: add `--no-clobber` option to CLI (#3025) 1 рік тому
src e071e25d13 fix: fix non-breaking space in link url (#3667) 4 місяців тому
test e071e25d13 fix: fix non-breaking space in link url (#3667) 4 місяців тому
.editorconfig 92f0ae232f style 7 роки тому
.gitattributes 22fbcfa180 chore(git): mark `lib/*` as generated in `.gitattributes` (#2908) 2 роки тому
.gitignore 447f5af7e4 feat: add provideLexer and provideParser hooks (#3424) 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 c056b1d964 docs: Remove gzip size badge (#3512) 9 місяців тому
SECURITY.md 591ad80483 docs: Update authors link in SECURITY.md (#3013) 1 рік тому
eslint.config.js 8e7fe06eed chore: use @markedjs/eslint-config (#3391) 1 рік тому
package-lock.json d5bc76eb3c chore(release): 15.0.10 [skip ci] 4 місяців тому
package.json d5bc76eb3c chore(release): 15.0.10 [skip ci] 4 місяців тому
rollup.config.js 9b02e477c6 chore: consolidate eslint rules (#3368) 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/marked.min.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)