parseManifest reads a markdown manifest and extracts name/description from YAML frontmatter when present, falling back to the provided default name and the first non-empty heading/paragraph for the description.
(path, fallbackName string)
| 200 | // YAML frontmatter when present, falling back to the provided default name and |
| 201 | // the first non-empty heading/paragraph for the description. |
| 202 | func parseManifest(path, fallbackName string) (name, description string) { |
| 203 | name = fallbackName |
| 204 | data, err := os.ReadFile(path) |
| 205 | if err != nil { |
| 206 | return name, "" |
| 207 | } |
| 208 | fmName, fmDesc, ok := parseFrontmatter(string(data)) |
| 209 | if ok { |
| 210 | if fmName != "" { |
| 211 | name = fmName |
| 212 | } |
| 213 | description = fmDesc |
| 214 | } |
| 215 | return name, description |
| 216 | } |
| 217 | |
| 218 | // parseFrontmatter extracts name and description from a leading YAML |
| 219 | // frontmatter block delimited by "---" lines. It is intentionally minimal: |
no test coverage detected