# Marked — card for AI agents

Fast, efficient markdown parser for converting markdown to HTML.

Category: Markdown, editors and content · npm package `marked` · latest version 18.1.2 (checked 2026-11-01)
Install: `npm install marked`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## Marked
- Import with `import { marked } from 'marked'` and convert with `marked.parse(markdown)`.
- Never insert Marked output into the DOM unsanitized when the input could be untrusted. Pass it through a sanitizer such as `DOMPurify.sanitize(marked.parse(...))`.
- Strip leading zero-width characters before parsing: `contents.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, "")`.
- Install extensions and renderer overrides through `marked.use(...)` rather than patching output.
- In the browser without a bundler, load `https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.js` or import `marked.esm.js` as a module.
- Target only current and LTS Node.js versions.
- For the CLI, put options in `~/.marked.json` or pass a file with `-c`.

## What it is
- Marked is a Markdown parser and compiler for JavaScript, MIT licensed, with a repository dating back to 2011. You pass it a Markdown string and get back HTML through `marked.parse()`. It runs in Node.js, in the browser (as a UMD script or an ESM import from a CDN), and as a command-line tool installed globally from npm.
- The maintainers call it "a low-level markdown compiler" and list zero dependencies. The documentation site is itself rendered with Marked, and it carries a section-by-section table of conformance against Markdown 1.0, CommonMark 0.31 and GitHub Flavored Markdown 0.29. Behaviour can be changed with options and with extensions installed through `marked.use`.
- It suits developers who want a small, direct Markdown-to-HTML step in client or server code, or from a shell script. The project is explicit that it does not clean its HTML output, so anyone rendering untrusted input has to add a sanitizer.

## Caveats
- Output HTML is not sanitized: Marked passes raw HTML through. The docs say that for potentially unsafe strings you must filter the output for XSS, and they recommend DOMPurify (with js-xss, sanitize-html and insane as alternatives).
- Zero-width characters can break parsing: Characters such as `\uFEFF` at the start of a file can interfere with parsing. The docs suggest stripping them with a regex before calling `marked.parse`.
- Some GFM sections still fail: The GFM table shows Autolinks at 15 of 19 and the Disallowed Raw HTML extension at 0 of 1. Entity and numeric character references pass 15 of 17 in both CommonMark and GFM. Other Markdown flavors may work but are not actively supported.
- Speed claim is not benchmarked yet: "Built for speed" carries footnotes. The maintainers say they are still working on metrics for comparison, and that strict spec compliance can make Marked slower in benchmarks.
- Only current and LTS Node.js: The README says only current and LTS Node.js versions are supported. Older ones can stop working without notice.

## Numbers (AgentGid data)
- Gid Score: 83.5 (#50 of all tools, 1 of 149 in its category)
- Used in 163 public projects set up for AI coding agents (2.6%)
- Downloads last week: 138,182,475 (as of 2026-11-24), +55.1% over 4 weeks
- GitHub stars: 37,323 (as of 2026-11-24)
- Last push: 2026-11-24

## Often used with
TypeScript 87.7%, Zod 56.4%, Vitest 47.2%, Express 27.0%, Playwright (JavaScript) 40.5%, Model Context Protocol SDK (JavaScript) 29.4%

## Checked alternatives (same job)
- react-markdown: https://agentgid.com/tools/react-markdown/agent.md
- remark-gfm: https://agentgid.com/tools/remark-gfm/agent.md
- markdown-it: https://agentgid.com/tools/markdown-it/agent.md
- MDX: https://agentgid.com/tools/mdx-js/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/marked/
- Homepage: https://marked.js.org
- Repository: https://github.com/markedjs/marked
- Source: https://github.com/markedjs/marked#readme
- Source: https://github.com/markedjs/marked
- Source: https://github.com/markedjs/marked/releases
- Source: https://marked.js.org

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
