Coverage for src / lilbee / wiki / grammar.py: 100%
11 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-04-29 19:16 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-04-29 19:16 +0000
1"""Source of truth for the wiki's markdown grammar.
3Every structural delimiter and pattern the wiki contract depends on lives
4here. Modules that author or parse wiki pages import from this module
5instead of re-declaring the patterns. If the grammar ever changes, this
6is the only file that needs to move.
7"""
9from __future__ import annotations
11import re
13CITATION_BLOCK_SEP = "---"
14CITATION_BLOCK_COMMENT = "<!-- citations (auto-generated from _citations table -- do not edit) -->"
15CODE_FENCE_PREFIX = "```"
17CITE_RE = re.compile(r"\[\^(src\d+)\]")
18FOOTNOTE_RE = re.compile(r"^\[\^(src\d+)\]:\s*(.+)$", re.MULTILINE)
19INFERENCE_RE = re.compile(r"\[\*inference\*\]")
20WIKI_LINK_RE = re.compile(r"\[\[([^\[\]]+)\]\]")
21CODE_FENCE_RE = re.compile(r"^(```|~~~)")
22H1_RE = re.compile(r"^#\s+(.+?)\s*#*\s*$")