mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-28 04:46:41 -04:00
Remove alternative Markdown renderer build options (Glamour performance issues addressed in custom fork; other options need more work)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
@@ -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")
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user