返回 (frontmatter 块, 剩余正文)。无 frontmatter 时第一项为空串。
(text: str)
| 56 | |
| 57 | |
| 58 | def strip_frontmatter(text: str) -> tuple[str, str]: |
| 59 | """返回 (frontmatter 块, 剩余正文)。无 frontmatter 时第一项为空串。""" |
| 60 | m = FRONTMATTER_RE.match(text) |
| 61 | if m: |
| 62 | return m.group(0), text[m.end():] |
| 63 | return "", text |
| 64 | |
| 65 | |
| 66 | def _line_starts(text: str) -> list[int]: |
no outgoing calls