package renderer
import "github.com/yuin/goldmark/renderer"
Package renderer renders the given AST to certain formats.
Index ¶
- type Config
- type NodeRenderer
- type NodeRendererFunc
- type NodeRendererFuncRegisterer
- type Option
- func WithNodeRenderers(ps ...util.PrioritizedValue) Option
- func WithOption(name OptionName, value interface{}) Option
- type OptionName
- type Renderer
- type SetOptioner
Types ¶
type Config ¶
type Config struct { Options map[OptionName]interface{} NodeRenderers util.PrioritizedSlice }
A Config struct is a data structure that holds configuration of the Renderer.
func NewConfig ¶
func NewConfig() *Config
NewConfig returns a new Config.
type NodeRenderer ¶
type NodeRenderer interface { // RendererFuncs registers NodeRendererFuncs to given NodeRendererFuncRegisterer. RegisterFuncs(NodeRendererFuncRegisterer) }
A NodeRenderer interface offers NodeRendererFuncs.
type NodeRendererFunc ¶
type NodeRendererFunc func(writer util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error)
NodeRendererFunc is a function that renders a given node.
type NodeRendererFuncRegisterer ¶
type NodeRendererFuncRegisterer interface { // Register registers given NodeRendererFunc to this object. Register(ast.NodeKind, NodeRendererFunc) }
A NodeRendererFuncRegisterer registers given NodeRendererFunc to this object.
type Option ¶
type Option interface { SetConfig(*Config) }
An Option interface is a functional option type for the Renderer.
func WithNodeRenderers ¶
func WithNodeRenderers(ps ...util.PrioritizedValue) Option
WithNodeRenderers is a functional option that allow you to add NodeRenderers to the renderer.
func WithOption ¶
func WithOption(name OptionName, value interface{}) Option
WithOption is a functional option that allow you to set an arbitrary option to the parser.
type OptionName ¶
type OptionName string
An OptionName is a name of the option.
type Renderer ¶
type Renderer interface { Render(w io.Writer, source []byte, n ast.Node) error // AddOptions adds given option to this renderer. AddOptions(...Option) }
A Renderer interface renders given AST node to given writer with given Renderer.
func NewRenderer ¶
NewRenderer returns a new Renderer with given options.
type SetOptioner ¶
type SetOptioner interface { // SetOption sets given option to the object. // Unacceptable options may be passed. // Thus implementations must ignore unacceptable options. SetOption(name OptionName, value interface{}) }
A SetOptioner interface sets given option to the object.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
renderer/html | Package html implements renderer that outputs HTMLs. |
- Version
- v1.7.8 (latest)
- Published
- Oct 16, 2024
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 1 month ago –
Tools for package owners.