cli/pkg/markdown/markdown.go
crystalstall 5562c1489f chore: fix some function names
Signed-off-by: crystalstall <crystalruby@qq.com>
2024-09-02 15:18:42 +08:00

32 lines
831 B
Go

package markdown
import (
"github.com/charmbracelet/glamour"
ghMarkdown "github.com/cli/go-gh/v2/pkg/markdown"
)
func WithoutIndentation() glamour.TermRendererOption {
return ghMarkdown.WithoutIndentation()
}
// WithWrap is a rendering option that set the character limit for soft
// wrapping the markdown rendering. There is a max limit of 120 characters.
// If 0 is passed then wrapping is disabled.
func WithWrap(w int) glamour.TermRendererOption {
if w > 120 {
w = 120
}
return ghMarkdown.WithWrap(w)
}
func WithTheme(theme string) glamour.TermRendererOption {
return ghMarkdown.WithTheme(theme)
}
func WithBaseURL(u string) glamour.TermRendererOption {
return ghMarkdown.WithBaseURL(u)
}
func Render(text string, opts ...glamour.TermRendererOption) (string, error) {
return ghMarkdown.Render(text, opts...)
}