Fix merge conflicts from previous PRs
85b1f547
2 file(s) · +5 −4
| 391 | 391 | .replace(/`([^`]+)`/g, "$1") // Remove inline code formatting |
|
| 392 | 392 | .replace(/\n{3,}/g, "\n\n") // Normalize multiple newlines |
|
| 393 | 393 | .replace(/(~{1,2})([^~]+?)\1/g, "$2") // Remove strikethrough for ~text~ and ~~text~~ |
|
| 394 | - | .replace(/<!--(.+)-->/g, "") // Remove any html comments |
|
| 395 | - | .replace(/^\s*\[\^[^\]]+\]:[^\r\n]*(?:\r?\n[ \t]+[^\r\n]*)*/gm, "") // Remove any footnotes |
|
| 394 | + | .replace(/<!--[\s\S]*?-->/g, "") // Remove any html comments |
|
| 395 | + | .replace(/^\s*\[\^[^\]]+\]:[^\r\n]*(?:\r?\n[ \t]+[^\r\n]*)*/gm, "") // Remove footnote definitions |
|
| 396 | + | .replace(/\[\^\S+\]/g, "") // Remove footnote references (we do after definitions so that those can be matched first) |
|
| 396 | 397 | .trim() |
|
| 397 | 398 | ); |
|
| 398 | 399 | } |
| 482 | 482 | ); |
|
| 483 | 483 | }); |
|
| 484 | 484 | ||
| 485 | - | it("removes footnote definitions but not inline references", () => { |
|
| 485 | + | it("removes footnote definitions and inline references", () => { |
|
| 486 | 486 | const input = |
|
| 487 | 487 | "Text with[^1] a reference.\n\n[^1]: The footnote definition."; |
|
| 488 | - | expect(stripMarkdownForText(input)).toBe("Text with[^1] a reference."); |
|
| 488 | + | expect(stripMarkdownForText(input)).toBe("Text with a reference."); |
|
| 489 | 489 | }); |
|
| 490 | 490 | ||
| 491 | 491 | it("trims leading and trailing whitespace", () => { |