fix: date sitemap entries from their pages

The sitemap gave every page the build date. A page now states its own date
and a mkdocs hook passes it on, or leaves lastmod out. The values added to
the site's code spans today are also escaped: a backtick in a profile or
file name could close the span and inject markup.
This commit is contained in:
Abdessamad Derraz committed 2026-10-18 10:08:18 +02:00
1 parent f5e3404a8d
commit bd75defb61
7 files changed
+88 -7

No files matched your search

+10
View File
@@ -20,6 +20,16 @@ _icon_available: dict[str, bool] = {}
_CODE_SPAN = re.compile(r"(`+).+?\1", re.S)
def _code(value: object) -> str:
"""A value as an inline code span it cannot leave.
Markdown shows HTML inside a code span as text, so the one way out is a
backtick in the value closing the span early. Data from a profile, a
platform file or a file name is not ours to trust that far.
"""
return "`" + str(value).replace("`", "'") + "`"
def _escape_tags(text: str) -> str:
"""Show a placeholder such as ``<system_dir>`` as it was written.