Parse YAML frontmatter from markdown content. Args: content: Markdown file content Returns: Dictionary of frontmatter data, or None if not found
(content: str)
| 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: |
no outgoing calls
no test coverage detected