MCPcopy Index your code
hub / github.com/unclecode/crawl4ai / escape_md_section

Function escape_md_section

crawl4ai/html2text/utils.py:207–234  ·  view source on GitHub ↗

Escapes markdown-sensitive characters across whole document sections. Each escaping operation can be controlled individually.

(
    text: str,
    escape_backslash: bool = True,
    snob: bool = False,
    escape_dot: bool = True,
    escape_plus: bool = True,
    escape_dash: bool = True
)

Source from the content-addressed store, hash-verified

205
206
207def escape_md_section(
208 text: str,
209 escape_backslash: bool = True,
210 snob: bool = False,
211 escape_dot: bool = True,
212 escape_plus: bool = True,
213 escape_dash: bool = True
214) -> str:
215 """
216 Escapes markdown-sensitive characters across whole document sections.
217 Each escaping operation can be controlled individually.
218 """
219 if escape_backslash:
220 text = config.RE_MD_BACKSLASH_MATCHER.sub(r"\\\1", text)
221
222 if snob:
223 text = config.RE_MD_CHARS_MATCHER_ALL.sub(r"\\\1", text)
224
225 if escape_dot:
226 text = config.RE_MD_DOT_MATCHER.sub(r"\1\\\2", text)
227
228 if escape_plus:
229 text = config.RE_MD_PLUS_MATCHER.sub(r"\1\\\2", text)
230
231 if escape_dash:
232 text = config.RE_MD_DASH_MATCHER.sub(r"\1\\\2", text)
233
234 return text
235
236def reformat_table(lines: List[str], right_margin: int) -> List[str]:
237 """

Callers 1

handle_dataMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…