MCPcopy Create free account
hub / github.com/Qinbf/groundmap / strip_frontmatter

Function strip_frontmatter

scripts/section_parser.py:58–63  ·  view source on GitHub ↗

返回 (frontmatter 块, 剩余正文)。无 frontmatter 时第一项为空串。

(text: str)

Source from the content-addressed store, hash-verified

56
57
58def 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
66def _line_starts(text: str) -> list[int]:

Callers 6

add_anchorsFunction · 0.90
build_outline_dataFunction · 0.90
test_no_frontmatterMethod · 0.90
test_with_frontmatterMethod · 0.90
test_frontmatter_crlfMethod · 0.90

Calls

no outgoing calls

Tested by 3

test_no_frontmatterMethod · 0.72
test_with_frontmatterMethod · 0.72
test_frontmatter_crlfMethod · 0.72