类 MarkdownSkillParser
java.lang.Object
io.agentscope.core.skill.util.MarkdownSkillParser
Utility for parsing and generating Markdown files with YAML frontmatter.
This utility can:
- Extract YAML frontmatter metadata and markdown content from text
- Generate markdown files with YAML frontmatter from metadata and content
Frontmatter format:
---
name: example_skill
description: Example skill description
version: 1.0.0
---
# Skill Content
This is the markdown content.
Usage example:
// Parse markdown with frontmatter
ParsedMarkdown parsed = MarkdownSkillParser.parse(markdownContent);
Map<String, Object> metadata = parsed.getMetadata();
String content = parsed.getContent();
// Generate markdown with frontmatter
String markdown = MarkdownSkillParser.generate(metadata, content);
-
嵌套类概要
嵌套类修饰符和类型类说明static classResult of parsing markdown with frontmatter. -
方法概要
-
方法详细资料
-
parse
Parse markdown content with YAML frontmatter.Extracts both the YAML metadata and the markdown content. If no frontmatter is found, returns empty metadata with the entire content.
- 参数:
markdown- Markdown content (may or may not have frontmatter)- 返回:
- ParsedMarkdown containing metadata and content
-
generate
Generate markdown content with YAML frontmatter.Creates a markdown file with the metadata serialized as YAML frontmatter at the beginning, followed by the content.
- 参数:
metadata- Metadata to serialize as YAML frontmatter (can be null or empty)content- Markdown content (can be null or empty)- 返回:
- Complete markdown with frontmatter
-