From 967b9dc3e07084c48b93ed28183e01f6d072b8d5 Mon Sep 17 00:00:00 2001 From: CyC2018 Date: Sun, 1 Nov 2026 20:08:24 +0800 Subject: [PATCH] Update check.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 检查链接时按行首的围栏识别代码块,与构建脚本一致。 --- website/builder/check.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/builder/check.py b/website/builder/check.py index b1cfc45d..a272a679 100644 --- a/website/builder/check.py +++ b/website/builder/check.py @@ -4,6 +4,8 @@ import hashlib import json import re from pathlib import Path + +from site_assets import VERBATIM from urllib.parse import unquote, urlsplit BASE = Path(__file__).resolve().parents[1] @@ -23,7 +25,7 @@ def check(source, output): errors.append('文件清单校验失败:' + name) references = 0 for document in output.rglob('*.md'): - content = re.sub(r'```[^\n]*\n[\s\S]*?```|', '', document.read_text()) + content = VERBATIM.sub('', document.read_text()) for match in re.finditer(r'''\]\((/[^\s)]+)\)|(?:src|href)=["'](/[^"']+)''', content): url = match[1] or match[2] if url.startswith(('/#', '//')):