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

Method html_to_markdown

scripts/migrate_wordpress.py:159–169  ·  view source on GitHub ↗

Convert HTML content to clean Markdown.

(self, html: str)

Source from the content-addressed store, hash-verified

157 return "_shared", "shared"
158
159 def html_to_markdown(self, html: str) -> str:
160 """Convert HTML content to clean Markdown."""
161 if not html:
162 return ""
163 md = self.h2t.handle(html)
164 md = re.sub(r"\n{3,}", "\n\n", md)
165 md = re.sub(r"\[/?[a-z_]+[^\]]*\]", "", md)
166 md = md.replace("…", "...").replace("&", "&")
167 md = md.replace("–", "-").replace("—", "--")
168 md = md.replace("&", "&").replace(" ", " ")
169 return md.strip()
170
171 def clean_title(self, title_raw: str) -> str:
172 """Clean HTML entities from title."""

Callers 1

save_documentMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected