From da317bf2013e595d497e2157b742235f1ff6ddde Mon Sep 17 00:00:00 2001 From: squidfunk Date: Thu, 30 Apr 2026 17:20:41 +0200 Subject: [PATCH] fix: add `$...$` and `$$...$$` blocks to exclusions for link validation (#599) Signed-off-by: squidfunk --- python/zensical/collectors/exclusions.py | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/python/zensical/collectors/exclusions.py b/python/zensical/collectors/exclusions.py index bf8cc7a..bcfb45f 100644 --- a/python/zensical/collectors/exclusions.py +++ b/python/zensical/collectors/exclusions.py @@ -68,6 +68,50 @@ _RE = re.compile( ^[ \t]*$ # Closing tag ) | + # Block math: + # + # $$ + # ... + # $$ + # + (?P + ^[^\S\n]*\$\$[^\S\n]*\n # Opening $$ on its own line + .*? # Math content + ^[^\S\n]*\$\$[^\S\n]*$ # Closing $$ on its own line + ) + | + # Block math (alternate): + # + # \[ + # ... + # \] + # + (?P + ^[^\S\n]*\\\[[^\S\n]*\n # Opening \[ on its own line + .*? # Math content + ^[^\S\n]*\\\][^\S\n]*$ # Closing \] on its own line + ) + | + # Inline math: + # + # $f(x)$ + # + (?P + (? + \\\( # Opening \( + (?-s:.*?) # Math content (same line only) + \\\) # Closing \) + ) + | # Inline code blocks (?P (?P`+) # Opening backticks