fix: invalid code span detection in reference extractor

Signed-off-by: squidfunk <martin.donath@squidfunk.com>
This commit is contained in:
squidfunk
2026-08-14 18:36:52 +02:00
parent cfdf18f19b
commit 6774d6159c
2 changed files with 34 additions and 0 deletions
+21
View File
@@ -1819,6 +1819,27 @@ class TestInlineCode:
assert text(md, links[0].text) == b"text"
assert text(md, links[0].href) == b"href"
@pytest.mark.parametrize(
"md",
[
pytest.param(
b"a`\n\n`[b]`",
id="blank-line",
),
pytest.param(
b"a`\n \n`[b]`",
id="whitespace-only-line",
),
pytest.param(
b"a`\r\n\r\n`[b]`",
id="blank-line-crlf",
),
],
)
def test_inline_code_does_not_cross_blank_line(self, md: bytes) -> None:
refs = collect(md)
assert len(refs) == 0
# --- negative cases ---
@pytest.mark.parametrize(