mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 06:04:18 +00:00
Add GLOW_DISABLE_GLAMOUR in the env for testing
This commit is contained in:
parent
7a8a1f7aff
commit
d06f4914b9
1 changed files with 4 additions and 15 deletions
19
ui/ui.go
19
ui/ui.go
|
@ -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" {
|
||||
|
|
Loading…
Reference in a new issue