marked
Marked is a fast, low-level Markdown parser and compiler built for speed, providing a simple API for converting Markdown text to HTML. The library supports the …
Installation
npm install marked
yarn add marked
pnpm add marked
Import
import { marked } from 'marked';Quick Example
import { marked } from 'marked';
const markdown = '# Hello\n\nThis is **bold** and *italic*.';
const html = marked(markdown);
console.log(html);
// '<h1>Hello</h1>\n<p>This is <strong>bold</strong> and <em>italic</em>.</p>'About marked
Marked is a fast, low-level Markdown parser and compiler built for speed, providing a simple API for converting Markdown text to HTML. The library supports the full CommonMark specification plus GitHub Flavored Markdown (GFM) extensions including tables, task lists, strikethrough, and autolinks. Marked achieves its speed by using a single-pass lexer/parser architecture without caching or complex AST manipulation. The library provides extension points through custom renderers that override how specific Markdown elements are converted to HTML, custom tokenizers for adding new syntax, and walkTokens for post-processing the token stream. Marked handles code blocks with language detection for syntax highlighting integration, smartypants for typographic quotes and dashes, and configurable sanitization for security when rendering user-provided Markdown. The library works in both Node.js and browser environments with the same API. Marked is used by documentation generators, CMS platforms, comment systems, and any application that needs Markdown rendering. While unified/remark provides more extensible Markdown processing through AST manipulation, Marked remains the go-to choice when simplicity and speed are the primary concerns.
Quick Facts
| Package | marked |
| Category | Utility |
| Weekly Downloads | 8M+ |
| License | MIT |
| Install | npm install marked |
Related Packages
markdown-it is a fast and extensible Markdown parser that converts Markdown text to HTML with 100% C…
gray-matter is a library for parsing front-matter from strings or files, extracting the metadata sec…
Cheerio is a fast, flexible, and lean implementation of jQuery designed specifically for server-side…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.