1
Fork 0

Exclude certain files from output

This commit is contained in:
Jake Howard 2023-09-17 17:41:09 +01:00
parent 0305754b83
commit a6900908b0
Signed by: jake
GPG Key ID: 57AFB45680EDD477
2 changed files with 19 additions and 0 deletions

18
hooks/exclude-static.py Normal file
View File

@ -0,0 +1,18 @@
import fnmatch
from mkdocs.plugins import event_priority, get_plugin_logger
EXCLUDED_FILES = {
"*.mmd"
}
logger = get_plugin_logger("exclude-static")
@event_priority(100)
def on_files(files, config):
for file in files:
if any(fnmatch.fnmatch(file.url, pattern) for pattern in EXCLUDED_FILES):
logger.debug("Excluding %s", file.url)
files.remove(file)
return files

View File

@ -20,6 +20,7 @@ hooks:
- hooks/kroki.py
- hooks/include-file.py
- hooks/unsplash.py
- hooks/exclude-static.py
markdown_extensions:
- attr_list