fix: handle empty markdown

This commit is contained in:
Max Richter
2025-10-22 18:15:38 +02:00
parent c8860a503d
commit c4052e2339
3 changed files with 6 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ import MarkdownIt from "markdown-it";
const parser = new MarkdownIt();
export function readDuration(markdown: string): number | undefined {
if (!markdown) return;
const words = markdown.split(" ")?.filter(Boolean)?.length;
return words && Math.round(words / 250);
}