From 02565e36dc1b6efc7b3e3bf84ddf5825ec8b6ed2 Mon Sep 17 00:00:00 2001 From: Caleb Foust Date: Sun, 21 Jul 2024 11:57:25 +0800 Subject: [PATCH] fix: broken doc links lol --- docs/gendoc.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/gendoc.py b/docs/gendoc.py index a37bbecb..509fe959 100644 --- a/docs/gendoc.py +++ b/docs/gendoc.py @@ -522,7 +522,7 @@ def handler(match: re.Match) -> Tuple[ Optional[Replacement], Optional[Error], ]: - target = match.group(1) + target = match.group(2) if target.startswith("http"): return None, None @@ -556,9 +556,13 @@ def handler(match: re.Match) -> Tuple[ f"broken link: {target} -> {md_file}", ) - return None, None + return ( + match.start(0), + match.end(0), + match.group(1) + f"({SITE_URL}{target})", + ), None - return handle_pattern(re.compile(r"\[[^]]+\]\(([^)]+)\)"), handler) + return handle_pattern(re.compile(r"(\[[^]]+\])\(([^)]+)\)"), handler) if __name__ == '__main__':