(frontmatterYAML string)
| 157 | } |
| 158 | |
| 159 | func 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 | |
| 172 | func extractMarkdownAfterFrontmatter(content string, markdownStart int) string { |
| 173 | if markdownStart <= len(content) { |
no test coverage detected