From c6cffec95fd7384cca90f8f474911edad606f91f Mon Sep 17 00:00:00 2001 From: squidfunk Date: Sun, 3 May 2026 19:01:03 +0200 Subject: [PATCH] fix: link validation exclusions don't catch `\r\n` line feeds Signed-off-by: squidfunk --- python/zensical/collectors/exclusions.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/python/zensical/collectors/exclusions.py b/python/zensical/collectors/exclusions.py index c99240e..3fa8ae6 100644 --- a/python/zensical/collectors/exclusions.py +++ b/python/zensical/collectors/exclusions.py @@ -44,12 +44,12 @@ _RE = re.compile( | # Fenced code blocks (?P - ^(?P[^\S\n]*) # Capture leading indentation + ^(?P[ \t]*) # Capture leading indentation (?P`{3,}|~{3,}) # Capture fence character and length - [^\n]*\n # Optional info string + [^\r\n]*\r?\n # Optional info string .*? # Block content ^[ \t]*(?P=fence)[`~]* # Closing fence: same type, at least as long - [^\n]*(\n|$) # Optional trailing content + [^\r\n]*(\r?\n|$) # Optional trailing content ) | # HTML comments (block and inline) @@ -62,9 +62,9 @@ _RE = re.compile( # HTML blocks (?P ^<(?P\w+) # Opening block-level tag - (?P[^\S\n][^>]*)? # Optional attributes (captured) - >[ \t]*\n # Close of tag, end of line - .*? # Block content + (?P[ \t][^>]*)? # Optional attributes (captured) + >[ \t]*\r?\n # Close of tag, end of line + (?:(?!^<(?P=tag)[\s>]).)*? # Block content, stop before same tag ^[ \t]*$ # Closing tag ) | @@ -75,9 +75,9 @@ _RE = re.compile( # $$ # (?P - ^[^\S\n]*\$\$[^\S\n]*\n # Opening $$ on its own line + ^[ \t]*\$\$[ \t]*\r?\n # Opening $$ on its own line .*? # Math content - ^[^\S\n]*\$\$[^\S\n]*$ # Closing $$ on its own line + ^[ \t]*\$\$[ \t]*$ # Closing $$ on its own line ) | # Block math (alternate): @@ -87,9 +87,9 @@ _RE = re.compile( # \] # (?P - ^[^\S\n]*\\\[[^\S\n]*\n # Opening \[ on its own line + ^[ \t]*\\\[[ \t]*\r?\n # Opening \[ on its own line .*? # Math content - ^[^\S\n]*\\\][^\S\n]*$ # Closing \] on its own line + ^[ \t]*\\\][ \t]*$ # Closing \] on its own line ) | # Inline math: