CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-marked

A markdown parser built for speed

Overview
Eval results
Files

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.

Install with Tessl CLI

npx tessl i tessl/npm-marked

docs

index.md

tile.json