mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-30 04:18:09 +00:00
11 lines
266 B
TypeScript
11 lines
266 B
TypeScript
export function extractTitleFromMarkdown(markdown: string) {
|
|
if (markdown.startsWith("# ")) {
|
|
let title = markdown.split("\n")[0]!.trim();
|
|
if (title.startsWith("# ")) {
|
|
title = title.slice(2).trim();
|
|
}
|
|
return title;
|
|
}
|
|
return undefined;
|
|
}
|