Markdown parsing utilities — extract code blocks, local links, and tool mentions from SKILL.md content.

CodeBlock

Fields

NameTypeDescription
langString
codeString
start_lineusize

Trait Implementations

  • Debug
  • Clone
  • PartialEq
  • Eq

extract_code_blocks

pub fn extract_code_blocks(body: &str) -> Vec<CodeBlock>

pub fn extract_local_links(body: &str) -> Vec<String>

extract_tool_mentions

pub fn extract_tool_mentions(body: &str) -> BTreeSet<String>

Extract tool names genuinely referenced in the body.

Only inline code spans (`Bash`) count as references — bare prose is ignored, because several tool names (Read, Write, Edit, Agent) are also common English words and would otherwise flood skills with false positives. Fenced code blocks are examples/commands, not declarations, so they are excluded too (Event::Code fires only for inline spans).