zensical:fix - config change in Markdown extensions not detected

Signed-off-by: squidfunk <martin.donath@squidfunk.com>
This commit is contained in:
squidfunk
2025-11-18 20:05:59 +01:00
parent f3f85d797a
commit c048e8393e
4 changed files with 26 additions and 5 deletions
+18 -1
View File
@@ -23,8 +23,10 @@
from __future__ import annotations
import hashlib
import importlib
import os
import pickle
import yaml
try:
@@ -34,7 +36,6 @@ except ModuleNotFoundError:
from click import ClickException
from deepmerge import always_merger
from functools import partial
from typing import Any, IO
from yaml import BaseLoader, Loader, YAMLError
from yaml.constructor import ConstructorError
@@ -113,6 +114,13 @@ def parse_mkdocs_config(path: str) -> dict:
return _CONFIG
def get_config():
"""
Return configuration.
"""
return _CONFIG
def get_theme_dir() -> str:
"""
Return the theme directory.
@@ -444,6 +452,7 @@ def _apply_defaults(config: dict, path: str) -> dict:
# Ensure the table of contents title is initialized, as it's used inside
# the template, and the table of contents extension is always defined
config["mdx_configs"]["toc"].setdefault("title", None)
config["mdx_configs_hash"] = _hash(mdx_configs)
# Convert plugins configuration
config["plugins"] = _convert_plugins(config.get("plugins", []), config)
@@ -473,6 +482,14 @@ def set_default(
return entry[key]
def _hash(data: any) -> int:
"""
Compute a hash for the given data.
"""
hash = hashlib.sha1(pickle.dumps(data))
return int(hash.hexdigest(), 16) % (2**64)
def _convert_extra(data: dict | list) -> dict | list:
"""
Recursively convert all None values in a dictionary or list to empty strings.
+2 -2
View File
@@ -30,7 +30,7 @@ from datetime import date, datetime
from markdown import Markdown
from yaml import SafeLoader
from .config import _CONFIG
from .config import get_config
from .extensions.links import LinksExtension
from .extensions.search import SearchExtension
@@ -61,7 +61,7 @@ def render(content: str, path: str) -> dict:
in order to support the specific syntax of Python Markdown. We're working
on moving the entire rendering chain to Rust.
"""
config = _CONFIG
config = get_config()
# Initialize Markdown parser
md = Markdown(