MCPcopy
hub / github.com/wshobson/agents / _split_frontmatter

Function _split_frontmatter

plugins/plugin-eval/src/plugin_eval/parser.py:184–198  ·  view source on GitHub ↗

Split YAML frontmatter from markdown body.

(content: str)

Source from the content-addressed store, hash-verified

182
183
184def _split_frontmatter(content: str) -> tuple[dict, str]:
185 """Split YAML frontmatter from markdown body."""
186 if not content.startswith("---"):
187 return {}, content
188
189 parts = content.split("---", 2)
190 if len(parts) < 3:
191 return {}, content
192
193 try:
194 frontmatter = yaml.safe_load(parts[1]) or {}
195 except yaml.YAMLError:
196 frontmatter = {}
197
198 return frontmatter, parts[2]

Callers 2

parse_skillFunction · 0.85
parse_agentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected