Skip to content

extractDocsSnippets

Extracts the fenced code blocks of the checked languages from a markdown document.

A fence inside a blockquote or a list item is recognized too: its prefix (> , indentation) is stripped from every line of its code.

Import:

import { extractDocsSnippets } from '@mnaoumov/typescript-dev-toolkit/docs-site/docs-snippets';

Signature:

function extractDocsSnippets(markdown: string): DocsSnippet[]

Parameters:

Parameter Type Description
markdown string The markdown document.

Returns: DocsSnippet[] — The snippets, in document order.