(m: re.Match)
| 152 | """把 markdown 代码(围栏 + 行内)替换成等长空白,保留字符偏移与行号; |
| 153 | 用于扫描标签 / 链接时跳过代码内字面提及。""" |
| 154 | def _blank(m: re.Match) -> str: |
| 155 | # 保留换行(围栏代码块多行),其余字符替换为空格——保证 len 不变 |
| 156 | return "".join("\n" if ch == "\n" else " " for ch in m.group(0)) |
| 157 | text = FENCED_CODE_RE.sub(_blank, text) |
| 158 | text = INLINE_CODE_RE.sub(_blank, text) |
| 159 | return text |
nothing calls this directly
no outgoing calls
no test coverage detected