github.com/charmbracelet/glamour@v0.7.0/examples/custom_renderer/main.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/charmbracelet/glamour"
     7  )
     8  
     9  func main() {
    10  	in := `# Custom Renderer
    11  
    12  Word-wrapping will occur when lines exceed the limit of 40 characters.
    13  `
    14  
    15  	r, _ := glamour.NewTermRenderer(
    16  		glamour.WithStandardStyle("dark"),
    17  		glamour.WithWordWrap(40),
    18  	)
    19  
    20  	out, _ := r.Render(in)
    21  	fmt.Print(out)
    22  }