Skip to content

docs-site/api-doc-text-utils

Text/markdown/escaping utilities and identifier helpers for the API documentation generator.

Function Description
computeOverloadKey Compute an overload key for methods with distinguishing first param (e.g. on(‘changed’,…))
ensureDirectory Creates the folder a file is about to be written to.
escapeJsString Escape text for use inside a JS string within a JSX expression: {…{key: “…”}}
escapeJsxAttribute Escape text for use inside a JSX attribute: attr=“…” (MDX uses HTML-style parsing)
escapeMarkdown Escape text for a markdown table cell.
escapeMdxAngleBrackets Escape angle brackets so MDX does not read them as JSX.
escapeMdxBraces Escape curly braces in MDX markdown content to prevent JSX expression parsing
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.
escapeYaml Escape text for a double-quoted YAML value.
foldTsDocParagraphs Collapse single newlines within paragraphs to spaces, preserve double newlines as paragraph breaks. Fenced code blocks (backtick or tilde fences) are preserved verbatim — their internal newlines are NOT folded, so embedded code survives to be re-emitted as a real code fence downstream.
getDisplayName The type’s name with its type parameters, without their constraints.
getImportStatement Emit the import statement for a documented export. The subpath equals the type’s namespace (its source path relative to src), so src/string.ts of @mnaoumov/typescript-lib is @mnaoumov/typescript-lib/string. Interfaces / type aliases / enums are imported with import type; classes / functions / variables with a value import.
getNamespaceDirectory The folder a namespace’s pages are written to.
memberRouteSegment Sanitize a member name for use in a case-PRESERVED URL/route segment (e.g. showNotice).
memberSlug Sanitize a member name for use as an on-disk FILENAME (lowercased, collision-safe).
overloadRouteSegment Slugify an overload key for a case-PRESERVED URL/route segment: on(“changed”) -> on-changed.
overloadSlug Slugify an overload key for an on-disk FILENAME: on(“changed”) -> on-changed (lowercased).
replaceRegExpMatches Replace every match of a global regular expression with what a replacer builds from the match. The typed counterpart of String.prototype.replaceAll with a callback, whose arguments are typed only positionally.
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.
simplifyType Strip the import("…") qualifiers ts-morph prints before a type that is not in scope, recording each one’s declaration file first, since it is the one place a printed type names where it was declared.
stripMarkdown Strip markdown formatting to plain text for use in meta descriptions
truncateSignature Normalize a code signature for the signature: frontmatter / OG card: collapse whitespace to single spaces and truncate to a card-friendly length with an ellipsis.