14 lines
283 B
JavaScript
14 lines
283 B
JavaScript
export function firstNonBlankLine(markdown) {
|
|
if (typeof markdown !== 'string') return;
|
|
|
|
const lines = markdown.split(/\r?\n/);
|
|
|
|
for (const line of lines) {
|
|
const trimmed = line.trim();
|
|
if (trimmed) {
|
|
return trimmed.replace(/^#+\s*/, '');
|
|
}
|
|
}
|
|
|
|
return;
|
|
} |