Fix link URL formatting and fence blank-line collapse in Markdown converter
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
This commit is contained in:
@@ -54,4 +54,17 @@ describe("markdownToTelegramHtml", () => {
|
||||
it("collapses runs of blank lines and trims", () => {
|
||||
expect(markdownToTelegramHtml("\n\na\n\n\n\nb\n\n")).toBe("a\n\nb");
|
||||
});
|
||||
|
||||
it("protects URL from emphasis formatting (regression: __init__.py)", () => {
|
||||
expect(markdownToTelegramHtml("See [the init file](https://github.com/org/repo/blob/main/__init__.py) for details")).toBe(
|
||||
'See <a href="https://github.com/org/repo/blob/main/__init__.py">the init file</a> for details',
|
||||
);
|
||||
});
|
||||
|
||||
it("preserves blank lines inside fenced code blocks (regression: blank line collapse)", () => {
|
||||
const md = "```python\ndef foo():\n\n pass\n```";
|
||||
expect(markdownToTelegramHtml(md)).toBe(
|
||||
'<pre><code class="language-python">def foo():\n\n pass</code></pre>',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user