Skip to content

firstParagraph

Import from @varavel/vdl-plugin-sdk/utils/markdown.

function firstParagraph(content): string | undefined;

Returns the first paragraph-like content line from a Markdown document.

This helper is useful for generating short descriptions, summaries, preview snippets, or metadata fields from longer Markdown content without parsing the full document structure.

Blank lines are ignored, heading lines are skipped, and the first remaining content line is returned in trimmed form. If the document does not contain paragraph content, the function returns undefined.

Parameters

Parameter Type Description
content string Markdown document content to inspect.

Returns

string | undefined

The first non-heading content line, or undefined when absent.

Example

firstParagraph("# Changelog\n\nAdds new RPC helpers.");
// "Adds new RPC helpers."