MCPcopy
hub / github.com/markedjs/marked

github.com/markedjs/marked @v18.0.5 sqlite

repository ↗ · DeepWiki ↗ · release v18.0.5 ↗
276 symbols 649 edges 49 files 21 documented · 8%
README

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

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="https://github.com/markedjs/marked/raw/v18.0.5/x" onerror="alert('not happening')">`));

CLI

# Example with stdin input
$ marked -o hello.html
hello world
^D
$ cat hello.html


hello world


# 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>





  <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)

Extension points exported contracts — how you extend this code

RegexpObj (Interface)
(no doc)
test/recheck.ts
NameToken (Interface)
(no doc)
test/types/marked.ts
TokenizerThis (Interface)
(no doc)
src/MarkedOptions.ts
Rules (Interface)
(no doc)
src/rules.ts
Blockquote (Interface)
(no doc)
src/Tokens.ts
TokenizerExtension (Interface)
(no doc)
src/MarkedOptions.ts
Br (Interface)
(no doc)
src/Tokens.ts
RendererThis (Interface)
(no doc)
src/MarkedOptions.ts

Core symbols most depended-on inside this repo

parse
called by 99
src/Parser.ts
use
called by 96
src/Instance.ts
edit
called by 34
src/rules.ts
parseInline
called by 30
src/Parser.ts
inline
called by 20
src/Lexer.ts
timeout
called by 18
test/unit/utils.js
text
called by 12
src/Renderer.ts
inlineTokens
called by 11
src/Lexer.ts

Shape

Function 141
Method 85
Interface 34
Class 16

Languages

TypeScript100%

Modules by API surface

docs/demo/demo.js35 symbols
src/Tokenizer.ts29 symbols
src/Tokens.ts25 symbols
src/Renderer.ts25 symbols
test/types/marked.ts16 symbols
test/unit/marked.test.js13 symbols
src/TextRenderer.ts12 symbols
src/Instance.ts11 symbols
docs/js/index.js11 symbols
bin/main.js11 symbols
src/Lexer.ts10 symbols
src/Hooks.ts9 symbols

Dependencies from manifests, versioned

@arethetypeswrong/cli0.18.3 · 1×
@markedjs/eslint-config1.0.14 · 1×
@markedjs/testutils18.0.0-1 · 1×
@semantic-release/commit-analyzer13.0.1 · 1×
@semantic-release/git10.0.1 · 1×
@semantic-release/github12.0.8 · 1×
@semantic-release/npm13.1.5 · 1×
@semantic-release/release-notes-generator14.1.1 · 1×
cheerio1.2.0 · 1×
commonmark0.31.2 · 1×
cross-env10.1.0 · 1×
dts-bundle-generator9.5.1 · 1×

For agents

$ claude mcp add marked \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact