Documentation
¶
Index ¶
- Variables
- func Indent(s, prefix string) string
- func IndentBytes(b, prefix []byte) []byte
- func NewIndentWriter(w io.Writer, pre ...[]byte) io.Writer
- func Space(length int) []byte
- func Wrap(s string, lim int) string
- func WrapBytes(b []byte, lim int) []byte
- func WrapWords(words [][]byte, spc, lim, pen int) [][][]byte
- type Flags
- type Renderer
- type RendererOptions
Constants ¶
This section is empty.
Variables ¶
var ( Aside = []byte("A> ") Quote = []byte("> ") )
Functions ¶
func Indent ¶
Indent inserts prefix at the beginning of each non-empty line of s. The end-of-line marker is NL.
func IndentBytes ¶
IndentBytes inserts prefix at the beginning of each non-empty line of b. The end-of-line marker is NL.
func NewIndentWriter ¶
NewIndentWriter makes a new write filter that indents the input lines. Each line is prefixed in order with the corresponding element of pre. If there are more lines than elements, the last element of pre is repeated for each subsequent line.
func WrapBytes ¶
WrapBytes wraps b into a paragraph of lines of length lim, with minimal raggedness.
func WrapWords ¶
WrapWords is the low-level line-breaking algorithm, useful if you need more control over the details of the text wrapping process. For most uses, either Wrap or WrapBytes will be sufficient and more convenient.
WrapWords splits a list of words into lines with minimal "raggedness", treating each byte as one unit, accounting for spc units between adjacent words on each line, and attempting to limit lines to lim units. Raggedness is the total error over all lines, where error is the square of the difference of the length of the line and lim. Too-long lines (which only happen when a single word is longer than lim units) have pen penalty units added to the error.
Types ¶
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer implements Renderer interface for Markdown output.
func NewRenderer ¶
func NewRenderer(opts RendererOptions) *Renderer
NewRenderer creates and configures an Renderer object, which satisfies the Renderer interface.
func (*Renderer) RenderNode ¶
RenderNode renders a markdown node to markdown.
type RendererOptions ¶
type RendererOptions struct { Flags Flags // Flags allow customizing this renderer's behavior TextWidth int // if set, called at the start of RenderNode(). Allows replacing rendering of some nodes RenderNodeHook html.RenderNodeFunc }
RendererOptions is a collection of supplementary parameters tweaking the behavior of various parts of Markdown renderer.