MCPcopy Create free account
hub / github.com/modelscope/ms-agent / parse_yaml_frontmatter

Method parse_yaml_frontmatter

ms_agent/skill/schema.py:206–225  ·  view source on GitHub ↗

Parse YAML frontmatter from markdown content. Args: content: Markdown file content Returns: Dictionary of frontmatter data, or None if not found

(content: str)

Source from the content-addressed store, hash-verified

204
205 @staticmethod
206 def parse_yaml_frontmatter(content: str) -> Optional[Dict[str, Any]]:
207 """
208 Parse YAML frontmatter from markdown content.
209
210 Args:
211 content: Markdown file content
212
213 Returns:
214 Dictionary of frontmatter data, or None if not found
215 """
216 pattern = r'^---\s*\n(.*?)\n---\s*\n'
217 match = re.match(pattern, content, re.DOTALL)
218
219 if match:
220 yaml_content = match.group(1)
221 try:
222 return yaml.safe_load(yaml_content)
223 except yaml.YAMLError:
224 return None
225 return None
226
227 @staticmethod
228 def is_ignored_path(p: Path) -> bool:

Callers 1

parse_skill_directoryMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected