or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/marked@17.0.x

docs

index.md
tile.json

tessl/npm-marked

tessl install tessl/npm-marked@17.0.0

A markdown parser built for speed

performance.mddocs/guides/

Performance Guide

Optimize Marked for your use case.

Performance Characteristics

  • Non-blocking: No I/O operations
  • No caching: Each parse is independent
  • Memory efficient: Tokens kept in memory during parsing only
  • Fast: <10ms for 100KB documents (typical)

Caching

import { marked } from "marked";

const cache = new Map();

function cachedParse(markdown) {
  if (cache.has(markdown)) {
    return cache.get(markdown);
  }
  const html = marked.parse(markdown);
  cache.set(markdown, html);
  return html;
}

Reuse Instances

import { marked } from "marked";

const parser = new marked.Parser();
const renderer = new marked.Renderer();
parser.renderer = renderer;

// Parse multiple documents
const htmls = documents.map(doc => {
  const tokens = marked.lexer(doc);
  return parser.parse(tokens);
});

Avoid Async Overhead

// Only use async when needed
marked.setOptions({ async: false });  // Faster

Profile Extensions

console.time('parse-with-extension');
const html = marked.parse(markdown);
console.timeEnd('parse-with-extension');