Marked
Fast, efficient markdown parser for converting markdown to HTML.
3. Used by agents' projects
Dependency in 163 public GitHub projects set up for AI coding agents that we scanned (2.6%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error
What Marked does
Marked is a zero-dependency Markdown compiler that publishes its pass rate for every section of the specs it follows, but it does not sanitize its HTML output, so making that output safe is up to you.
Marked popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How Marked is used
- Marked is a dependency in 163 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (3.3% of the 4,867 JavaScript/TypeScript ones), #3 of 149 in markdown, editors and content.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 550; those are left out of every share on this page.
- The most used alternative in our scan is react-markdown (248 projects).
- Projects that use it most often also use TypeScript (87.7%), Zod (56.4%), Vitest (47.2%).
By coding agent
Often used with
Marked in practice
Strengths
The site lists pass counts for each section of Markdown 1.0, CommonMark 0.31 and GFM 0.29. Overall it reports 100% for Markdown 1.0 and CommonMark 0.31, and 99% for GFM. You can see which sections fall short instead of trusting a single headline claim.
The docs describe Marked as a compiler that parses "without caching or blocking for long periods of time". In a footnote they list it as having zero dependencies.
The same package covers an import in Node.js, a CDN script tag in the browser, and a global <code>marked</code> command. The CLI reads from stdin, a string (<code>-s</code>) or a file (<code>-i</code>).
The CLI can read a <code>.json</code> options object, or a <code>.js</code> file that can install extensions via <code>marked.use</code>. By default it checks <code>~/.marked.json</code>, then <code>~/.marked.js</code>, then <code>~/.marked/index.js</code>.
Watch out for
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).
Characters such as <code>\uFEFF</code> at the start of a file can interfere with parsing. The docs suggest stripping them with a regex before calling <code>marked.parse</code>.
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.
Parse Markdown in Node.js
import { marked } from 'marked';
const html = marked.parse('# Marked in Node.js');
console.log(html);More about Marked
Head to head
- react-markdown vs Marked used together in 31 projects
- Marked vs markdown-it used together in 7 projects
- Marked vs MDX used together in 10 projects
Packages around it
- zod: Schema validation
- vitest: Test runner
- typescript: Typed JavaScript
- tailwindcss: Utility-first CSS
- @playwright/test: End-to-end browser tests
- uuid: UUID generation
More in Markdown, editors and content
Alternatives
Marked This page
React component for rendering markdown with customizable component handling.
Remark plugin adding GitHub Flavored Markdown support for tables and strikethrough.
Modern pluggable markdown parser with plugin ecosystem.
Write JSX directly in Markdown for rich, interactive content and documentation.
Get started
Install it.
npm install markedRules for your agent
## 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`.