(io *iostreams.IOStreams, filePath, content string)
| 389 | } |
| 390 | |
| 391 | func renderMarkdownPreview(io *iostreams.IOStreams, filePath, content string) string { |
| 392 | if filePath == "SKILL.md" { |
| 393 | parsed, err := frontmatter.Parse(content) |
| 394 | if err == nil { |
| 395 | content = parsed.Body |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | rendered, err := markdown.Render(content, |
| 400 | markdown.WithTheme(io.TerminalTheme()), |
| 401 | markdown.WithWrap(io.TerminalWidth()), |
| 402 | markdown.WithoutIndentation()) |
| 403 | if err != nil { |
| 404 | return content |
| 405 | } |
| 406 | |
| 407 | return rendered |
| 408 | } |
| 409 | |
| 410 | func isMarkdownFile(filePath string) bool { |
| 411 | switch strings.ToLower(path.Ext(filePath)) { |
no test coverage detected