MCPcopy Create free account
hub / github.com/cli/cli / renderMarkdownPreview

Function renderMarkdownPreview

pkg/cmd/skills/preview/preview.go:392–409  ·  view source on GitHub ↗
(io *iostreams.IOStreams, filePath, content string)

Source from the content-addressed store, hash-verified

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

Callers 2

NewCmdPreviewFunction · 0.85
renderFileMethod · 0.85

Calls 7

ParseFunction · 0.92
RenderFunction · 0.92
WithThemeFunction · 0.92
WithWrapFunction · 0.92
WithoutIndentationFunction · 0.92
TerminalThemeMethod · 0.80
TerminalWidthMethod · 0.80

Tested by

no test coverage detected