Documentation
¶
Overview ¶
Package html2 converts from HTML to arbitrary formats.
Index ¶
Constants ¶
const ( // ErrWalkStop indicates no more walking needed. ErrWalkStop err = iota + 1 // ErrWalkSkipChildren indicates that the children of this node should not // be walked. ErrWalkSkipChildren )
const DefaultLineWidth = 80
DefaultLineWidth is the maximum line width by default. It affects linebreaks in blockquotes, and the maximum table width. Use LineWidth() to override.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LettersLower ¶
type LettersLower struct{}
LettersLower is an OLIterator that returns e.g. a., b., c....
func (*LettersLower) New ¶
func (*LettersLower) New() OLSeries
New returns satisfies the OLIterator interface.
type LettersUpper ¶
type LettersUpper struct{}
LettersUpper is an OLIterator that returns e.g. A., B., C....
func (*LettersUpper) New ¶
func (*LettersUpper) New() OLSeries
New returns satisfies the OLIterator interface.
type Numbers ¶
type Numbers struct {
// contains filtered or unexported fields
}
Numbers is an OLIterator that returns e.g. 1., 2., 3....
type OLIterator ¶
type OLIterator interface { // New returns a new instance of the OLSeries. New() OLSeries }
OLIterator returns numbered list counters.
type OLSeries ¶
type OLSeries interface { // Next returns the next iterator label, including any trailing punctuation // such as a period (e.g. "1.", "2."...) Next() string }
OLSeries iterantes over sequential ordered list identifiers.
type Option ¶ added in v0.0.4
type Option interface {
// contains filtered or unexported methods
}
Option represents an option to tweak the behavior of a Renderer.
type RenderFunc ¶
RenderFunc allows handling a simple function as a Renderer.
type Renderer ¶
type Renderer interface { // Render should render n by writing to w. It is not responsible for walking // child nodes, which means that it is perfectly valid for this function to // do nothing for certain node types. // // Render is called twice for each node, first with entering true, before // processing any children, then a second time with entering false, after // processing all children. // // As special cases, if ErrWalkStop or ErrWalkSkipChildren values are // returned,then walking is stopped (without error), or children of the // current node are skipped, respectively. // // Returning WalkSkipChildren when entering=false will cause a panic. Render(w Writer, n *html.Node, entering bool) error }
Renderer is the interface for a generic HTML renderer.
func RenderPlainText ¶
RenderPlainText returns a renderer that returns plain text output.
type RomanLower ¶
type RomanLower struct{}
RomanLower is an OLIterator that returns e.g. i., ii., iii....
func (*RomanLower) New ¶
func (*RomanLower) New() OLSeries
New returns satisfies the OLIterator interface.
type RomanUpper ¶
type RomanUpper struct{}
RomanUpper is an OLIterator that returns e.g. I., II., III....
func (*RomanUpper) New ¶
func (*RomanUpper) New() OLSeries
New returns satisfies the OLIterator interface.
type Writer ¶
type Writer interface { io.Writer io.ByteWriter io.StringWriter LastByte() (byte, bool) }
Writer wraps a standard io.Writer, to add a few extensions useful within a Renderer.