Documentation ¶
Index ¶
- Constants
- Variables
- func NewRenderer(context *rundown_renderer.Context, opts ...Option) renderer.NodeRenderer
- func RenderAttributes(w util.BufWriter, node ast.Node, filter util.BytesFilter)
- func WithConsoleWidth(width int) interface{ ... }
- func WithLevel(level int) interface{ ... }
- func WithLevelChange(changer func(level int)) interface{ ... }
- func WithRundownHandler(handler RundownHandler) interface{ ... }
- type AnsiScreenWriter
- func (f *AnsiScreenWriter) AfterFlush(cb func())
- func (f *AnsiScreenWriter) BeforeFlush(cb func())
- func (f *AnsiScreenWriter) CHA(pos int) error
- func (f *AnsiScreenWriter) CNL(count int) error
- func (f *AnsiScreenWriter) CPL(count int) error
- func (f *AnsiScreenWriter) CUB(count int) error
- func (f *AnsiScreenWriter) CUD(count int) error
- func (f *AnsiScreenWriter) CUF(count int) error
- func (f *AnsiScreenWriter) CUP(x int, y int) error
- func (f *AnsiScreenWriter) CUU(count int) error
- func (f *AnsiScreenWriter) DA(values []string) error
- func (f *AnsiScreenWriter) DCH(count int) error
- func (f *AnsiScreenWriter) DECCOLM(enable bool) error
- func (f *AnsiScreenWriter) DECOM(enable bool) error
- func (f *AnsiScreenWriter) DECSTBM(x, y int) error
- func (f *AnsiScreenWriter) DECTCEM(enable bool) error
- func (f *AnsiScreenWriter) DL(count int) error
- func (f *AnsiScreenWriter) ED(count int) error
- func (f *AnsiScreenWriter) EL(count int) error
- func (f *AnsiScreenWriter) Execute(b byte) error
- func (f *AnsiScreenWriter) Flush() error
- func (f *AnsiScreenWriter) HVP(x int, y int) error
- func (f *AnsiScreenWriter) ICH(count int) error
- func (f *AnsiScreenWriter) IL(count int) error
- func (f *AnsiScreenWriter) IND() error
- func (f *AnsiScreenWriter) PrefixEachLine(prefix string)
- func (f *AnsiScreenWriter) Print(b byte) error
- func (f *AnsiScreenWriter) Process()
- func (f *AnsiScreenWriter) RI() error
- func (f *AnsiScreenWriter) SD(count int) error
- func (f *AnsiScreenWriter) SGR(values []int) error
- func (f *AnsiScreenWriter) SU(count int) error
- func (f *AnsiScreenWriter) VPA(pos int) error
- type BulletSequenceStyle
- type Color
- type Config
- type ExecutionResult
- type IntegerSequenceStyle
- type Option
- type Renderer
- type RundownHandler
- type Spinner
- type Style
- type StyleStack
- type Writer
Constants ¶
const ( Continue ExecutionResult = "Continue" Skip = "Skip" Stop = "Stop" )
Variables ¶
var Aurora aurora.Aurora
var BlockquoteAttributeFilter = GlobalAttributeFilter.Extend( []byte("cite"), )
BlockquoteAttributeFilter defines attribute names which blockquote elements can have
var CodeAttributeFilter = GlobalAttributeFilter
CodeAttributeFilter defines attribute names which code elements can have.
var ColorsEnabled bool
var ConsoleRenderer = &consoleRendererExt{}
Strikethrough is an extension that allow you to use invisibleBlock expression like '~~text~~' .
var DefaultWriter = &defaultWriter{}
DefaultWriter is a default implementation of the Writer.
var EmphasisAttributeFilter = GlobalAttributeFilter
EmphasisAttributeFilter defines attribute names which emphasis elements can have.
var GlobalAttributeFilter = util.NewBytesFilter( []byte("accesskey"), []byte("autocapitalize"), []byte("class"), []byte("contenteditable"), []byte("contextmenu"), []byte("dir"), []byte("draggable"), []byte("dropzone"), []byte("hidden"), []byte("id"), []byte("itemprop"), []byte("lang"), []byte("slot"), []byte("spellcheck"), []byte("style"), []byte("tabindex"), []byte("title"), []byte("translate"), )
GlobalAttributeFilter defines attribute names which any elements can have.
var HeadingAttributeFilter = GlobalAttributeFilter
HeadingAttributeFilter defines attribute names which heading elements can have
var ImageAttributeFilter = GlobalAttributeFilter.Extend( []byte("align"), []byte("border"), []byte("crossorigin"), []byte("decoding"), []byte("height"), []byte("importance"), []byte("intrinsicsize"), []byte("ismap"), []byte("loading"), []byte("referrerpolicy"), []byte("sizes"), []byte("srcset"), []byte("usemap"), []byte("width"), )
ImageAttributeFilter defines attribute names which image elements can have.
var LinkAttributeFilter = GlobalAttributeFilter.Extend( []byte("download"), []byte("hreflang"), []byte("media"), []byte("ping"), []byte("referrerpolicy"), []byte("rel"), []byte("shape"), []byte("target"), )
LinkAttributeFilter defines attribute names which link elements can have.
var ListAttributeFilter = GlobalAttributeFilter.Extend( []byte("start"), []byte("reversed"), )
ListAttributeFilter defines attribute names which list elements can have.
var ListItemAttributeFilter = GlobalAttributeFilter.Extend( []byte("value"), )
ListItemAttributeFilter defines attribute names which list item elements can have.
var ParagraphAttributeFilter = GlobalAttributeFilter
ParagraphAttributeFilter defines attribute names which paragraph elements can have.
var ThematicAttributeFilter = GlobalAttributeFilter.Extend( []byte("align"), []byte("color"), []byte("noshade"), []byte("size"), []byte("width"), )
ThematicAttributeFilter defines attribute names which hr elements can have.
Functions ¶
func NewRenderer ¶
func NewRenderer(context *rundown_renderer.Context, opts ...Option) renderer.NodeRenderer
NewRenderer returns a new Renderer with given options.
func RenderAttributes ¶
RenderAttributes renders given node's attributes. You can specify attribute names to render by the filter. If filter is nil, RenderAttributes renders all attributes.
func WithConsoleWidth ¶
The mutator is responsible for changing the inside of a RundownInline block before it's written to the output, but after it's been rendered.
func WithLevel ¶
The mutator is responsible for changing the inside of a RundownInline block before it's written to the output, but after it's been rendered.
func WithLevelChange ¶
The mutator is responsible for changing the inside of a RundownInline block before it's written to the output, but after it's been rendered.
func WithRundownHandler ¶
func WithRundownHandler(handler RundownHandler) interface { renderer.Option Option }
The mutator is responsible for changing the inside of a RundownInline block before it's written to the output, but after it's been rendered.
Types ¶
type AnsiScreenWriter ¶
type AnsiScreenWriter struct {
// contains filtered or unexported fields
}
Writes terminal output to the screen, while allowing for per-line alterations.
func NewAnsiScreenWriter ¶
func NewAnsiScreenWriter(reader io.Reader, writer io.Writer) *AnsiScreenWriter
func (*AnsiScreenWriter) AfterFlush ¶
func (f *AnsiScreenWriter) AfterFlush(cb func())
func (*AnsiScreenWriter) BeforeFlush ¶
func (f *AnsiScreenWriter) BeforeFlush(cb func())
func (*AnsiScreenWriter) CHA ¶
func (f *AnsiScreenWriter) CHA(pos int) error
Cursor Horizontal position Absolute
func (*AnsiScreenWriter) CPL ¶
func (f *AnsiScreenWriter) CPL(count int) error
Cursor to Previous Line
func (*AnsiScreenWriter) DA ¶
func (f *AnsiScreenWriter) DA(values []string) error
Device Attributes
func (*AnsiScreenWriter) DECCOLM ¶
func (f *AnsiScreenWriter) DECCOLM(enable bool) error
132 Column Mode
func (*AnsiScreenWriter) DECSTBM ¶
func (f *AnsiScreenWriter) DECSTBM(x, y int) error
Set Top and Bottom Margins
func (*AnsiScreenWriter) DECTCEM ¶
func (f *AnsiScreenWriter) DECTCEM(enable bool) error
Text Cursor Enable Mode
func (*AnsiScreenWriter) Execute ¶
func (f *AnsiScreenWriter) Execute(b byte) error
Execute C0 commands
func (*AnsiScreenWriter) Flush ¶
func (f *AnsiScreenWriter) Flush() error
Flush updates from previous commands
func (*AnsiScreenWriter) HVP ¶
func (f *AnsiScreenWriter) HVP(x int, y int) error
Horizontal and Vertical Position (depends on PUM)
func (*AnsiScreenWriter) PrefixEachLine ¶
func (f *AnsiScreenWriter) PrefixEachLine(prefix string)
func (*AnsiScreenWriter) Process ¶
func (f *AnsiScreenWriter) Process()
func (*AnsiScreenWriter) SGR ¶
func (f *AnsiScreenWriter) SGR(values []int) error
Set Graphics Rendition
func (*AnsiScreenWriter) VPA ¶
func (f *AnsiScreenWriter) VPA(pos int) error
Vertical line Position Absolute
type BulletSequenceStyle ¶
type BulletSequenceStyle struct {
// contains filtered or unexported fields
}
func NewBulletSequence ¶
func NewBulletSequence(marker string, level string) BulletSequenceStyle
func (BulletSequenceStyle) Begin ¶
func (s BulletSequenceStyle) Begin() string
func (BulletSequenceStyle) End ¶
func (s BulletSequenceStyle) End() string
func (BulletSequenceStyle) Wrap ¶
func (s BulletSequenceStyle) Wrap(str string) string
type Config ¶
type Config struct { TempDir string RundownHandler RundownHandler Level int ConsoleWidth int LevelChange func(level int) }
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 ExecutionResult ¶
type ExecutionResult string
type IntegerSequenceStyle ¶
type IntegerSequenceStyle struct {
// contains filtered or unexported fields
}
func NewIntegerSequence ¶
func NewIntegerSequence(start int, level string) *IntegerSequenceStyle
func (*IntegerSequenceStyle) Begin ¶
func (s *IntegerSequenceStyle) Begin() string
func (*IntegerSequenceStyle) End ¶
func (s *IntegerSequenceStyle) End() string
func (*IntegerSequenceStyle) Wrap ¶
func (s *IntegerSequenceStyle) Wrap(str string) string
type Option ¶
type Option interface {
SetConsoleOption(*Config)
}
An Option interface sets options for HTML based renderers.
type Renderer ¶
type Renderer struct { Config Context *rundown_renderer.Context // contains filtered or unexported fields }
A Renderer struct is an implementation of renderer.NodeRenderer that renders nodes as Console strings
func (*Renderer) CurrentLevel ¶
func (*Renderer) RegisterFuncs ¶
func (r *Renderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
RegisterFuncs implements NodeRenderer.RegisterFuncs .
type RundownHandler ¶
type RundownHandler interface { Mutate([]byte, ast.Node) ([]byte, error) OnRundownNode(node ast.Node, entering bool) (ast.WalkStatus, error) OnExecute(node *rundown_ast.ExecutionBlock, source []byte, out util.BufWriter) (ExecutionResult, error) }
type StyleStack ¶
type StyleStack struct {
Styles []Style
}
func NewStyleStack ¶
func NewStyleStack() *StyleStack
func (*StyleStack) Peek ¶
func (s *StyleStack) Peek() Style
func (*StyleStack) Pop ¶
func (s *StyleStack) Pop() Style
func (*StyleStack) Push ¶
func (s *StyleStack) Push(style Style) Style
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 writes the given source to writer without resolving references and // unescaping backslash escaped characters. RawWrite(writer util.BufWriter, source []byte) }
A Writer interface writes textual contents to a writer.