@@ -41,6 +41,12 @@ describe("markdownToWhatsApp", () => {
|
41 | 41 | ["returns empty string for empty input", "", ""], |
42 | 42 | ["returns plain text unchanged", "no formatting here", "no formatting here"], |
43 | 43 | ["handles bold inside a sentence", "This is **very** important", "This is *very* important"], |
| 44 | +// Regression: a digit immediately after an inline-code span must not be |
| 45 | +// absorbed into the placeholder index (which previously dropped both). |
| 46 | +["preserves inline code immediately followed by a digit", "`a`5", "`a`5"], |
| 47 | +["preserves inline code followed by a number", "`status`200 done", "`status`200 done"], |
| 48 | +["preserves two adjacent code+digit spans", "`x`1 and `y`2", "`x`1 and `y`2"], |
| 49 | +["preserves inline code with a space before a digit", "`a` 5", "`a` 5"], |
44 | 50 | ] as const)("handles markdown-to-whatsapp conversion: %s", (_name, input, expected) => { |
45 | 51 | expect(markdownToWhatsApp(input)).toBe(expected); |
46 | 52 | }); |
@@ -50,6 +56,11 @@ describe("markdownToWhatsApp", () => {
|
50 | 56 | expect(markdownToWhatsApp(input)).toBe(input); |
51 | 57 | }); |
52 | 58 | |
| 59 | +it("preserves a fenced code block immediately followed by a digit", () => { |
| 60 | +const input = "```code```7 done"; |
| 61 | +expect(markdownToWhatsApp(input)).toBe(input); |
| 62 | +}); |
| 63 | + |
53 | 64 | it("preserves code block with formatting inside", () => { |
54 | 65 | const input = "Before ```**bold** and ~~strike~~``` after **real bold**"; |
55 | 66 | expect(markdownToWhatsApp(input)).toBe( |
|