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

Function _clean_markdown

scripts/fetch_imdrf_fulltext.py:138–144  ·  view source on GitHub ↗

Post-process the converted markdown, preserving base64 content images.

(text: str)

Source from the content-addressed store, hash-verified

136
137
138def _clean_markdown(text: str) -> str:
139 """Post-process the converted markdown, preserving base64 content images."""
140 text = re.sub(r'!\[([^\]]*?)\n+([^\]]*?)\]', _fix_multiline_alt, text)
141 text = re.sub(r'\n{4,}', '\n\n\n', text)
142 text = re.sub(r'^\s*\n', '\n', text, flags=re.MULTILINE)
143 text = re.sub(r'\n{3,}', '\n\n', text)
144 return text.strip() + '\n'
145
146
147def _fix_multiline_alt(match):

Callers 1

docx_to_markdownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected