renderer

package
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2020 License: MIT Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const SideNoteFmt = `` /* 148-byte string literal not displayed */

Variables

View Source
var (
	DefaultRemoveCellTags   = map[string]bool{"remove_cell": true, "private": true, "setup": true, "notes": true, "hidden": true}
	DefaultRemoveInputTags  = map[string]bool{"remove_input": true, "output-generator": true}
	DefaultRemoveOutputTags = map[string]bool{"remove_output": true, "assertion": true}
)
View Source
var MarkdownHeaderRegexp = regexp.MustCompile(`^(#+)\s+(.+)`)

Functions

func GenerateBoundary

func GenerateBoundary() string

func Render added in v0.0.7

func Render(w io.Writer, nb *notebook.Notebook, opts ...RenderOpt) error

func ToSideNote

func ToSideNote(id, content []byte) []byte

Types

type FootnoteRenderer

type FootnoteRenderer struct {
	// contains filtered or unexported fields
}

func (*FootnoteRenderer) Patch

func (fnr *FootnoteRenderer) Patch(src []byte) ([]byte, error)

func (*FootnoteRenderer) Render

func (fnr *FootnoteRenderer) Render(w io.Writer, rawNode ast.Node, entering bool) (ast.WalkStatus, bool)

type RenderOpt

type RenderOpt func(*Renderer)

func ImgSrcPrefix

func ImgSrcPrefix(prefix string) RenderOpt

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

func New

func New(w io.Writer, metadata *notebook.MetaData, opts ...RenderOpt) *Renderer

func NewInMemory

func NewInMemory(metadata *notebook.MetaData, opts ...RenderOpt) (*Renderer, *bytes.Buffer)

func (*Renderer) Elide

func (r *Renderer) Elide(tags []string) (cell bool, source bool, output bool)

func (*Renderer) GetDefaultLang

func (r *Renderer) GetDefaultLang() string

func (*Renderer) GetResource

func (r *Renderer) GetResource(contentHash string) *notebook.Resource

func (*Renderer) GetResources

func (r *Renderer) GetResources() map[string]*notebook.Resource

func (*Renderer) RenderNB

func (r *Renderer) RenderNB(nb *notebook.Notebook) error

func (*Renderer) SetMetadata

func (r *Renderer) SetMetadata(metadata notebook.MetaData)

func (*Renderer) WriteB64Image

func (r *Renderer) WriteB64Image(fig *notebook.Base64Figure) (string, error)

func (*Renderer) WriteHTMLEscapedLines

func (r *Renderer) WriteHTMLEscapedLines(lines []string) error

func (*Renderer) WriteHTMLUnsafely

func (r *Renderer) WriteHTMLUnsafely(lines []string) error

func (*Renderer) WriteMarkdownCodeFenced

func (r *Renderer) WriteMarkdownCodeFenced(lang string, lines []string) error

func (*Renderer) WriteMarkdownLines

func (r *Renderer) WriteMarkdownLines(lines []string) error

func (*Renderer) WriteOutputs

func (r *Renderer) WriteOutputs(outputs []notebook.Output) error

func (*Renderer) WritePlainText

func (r *Renderer) WritePlainText(class string, lines []string, clean bool) error

type TaskListRenderer

type TaskListRenderer struct {
	// contains filtered or unexported fields
}

func (*TaskListRenderer) IsEngaged

func (tlr *TaskListRenderer) IsEngaged() bool

func (*TaskListRenderer) Render

func (tlr *TaskListRenderer) Render(w io.Writer, rawNode ast.Node, entering bool) (ast.WalkStatus, bool)

See: https://github.blog/2014-04-28-task-lists-in-all-markdown-documents/

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL