Skip to content

segmentMarkdown

Split markdown text into an ordered list of prose and fenced-code segments. A fenced-code segment is delimited by a line of 3+ backticks or tildes; its content is captured raw (never escaped) so it can be re-emitted as a literal MDX code fence.

Import:

import { segmentMarkdown } from '@mnaoumov/typescript-dev-toolkit/docs-site/api-doc-text-utils';

Signature:

function segmentMarkdown(text: string): MarkdownSegment[]

Parameters:

Parameter Type Description
text string The text.

Returns: MarkdownSegment[] — The segments, in order.