Add GLOW_DISABLE_GLAMOUR in the env for testing

This commit is contained in:
Christian Rocha 2020-05-15 19:47:34 -04:00 committed by Christian Muehlhaeuser
parent 7a8a1f7aff
commit d06f4914b9

View file

@ -200,27 +200,12 @@ func update(msg boba.Msg, mdl boba.Model) (boba.Model, boba.Cmd) {
case gotStashedItemMsg:
// We've received stashed item data. Render with Glamour and send to
// the pager.
//m.state = stateShowDocument
m.pager = pager.NewModel(
m.terminalWidth,
m.terminalHeight-statusBarHeight,
)
m.docNote = msg.Note
// This could happen asyncronously with a Cmd since there's techincally
// IO happening, but since rendering is fast and Go is an imperative
// language I guess it's fine to just render synchronously here.
/*
md, err := glamourRender(m, msg.Body)
if err != nil {
m.err = err
return m, nil
}
*/
//m.pager.SetContent(md)
return m, renderWithGlamour(m, msg.Body)
case contentRenderedMsg:
@ -360,6 +345,10 @@ func renderWithGlamour(m model, md string) boba.Cmd {
// This is where the magic happens
func glamourRender(m model, markdown string) (string, error) {
if os.Getenv("GLOW_DISABLE_GLAMOUR") != "" {
return markdown, nil
}
// initialize glamour
var gs glamour.TermRendererOption
if m.style == "auto" {