markdown
Shared markdown-oriented helpers used by formatter presets.
appendExtensionToAbsolutePathWithoutExtension()β
function appendExtensionToAbsolutePathWithoutExtension(url, extension): string;
Defined in: formatters/markdown.ts:159
Appends an extension only when URL is an absolute path without a file extension.
Fragment-only and already suffixed paths are returned unchanged.
Parametersβ
urlβ
string
Link URL to evaluate.
extensionβ
string
Extension suffix to append when eligible.
Returnsβ
string
Updated or original URL depending on path shape.
appendLinkExtension()β
function appendLinkExtension(url, extension): string;
Defined in: formatters/markdown.ts:146
Appends an extension to a link URL.
Parametersβ
urlβ
string
Link URL to update.
extensionβ
string
Extension suffix (for example .mdx).
Returnsβ
string
URL with appended extension.
extractFrontmatterTitle()β
function extractFrontmatterTitle(formatted): string;
Defined in: formatters/markdown.ts:64
Extracts a title value from pre-formatted frontmatter lines.
Parametersβ
formattedβ
string[] | null | undefined
Serialized frontmatter lines without delimiters.
Returnsβ
string
Parsed title value, or an empty string when no title: line exists.
formatMarkdownFrontmatter()β
function formatMarkdownFrontmatter(formatted, delimiter?, eol?): string;
Defined in: formatters/markdown.ts:127
Formats a markdown frontmatter block from preformatted lines.
Parametersβ
formattedβ
string[] | null | undefined
Serialized frontmatter lines without delimiters.
delimiter?β
string = "---"
Frontmatter delimiter marker.
eol?β
string = "\n"
End-of-line separator.
Returnsβ
string
Complete frontmatter block or an empty string when input is absent.
indentMarkdownLines()β
function indentMarkdownLines(text, spaces, eol?): string;
Defined in: formatters/markdown.ts:178
Indents non-empty markdown lines by a fixed amount of spaces.
Parametersβ
textβ
string
Multiline markdown block to indent.
spacesβ
number
Number of spaces to prepend to non-empty lines.
eol?β
string = "\n"
Line separator used to split and join lines.
Returnsβ
string
Indented multiline string.
mergeFrontmatterLines()β
function mergeFrontmatterLines(props, formatted): string[];
Defined in: formatters/markdown.ts:84
Merges frontmatter object entries with preformatted frontmatter lines.
Preformatted lines take precedence over object values when keys overlap.
Lines without a key: value shape and comment lines are ignored.
Parametersβ
propsβ
Record<string, unknown> | null | undefined
Frontmatter key-value object.
formattedβ
string[] | null | undefined
Serialized frontmatter lines without delimiters.
Returnsβ
string[]
Merged frontmatter lines in insertion order.
parseFrontmatterTitleLine()β
function parseFrontmatterTitleLine(line): string;
Defined in: formatters/markdown.ts:34
Parses a YAML-like frontmatter title line and returns its string value.
Accepts unquoted values (title: My Title) and quoted values
(title: "My Title" or title: 'My Title').
Parametersβ
lineβ
string
Candidate frontmatter line.
Returnsβ
string
Parsed title value, or an empty string when the line is not a title.
quoteMarkdownLines()β
function quoteMarkdownLines(text, eol?): string;
Defined in: formatters/markdown.ts:16
Prefixes each line with a Markdown blockquote marker.
Parametersβ
textβ
string
Multiline text to transform into blockquote content.
eol?β
string = "\n"
Line separator used to split and join lines.
Returnsβ
string
Text where every line starts with > .