diff --git a/packages/cli/src/lib/markdown.ts b/packages/cli/src/lib/markdown.ts index 1cfaed5..401c315 100644 --- a/packages/cli/src/lib/markdown.ts +++ b/packages/cli/src/lib/markdown.ts @@ -390,6 +390,7 @@ export function stripMarkdownForText(markdown: string): string { .replace(/\n{3,}/g, "\n\n") // Normalize multiple newlines .replace(/(~{1,2})([^~]+?)\1/g, "$2") // Remove strikethrough for ~text~ and ~~text~~ .replace(//g, "") // Remove any html comments - .replace(/^\s*\[\^[^\]]+\]:[^\r\n]*(?:\r?\n[ \t]+[^\r\n]*)*/gm, "") // Remove any footnotes + .replace(/^\s*\[\^[^\]]+\]:[^\r\n]*(?:\r?\n[ \t]+[^\r\n]*)*/gm, "") // Remove footnote definitions + .replace(/\[\^\S+\]/g, "") // Remove footnote references (we do after definitions so that those can be matched first) .trim(); }