Remove alternative Markdown renderer build options (Glamour performance issues addressed in custom fork; other options need more work)

This commit is contained in:
2025-06-19 14:55:29 -04:00
parent d2b2dcf7cf
commit 52628dba0a
12 changed files with 22 additions and 82 deletions
+8 -2
View File
@@ -3,7 +3,9 @@ package cli
import (
"fmt"
"os"
"strings"
"github.com/charmbracelet/glamour"
"github.com/rwinkhart/go-boilerplate/back"
"github.com/rwinkhart/go-boilerplate/other"
"github.com/rwinkhart/libmutton/crypt"
@@ -58,8 +60,12 @@ fieldLoop:
noteLines = append(noteLines, decryptedEntry[field])
}
// print notes to stdout
renderNote(noteLines)
// render notes as Markdown
r, _ := glamour.NewTermRenderer(glamour.WithStylesFromJSONBytes(glamourStyle()), glamour.WithPreservedNewLines(), glamour.WithWordWrap(width))
markdownNotesString, _ := r.Render(strings.Join(noteLines, "\n"))
// print the rendered Markdown notes
fmt.Print(markdownNotesString)
// break after notes have been printed
break fieldLoop
-14
View File
@@ -1,14 +0,0 @@
//go:build !noMarkdown && BEAN
package cli
import (
"fmt"
bean "github.com/Trojan2021/BEAN/render"
)
// renderNote renders the notes section of an entry (in Markdown) to stdout.
func renderNote(noteLines []string) {
fmt.Println(bean.RenderMarkdown(noteLines, width))
}
-13
View File
@@ -1,13 +0,0 @@
//go:build noMarkdown
package cli
import (
"fmt"
"strings"
)
// renderNote prints the notes section of an entry to stdout (when Markdown rendering is disabled).
func renderNote(noteLines []string) {
fmt.Print("\n" + strings.Join(noteLines, "\n") + "\n\n")
}
-20
View File
@@ -1,20 +0,0 @@
//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)
}