mirror of
https://github.com/zensical/zensical.git
synced 2026-08-23 15:46:44 +00:00
fix: link validation doesn't ignore fenced code blocks when \r is present
Signed-off-by: squidfunk <martin.donath@squidfunk.com>
This commit is contained in:
@@ -1470,6 +1470,14 @@ class TestFencedCodeBlocks:
|
||||
b"~~~~ py\n[text](href)\n~~~~",
|
||||
id="fenced-code-4-tildes-lang",
|
||||
),
|
||||
pytest.param(
|
||||
b"\n```\n[Start][]\n```\n",
|
||||
id="fenced-code-with-info",
|
||||
),
|
||||
pytest.param(
|
||||
b"```\r\n[Start]\r\n```\r\n",
|
||||
id="fenced-code-crlf-with-shortcut-link-ref",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_fenced_code(self, md: bytes) -> None:
|
||||
|
||||
@@ -971,7 +971,7 @@ def _scan_fenced_code(cursor: Cursor, char: int) -> int | None:
|
||||
# Skip to next line and terminate if we found a closing fence
|
||||
if end - start == opening:
|
||||
rest = _skip_whitespace(cursor, end)
|
||||
if rest >= cursor.end or cursor.data[rest] == _NL:
|
||||
if rest >= cursor.end or cursor.data[rest] in (_CR, _NL):
|
||||
return _skip_line(cursor, end)
|
||||
|
||||
# Skip to next line
|
||||
|
||||
Reference in New Issue
Block a user