Documentation ¶
Index ¶
- Variables
- func IsDangerousURL(url []byte) bool
- func NewRenderer(opts ...Option) renderer.NodeRenderer
- func WithHardWraps() interface{ ... }
- func WithUnsafe() interface{ ... }
- func WithWriter(writer Writer) interface{ ... }
- func WithXHTML() interface{ ... }
- type Config
- type Option
- type Renderer
- type Writer
Constants ¶
This section is empty.
Variables ¶
var DefaultWriter = &defaultWriter{}
DefaultWriter is a default implementation of the Writer.
Functions ¶
func IsDangerousURL ¶
IsDangerousURL returns true if the given url seems a potentially dangerous url, otherwise false.
func NewRenderer ¶
func NewRenderer(opts ...Option) renderer.NodeRenderer
NewRenderer returns a new Renderer with given options.
func WithHardWraps ¶
WithHardWraps is a functional option that indicates whether softline breaks should be rendered as '<br>'.
func WithUnsafe ¶
WithUnsafe is a functional option that renders dangerous contents (raw htmls and potentially dangerous links) as it is.
func WithWriter ¶
WithWriter is a functional option that allow you to set the given writer to the renderer.
Types ¶
type Config ¶
A Config struct has configurations for the HTML based renderers.
func (*Config) SetOption ¶
func (c *Config) SetOption(name renderer.OptionName, value interface{})
SetOption implements renderer.NodeRenderer.SetOption.
type Option ¶
type Option interface {
SetHTMLOption(*Config)
}
An Option interface sets options for HTML based renderers.
type Renderer ¶
type Renderer struct {
Config
}
A Renderer struct is an implementation of renderer.NodeRenderer that renders nodes as (X)HTML.
func (*Renderer) RegisterFuncs ¶
func (r *Renderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
RegisterFuncs implements NodeRenderer.RegisterFuncs .
type Writer ¶
type Writer interface { // Write writes the given source to writer with resolving references and unescaping // backslash escaped characters. Write(writer util.BufWriter, source []byte) // RawWrite wirtes the given source to writer without resolving references and // unescaping backslash escaped characters. RawWrite(writer util.BufWriter, source []byte) }
A Writer interface wirtes textual contents to a writer.