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
)
| 205 | |
| 206 | |
| 207 | def 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 | |
| 236 | def reformat_table(lines: List[str], right_margin: int) -> List[str]: |
| 237 | """ |
no outgoing calls
no test coverage detected
searching dependent graphs…