INNER CODE UNIT · Python

parse_frontmatter

wgpsec/AboutSecurity · scripts/generate-index.py:24

def parse_frontmatter(content: str) -> dict:
    """解析 SKILL.md 的 YAML frontmatter"""
    if not content.startswith("---"):
        return {}

    end = content.find("---", 3)
    if end == -1:
        return {}

    frontmatter = content[3:end].strip()
    result = {}

    # 简易 YAML 解析(不依赖外部库)
    current_key = None
    current_value = ""
    in_metadata = False

    for line in frontmatter.split("\n"):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…