Load fulltext markdown for an entry, if available. Checks both {name}.md and {name}.zh.md (NMPA Chinese sources often use the .zh.md extension for original content).
(fw_dir: Path, doc_type: str, entry: dict)
| 474 | return m.group(0) |
| 475 | |
| 476 | text = re.sub(r"<([^>\n]+)>", _protect_html, text) |
| 477 | |
| 478 | # 5) Escape every remaining raw '<' — covers incomplete/multiline |
| 479 | # placeholders (<Insert Month and\nYear>) and comparisons (<CIN2). |
| 480 | text = text.replace("<", "<") |
| 481 | |
| 482 | # 5b) Escape curly braces so VitePress markdown-it-attrs does not treat |
| 483 | # PDF math like ``Fs = S*A = {S*L*π*D*T}`` as element attributes |
| 484 | # (that yields "Unexpected character" / sourcemap build failures). |
| 485 | text = text.replace("{", "{").replace("}", "}") |
| 486 | |
| 487 | # 6) Restore protected segments |
| 488 | for i, seg in enumerate(protected): |
| 489 | text = text.replace(f"\0PROT{i}\0", seg) |
| 490 | |
| 491 | return text |
| 492 | |
| 493 | |
| 494 | def _load_fulltext(fw_dir: Path, doc_type: str, entry: dict) -> str: |
| 495 | """Load fulltext markdown for an entry, if available. |
| 496 |
no test coverage detected