document

package
v0.2.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block interface {
	json.Marshaler
}

type Blocks

type Blocks []Block

func (Blocks) CodeBlocks

func (b Blocks) CodeBlocks() (result CodeBlocks)

type CodeBlock

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

func (*CodeBlock) Attributes

func (b *CodeBlock) Attributes() map[string]string

Attributes returns code block attributes detected in the first line. They are of a form: "sh { attr=value }".

func (*CodeBlock) Content

func (b *CodeBlock) Content() string

Content returns unaltered snippet as a single blob of text.

func (*CodeBlock) Executable

func (b *CodeBlock) Executable() string

Executable returns an identifier of a program to execute the block.

func (*CodeBlock) Intro

func (b *CodeBlock) Intro() string

Intro returns a normalized description of the code block based on the preceding paragraph.

func (*CodeBlock) Line

func (b *CodeBlock) Line(idx int) string

Line returns a normalized code block line at index.

func (*CodeBlock) LineCount

func (b *CodeBlock) LineCount() int

LineCount returns the number of code block lines.

func (*CodeBlock) Lines

func (b *CodeBlock) Lines() (result []string)

Lines returns all code block lines, normalized.

func (*CodeBlock) MarshalJSON

func (b *CodeBlock) MarshalJSON() ([]byte, error)

func (*CodeBlock) Name

func (b *CodeBlock) Name() string

Name returns a code block name.

func (*CodeBlock) SetContent

func (b *CodeBlock) SetContent(str string)

SetContent sets a new content of the block.

type CodeBlocks

type CodeBlocks []*CodeBlock

func (CodeBlocks) Lookup

func (b CodeBlocks) Lookup(name string) *CodeBlock

func (CodeBlocks) Names

func (b CodeBlocks) Names() (result []string)

type MarkdownBlock

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

func (*MarkdownBlock) Content

func (b *MarkdownBlock) Content() string

func (*MarkdownBlock) MarshalJSON

func (b *MarkdownBlock) MarshalJSON() ([]byte, error)

type ParsedSource

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

func (*ParsedSource) Blocks

func (s *ParsedSource) Blocks() Blocks

func (*ParsedSource) CodeBlocks

func (s *ParsedSource) CodeBlocks() CodeBlocks

func (*ParsedSource) Root

func (s *ParsedSource) Root() ast.Node

func (*ParsedSource) Source

func (s *ParsedSource) Source() []byte

func (*ParsedSource) SquashedBlocks

func (s *ParsedSource) SquashedBlocks() (blocks Blocks, err error)

type Source

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

func NewSource

func NewSource(data []byte) *Source

func NewSourceFromFile

func NewSourceFromFile(f fs.FS, filename string) (*Source, error)

func (*Source) Parse

func (s *Source) Parse() *ParsedSource

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳