MCPcopy Index your code
hub / github.com/github/spec-kit / _split_frontmatter

Method _split_frontmatter

src/specify_cli/integrations/base.py:1107–1127  ·  view source on GitHub ↗

Split YAML frontmatter from the remaining body content.

(content: str)

Source from the content-addressed store, hash-verified

1105
1106 @staticmethod
1107 def _split_frontmatter(content: str) -> tuple[str, str]:
1108 """Split YAML frontmatter from the remaining body content."""
1109 if not content.startswith("---"):
1110 return "", content
1111
1112 lines = content.splitlines(keepends=True)
1113 if not lines or lines[0].rstrip("\r\n") != "---":
1114 return "", content
1115
1116 frontmatter_end = -1
1117 for i, line in enumerate(lines[1:], start=1):
1118 if line.rstrip("\r\n") == "---":
1119 frontmatter_end = i
1120 break
1121
1122 if frontmatter_end == -1:
1123 return "", content
1124
1125 frontmatter = "".join(lines[1:frontmatter_end])
1126 body = "".join(lines[frontmatter_end + 1 :])
1127 return frontmatter, body
1128
1129 @staticmethod
1130 def _human_title(identifier: str) -> str:

Callers 1

setupMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected