Documentation ¶
Index ¶
- Constants
- Variables
- func HandleCommands(spinner Spinner, context *renderer.Context) func(s string)
- 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) OSC(b []byte) 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
- func (f *AnsiScreenWriter) Write(data []byte) (int, error)
- type Buffer
- type BulletSequenceStyle
- type CI
- type Color
- type Config
- type ExecutionResult
- type FlushingWriter
- type Handler
- type IntegerSequenceStyle
- type Option
- type Renderer
- type RundownHandler
- type ScreenWriter
- type Spinner
- type StdoutBuffer
- func (f *StdoutBuffer) AnythingToFlush() bool
- func (f *StdoutBuffer) CHA(pos int) error
- func (f *StdoutBuffer) CNL(count int) error
- func (f *StdoutBuffer) CPL(count int) error
- func (f *StdoutBuffer) CUB(count int) error
- func (f *StdoutBuffer) CUD(count int) error
- func (f *StdoutBuffer) CUF(count int) error
- func (f *StdoutBuffer) CUP(x int, y int) error
- func (f *StdoutBuffer) CUU(count int) error
- func (f *StdoutBuffer) DA(values []string) error
- func (f *StdoutBuffer) DCH(count int) error
- func (f *StdoutBuffer) DECCOLM(enable bool) error
- func (f *StdoutBuffer) DECOM(enable bool) error
- func (f *StdoutBuffer) DECSTBM(x, y int) error
- func (f *StdoutBuffer) DECTCEM(enable bool) error
- func (f *StdoutBuffer) DL(count int) error
- func (f *StdoutBuffer) ED(count int) error
- func (f *StdoutBuffer) EL(count int) error
- func (f *StdoutBuffer) Execute(b byte) error
- func (f *StdoutBuffer) Flush() error
- func (f *StdoutBuffer) HVP(x int, y int) error
- func (f *StdoutBuffer) ICH(count int) error
- func (f *StdoutBuffer) IL(count int) error
- func (f *StdoutBuffer) IND() error
- func (f *StdoutBuffer) OSC([]byte) error
- func (f *StdoutBuffer) Print(b byte) error
- func (f *StdoutBuffer) Process(inStream io.Reader)
- func (f *StdoutBuffer) RI() error
- func (f *StdoutBuffer) SD(count int) error
- func (f *StdoutBuffer) SGR(values []int) error
- func (f *StdoutBuffer) SU(count int) error
- func (f *StdoutBuffer) String() string
- func (f *StdoutBuffer) SubscribeToFlush() chan bool
- func (f *StdoutBuffer) VPA(pos int) error
- func (f *StdoutBuffer) Write(data []byte) (int, error)
- 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 NewSpinnerFunc func(w io.Writer) Spinner = nil
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 HandleCommands ¶
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 { CommandHandler func(string) // contains filtered or unexported fields }
Writes terminal output to the screen, while allowing for per-line alterations.
func NewAnsiScreenWriter ¶
func NewAnsiScreenWriter(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) OSC ¶
func (f *AnsiScreenWriter) OSC(b []byte) error
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 CI ¶
type CI string
var GitHubCI CI = "github"
var GitLabCI CI = "gitlab"
var NoCI CI = "none"
var UnknownCI CI = "unknown"
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 FlushingWriter ¶
type FlushingWriter struct {
// contains filtered or unexported fields
}
func NewFlushingWriter ¶
func NewFlushingWriter(w io.Writer) *FlushingWriter
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 ScreenWriter ¶
type ScreenWriter struct {
// contains filtered or unexported fields
}
func NewScreenWriter ¶
func NewScreenWriter(writer io.Writer, buffer Buffer) *ScreenWriter
func (*ScreenWriter) Done ¶
func (s *ScreenWriter) Done()
func (*ScreenWriter) Run ¶
func (s *ScreenWriter) Run()
func (*ScreenWriter) SetAfterFunc ¶
func (s *ScreenWriter) SetAfterFunc(handler Handler)
func (*ScreenWriter) SetBeforeFunc ¶
func (s *ScreenWriter) SetBeforeFunc(handler Handler)
type StdoutBuffer ¶
type StdoutBuffer struct { LastFlushLines int // contains filtered or unexported fields }
Buffers an output stream. Consecutive flushes should reposition cursor to the original cursor point.
func NewStdoutBuffer ¶
func NewStdoutBuffer() *StdoutBuffer
func (*StdoutBuffer) AnythingToFlush ¶
func (f *StdoutBuffer) AnythingToFlush() bool
func (*StdoutBuffer) CHA ¶
func (f *StdoutBuffer) CHA(pos int) error
Cursor Horizontal position Absolute
func (*StdoutBuffer) DECSTBM ¶
func (f *StdoutBuffer) DECSTBM(x, y int) error
Set Top and Bottom Margins
func (*StdoutBuffer) DECTCEM ¶
func (f *StdoutBuffer) DECTCEM(enable bool) error
Text Cursor Enable Mode
func (*StdoutBuffer) Flush ¶
func (f *StdoutBuffer) Flush() error
Flush updates from previous commands
func (*StdoutBuffer) HVP ¶
func (f *StdoutBuffer) HVP(x int, y int) error
Horizontal and Vertical Position (depends on PUM)
func (*StdoutBuffer) OSC ¶
func (f *StdoutBuffer) OSC([]byte) error
func (*StdoutBuffer) Process ¶
func (f *StdoutBuffer) Process(inStream io.Reader)
func (*StdoutBuffer) String ¶
func (f *StdoutBuffer) String() string
func (*StdoutBuffer) SubscribeToFlush ¶
func (f *StdoutBuffer) SubscribeToFlush() chan bool
func (*StdoutBuffer) VPA ¶
func (f *StdoutBuffer) VPA(pos int) error
Vertical line Position Absolute
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.