MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / extract_body

Function extract_body

openkb/skill/__init__.py:70–85  ·  view source on GitHub ↗

Return the body of a SKILL.md — everything after the closing ``---``. Uses the same line-anchored logic as :func:`extract_frontmatter` so a body that contains a standalone ``---`` (e.g. a Markdown horizontal rule) is preserved intact. Files without frontmatter return their full text

(text: str)

Source from the content-addressed store, hash-verified

68
69
70def extract_body(text: str) -> str:
71 """Return the body of a SKILL.md — everything after the closing ``---``.
72
73 Uses the same line-anchored logic as :func:`extract_frontmatter` so a
74 body that contains a standalone ``---`` (e.g. a Markdown horizontal
75 rule) is preserved intact. Files without frontmatter return their
76 full text unchanged.
77 """
78 lines = text.splitlines()
79 if not lines or lines[0].strip() != "---":
80 return text
81 try:
82 end = lines.index("---", 1)
83 except ValueError:
84 return text
85 return "\n".join(lines[end + 1 :])
86
87
88def extract_description(skill_md: Path) -> str:

Callers 1

_read_bodyFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected