Documentation
¶
Overview ¶
Package adapter provides convenient adapters for other popular packages making it simple to use those as nb extensions.
- Markdown: goldmark and blackfriday
- ANSI to HTML conversion: ansihtml
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnsiHtml ¶
func AnsiHtml(convert func([]byte) []byte) render.RenderCellFunc
AnsiHtml wraps ansihtml-style function in RenderCellFunc.
Usage:
extension.NewStream( adapter.AnsiHtml(ansihtml.ConvertToHTML) )
To force ansihtml to use classes instead of inline styles, pass an anonymous function intead:
extension.NewStream( adapter.AnsiHtml(func([]byte) []byte) { ansihtml.ConvertToHTMLWithClasses(b, "class-", false) }) )
func Blackfriday ¶
func Blackfriday(convert func([]byte) []byte) render.RenderCellFunc
Blackfriday wraps blackfriday-style function in RenderCellFunc.
Usage:
extension.NewMarkdown( adapter.Blackfriday(blackfriday.MarkdownCommon) )
func Goldmark ¶
Goldmark wraps goldmark-style function in RenderCellFunc.
Usage:
extension.NewMarkdown( adapter.Goldmark(func(b []byte, w io.Writer) error { return goldmark.Convert(b, w, parseOptions...) }) )
Notice, how Goldmark is a bit more verbose compared to Blackfriday: this is because goldmark.Convert accepts variadic parser.ParseOptions, which is a dependency the client should capture in the closure and pass manually.
Types ¶
This section is empty.