mirror of
https://github.com/zensical/zensical.git
synced 2026-05-03 01:20:33 +00:00
fix: add $...$ and $$...$$ blocks to exclusions for link validation (#599)
Signed-off-by: squidfunk <martin.donath@squidfunk.com>
This commit is contained in:
@@ -68,6 +68,50 @@ _RE = re.compile(
|
||||
^</(?P=tag)>[ \t]*$ # Closing tag
|
||||
)
|
||||
|
|
||||
# Block math:
|
||||
#
|
||||
# $$
|
||||
# ...
|
||||
# $$
|
||||
#
|
||||
(?P<math_block>
|
||||
^[^\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<math_block_alt>
|
||||
^[^\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<math_inline>
|
||||
(?<!\$)\$(?![\s$]) # Opening $, not preceded/followed by $
|
||||
(?-s:.*?) # Math content (same line only)
|
||||
(?<![\s$])\$(?!\$) # Closing $, not preceded by space or $
|
||||
)
|
||||
|
|
||||
# Inline math (alternate):
|
||||
#
|
||||
# \(f(x)\)
|
||||
#
|
||||
(?P<math_inline_alt>
|
||||
\\\( # Opening \(
|
||||
(?-s:.*?) # Math content (same line only)
|
||||
\\\) # Closing \)
|
||||
)
|
||||
|
|
||||
# Inline code blocks
|
||||
(?P<inline>
|
||||
(?P<ticks>`+) # Opening backticks
|
||||
|
||||
Reference in New Issue
Block a user