MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / _load_fulltext

Function _load_fulltext

scripts/json_to_markdown.py:476–493  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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("<", "&lt;")
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("{", "&#123;").replace("}", "&#125;")
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
494def _load_fulltext(fw_dir: Path, doc_type: str, entry: dict) -> str:
495 """Load fulltext markdown for an entry, if available.
496

Callers 2

generate_guidanceFunction · 0.85
generate_shared_sectionFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected