fix content styling

This commit is contained in:
2026-01-04 01:46:50 +00:00
parent b9d44c3bda
commit ae12407f45
2 changed files with 5 additions and 2 deletions
+2
View File
@@ -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)
+3 -2
View File
@@ -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
}