fix: handle empty markdown
All checks were successful
Deploy to SFTP Server / build (push) Successful in 10m50s

This commit is contained in:
Max Richter
2025-10-22 18:15:38 +02:00
parent 3b583eade5
commit c542408f6a
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);
}