diff --git a/python/tests/unit/collectors/test_references.py b/python/tests/unit/collectors/test_references.py index dc66d97..9b38013 100644 --- a/python/tests/unit/collectors/test_references.py +++ b/python/tests/unit/collectors/test_references.py @@ -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: diff --git a/python/zensical/collectors/references/cursor.py b/python/zensical/collectors/references/cursor.py index 2240c33..6473405 100644 --- a/python/zensical/collectors/references/cursor.py +++ b/python/zensical/collectors/references/cursor.py @@ -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