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

async-patterns.mddocs/guides/

Async Patterns Guide

Use async operations with Marked.

Enable Async Mode

import { marked } from "marked";

marked.setOptions({ async: true });

const html = await marked.parse('# Async Markdown');

Async Extensions

import { marked } from "marked";

marked.use({
  async: true,
  async walkTokens(token) {
    if (token.type === 'link') {
      await validateUrl(token.href);
    }
  }
});

const html = await marked.parse(markdown, { async: true });

When to Use Async

  • Async walkTokens callbacks
  • Async hooks (preprocess, postprocess)
  • Extensions that perform async operations
  • Fetching external data during parsing

Performance Note

Async mode adds overhead. Only enable when needed.