mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-24 00:54:17 +02:00
parent
fe066f2140
commit
d89d79a00c
3 changed files with 28 additions and 17 deletions
13
ui/config.go
13
ui/config.go
|
|
@ -2,12 +2,13 @@ package ui
|
|||
|
||||
// Config contains TUI-specific configuration.
|
||||
type Config struct {
|
||||
ShowAllFiles bool
|
||||
Gopath string `env:"GOPATH"`
|
||||
HomeDir string `env:"HOME"`
|
||||
GlamourMaxWidth uint
|
||||
GlamourStyle string
|
||||
EnableMouse bool
|
||||
ShowAllFiles bool
|
||||
Gopath string `env:"GOPATH"`
|
||||
HomeDir string `env:"HOME"`
|
||||
GlamourMaxWidth uint
|
||||
GlamourStyle string
|
||||
EnableMouse bool
|
||||
PreserveNewLines bool
|
||||
|
||||
// Which directory should we start from?
|
||||
WorkingDirectory string
|
||||
|
|
|
|||
|
|
@ -399,10 +399,15 @@ func glamourRender(m pagerModel, markdown string) (string, error) {
|
|||
width = 0
|
||||
}
|
||||
|
||||
r, err := glamour.NewTermRenderer(
|
||||
options := []glamour.TermRendererOption{
|
||||
utils.GlamourStyle(m.common.cfg.GlamourStyle, isCode),
|
||||
glamour.WithWordWrap(width),
|
||||
)
|
||||
}
|
||||
|
||||
if m.common.cfg.PreserveNewLines {
|
||||
options = append(options, glamour.WithPreservedNewLines())
|
||||
}
|
||||
r, err := glamour.NewTermRenderer(options...)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue