Skip to content

Commit

Permalink
Implement markdown rendering with glamour
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepla committed Apr 16, 2022
1 parent 78f0629 commit 4ea14d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ui/pager.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/charmbracelet/bubbles/viewport"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/glamour"
"github.com/charmbracelet/lipgloss"
)

Expand Down Expand Up @@ -112,12 +113,13 @@ func Preview(url, title string) error {
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
r, err := glamour.RenderBytes(body, "dark")
if err != nil {
return err
}
p := tea.NewProgram(
model{
content: string(body),
content: string(r),
title: title,
},
tea.WithAltScreen(),
Expand Down

0 comments on commit 4ea14d2

Please sign in to comment.