Introduce the office Bubble Tea browser (module tree, multi-select lists, markdown preview) alongside oo, with cmd/internal/bootstrap for shared auth, unit tests across preview/model/ui/fetch, CI build for both binaries, and GoReleaser archives for office. Co-authored-by: Cursor <cursoragent@cursor.com>
24 lines
424 B
Go
24 lines
424 B
Go
package preview
|
|
|
|
import (
|
|
"github.com/charmbracelet/glamour"
|
|
)
|
|
|
|
// RenderMarkdown renders GitHub-flavoured markdown for terminal display.
|
|
func RenderMarkdown(md string, width int) (string, error) {
|
|
if md == "" {
|
|
return "", nil
|
|
}
|
|
if width < 20 {
|
|
width = 20
|
|
}
|
|
r, err := glamour.NewTermRenderer(
|
|
glamour.WithAutoStyle(),
|
|
glamour.WithWordWrap(width),
|
|
)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return r.Render(md)
|
|
}
|