Skip to content

escapeMdxProse

Escape MDX-unsafe characters (<, {, }) in prose text, while leaving inline code spans (`code`) and markdown links ([text](url)) untouched. MDX parses bare </{ in prose as JSX/expressions, so they must be backslash-escaped to render as literal text.

Import:

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

Signature:

function escapeMdxProse(text: string): string

Parameters:

Parameter Type Description
text string The prose to escape.

Returns: string — The escaped prose.