aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2024-08-15 17:23:34 +0800
committerGitHub <noreply@github.com>2024-08-15 17:23:34 +0800
commit12b7bcb40ae38f676c81c5559562e52b6b64c66f (patch)
treea6e312bb98ef0f23c7612b67e1c2235c21c437e9 /scripts
downloadfaq-12b7bcb40ae38f676c81c5559562e52b6b64c66f.tar.gz
faq-12b7bcb40ae38f676c81c5559562e52b6b64c66f.zip
Initial commit
Diffstat (limited to 'scripts')
-rw-r--r--scripts/hooks.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/hooks.py b/scripts/hooks.py
new file mode 100644
index 0000000..34c963e
--- /dev/null
+++ b/scripts/hooks.py
@@ -0,0 +1,10 @@
+import logging, re
+import mkdocs.plugins
+
+log = logging.getLogger('mkdocs')
+
+@mkdocs.plugins.event_priority(-50)
+def on_page_markdown(markdown, page, **kwargs):
+ path = page.file.src_uri
+ for m in re.finditer(r'\bhttp://[^) ]+', markdown):
+ log.warning(f"Documentation file '{path}' contains a non-HTTPS link: {m[0]}") \ No newline at end of file