aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/hooks.py
blob: 34c963e4698c503cbf9119009d27fe978565aef6 (plain) (blame)
1
2
3
4
5
6
7
8
9
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]}")