Add optional build tag for experimental BEAN Markdown renderer support

This commit is contained in:
2024-10-29 17:08:57 -04:00
parent 750029a491
commit 77014cf5e3
8 changed files with 37 additions and 12 deletions
+20
View File
@@ -0,0 +1,20 @@
//go:build !noMarkdown && !BEAN
package cli
import (
"fmt"
"strings"
"github.com/charmbracelet/glamour"
)
// renderNote renders the notes section of an entry (in Markdown) to stdout.
func renderNote(noteLines []string) {
note := strings.Join(noteLines, "\n")
r, _ := glamour.NewTermRenderer(glamour.WithStylesFromJSONBytes(glamourStyle()), glamour.WithPreservedNewLines(), glamour.WithWordWrap(width))
markdownNotesString, _ := r.Render(note)
// print markdown-rendered notes
fmt.Print(markdownNotesString)
}