MCPcopy Create free account
hub / github.com/github/gh-aw / parseFrontmatterYAML

Function parseFrontmatterYAML

pkg/parser/frontmatter_content.go:159–170  ·  view source on GitHub ↗
(frontmatterYAML string)

Source from the content-addressed store, hash-verified

157}
158
159func parseFrontmatterYAML(frontmatterYAML string) (map[string]any, error) {
160 frontmatterYAML = strings.ReplaceAll(frontmatterYAML, "\u00A0", " ")
161 var frontmatter map[string]any
162 if err := yaml.Unmarshal([]byte(frontmatterYAML), &frontmatter); err != nil {
163 formattedErr := FormatYAMLError(err, 2, frontmatterYAML)
164 return nil, &FormattedParserError{formatted: "failed to parse frontmatter:\n" + formattedErr, cause: err}
165 }
166 if frontmatter == nil {
167 frontmatter = make(map[string]any)
168 }
169 return frontmatter, nil
170}
171
172func extractMarkdownAfterFrontmatter(content string, markdownStart int) string {
173 if markdownStart <= len(content) {

Callers 1

Calls 1

FormatYAMLErrorFunction · 0.85

Tested by

no test coverage detected