Marked: Markdown HTML Parser

semantic-release-bot b4eb83bbb4 chore(release): 15.0.12 [skip ci] преди 3 месеца
.devcontainer c554f93223 chore: add .devcontainer config (#2700) преди 2 години
.github 7a6b2d7191 fix: use esbuild for accurate sourcemaps (#3670) преди 3 месеца
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 2c0e47a4ce fix: fix image alt text rendered to match common mark (#3668) преди 3 месеца
test 7a6b2d7191 fix: use esbuild for accurate sourcemaps (#3670) преди 3 месеца
.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 година
esbuild.config.js 7a6b2d7191 fix: use esbuild for accurate sourcemaps (#3670) преди 3 месеца
eslint.config.js 8e7fe06eed chore: use @markedjs/eslint-config (#3391) преди 1 година
package-lock.json b4eb83bbb4 chore(release): 15.0.12 [skip ci] преди 3 месеца
package.json b4eb83bbb4 chore(release): 15.0.12 [skip ci] преди 3 месеца
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)