From ae12407f4576ce60f558a1e228448785e854e06a Mon Sep 17 00:00:00 2001 From: ruinivist Date: Sun, 4 Jan 2026 01:46:50 +0000 Subject: [PATCH] fix content styling --- main.go | 2 ++ notes.go | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 481ddf2..1a9d374 100644 --- a/main.go +++ b/main.go @@ -88,6 +88,8 @@ func (m *model) Init() tea.Cmd { func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg := msg.(type) { + // DEV TIP: ALWAYS RETURN IN EACH BRANCH + // FALLTHROUGHS ARE BAD case tea.WindowSizeMsg: m.layout(msg.Width, msg.Height) diff --git a/notes.go b/notes.go index cfcbaa7..ecdd9fe 100644 --- a/notes.go +++ b/notes.go @@ -43,6 +43,7 @@ type loadedNote struct { func NewNoteView() *NoteView { mdRenderer, _ := glamour.NewTermRenderer( glamour.WithAutoStyle(), + glamour.WithWordWrap(80), ) return &NoteView{ loading: true, @@ -108,7 +109,7 @@ func fetchContent(path string) tea.Cmd { // title if len(lines) > 0 && strings.HasPrefix(lines[0], "# ") { - title = strings.TrimPrefix(lines[0], "# ") + title = lines[0] content = strings.Join(lines[1:], "\n") } @@ -138,5 +139,5 @@ func (m NoteView) renderNote() string { return m.title + "\n\n" + m.content } - return title + "\n\n" + content + return title + content }