marked README

The project's README from github.com/markedjs/marked. As one markdown file: README.md.

Marked

npm install size downloads github actions snyk inspect.software

Demo

Check out 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: Baseline Widely Available

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

Node.js

import { marked } from 'marked';
const html = marked.parse('# Marked in Node.js');
console.log(html);

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) 2018+, MarkedJS. (MIT License) Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)

marked (markedjs/marked)

Searching Database…

37.2K ·GitHub
What is this?Marked is a markdown parser and compiler built for speed. You feed it markdown text and get HTML back, and it runs in a browser, on a server, or from the command line.
Is it a library I code against, or a finished app?A JavaScript library you call from your own code, plus a small CLI for converting markdown right in the terminal. There is also a demo page if you just want to paste markdown and see the result.
How do I add it to a project?Install from npm: globally for the CLI (npm install -g marked) or as a project dependency for library use; in the browser, load it via a script tag or import the ESM module. Docs live at marked.js.org.
What do I need installed for it to work?For server or CLI use, a supported Node.js: only current and LTS releases, with the package targeting Node 20+. In the browser, any Baseline Widely Available browser works, and the library itself ships with zero runtime dependencies.
Is the HTML it produces safe to drop straight into my page?No — Marked does not sanitize its output. If any of the markdown can come from users, run the resulting HTML through a sanitizer like DOMPurify (recommended), sanitize-html or insane first.
Where does it run?Anywhere JavaScript runs: modern browsers (Baseline Widely Available), Node.js on a server, and the terminal through its CLI.
How is it licensed?MIT, so it is free to use in personal and commercial projects. Copyright is held by MarkedJS (2018+) and Christopher Jeffrey (2011-2018).
What is Marked's main selling point?Speed and light weight: it is a low-level compiler that parses markdown without caching or blocking for long periods, while staying light-weight and implementing all markdown features from the supported flavors and specifications.
Does it support GFM and CommonMark?It implements all markdown features from the supported flavors and specifications, and the repo explicitly tracks the commonmark and gfm specs among its topics.
Can I add custom syntax or behavior?Yes. Extensibility is a core feature: Marked is easily adaptable with custom extensions, and the documentation covers an Extensibility section alongside the Options reference.
Is there an easy way to try it before installing?Yes — the README links a demo page where you can see Marked in action, and the documentation site itself is rendered using Marked.
Creator
markedjs
Size
10.7 MB
Stars
37.2K
Age
15y
Commits · 90 Days