Documentation ¶
Index ¶
- Variables
- func CountTrailingLineBreaks(source []byte, lineBreak []byte) int
- func DetectLineBreak(source []byte) []byte
- type Attributes
- type Block
- type BlockKind
- type Blocks
- type CodeBlock
- func (b *CodeBlock) Attributes() map[string]string
- func (b *CodeBlock) Background() bool
- func (b *CodeBlock) Categories() []string
- func (b *CodeBlock) Clone() *CodeBlock
- func (b *CodeBlock) Content() []byte
- func (b *CodeBlock) Cwd() string
- func (b *CodeBlock) Document() *Document
- func (b *CodeBlock) ExcludeFromRunAll() bool
- func (b *CodeBlock) FirstLine() string
- func (b *CodeBlock) ID() string
- func (b *CodeBlock) Interactive() bool
- func (b *CodeBlock) InteractiveLegacy() bool
- func (b *CodeBlock) Interpreter() string
- func (b *CodeBlock) Intro() string
- func (b *CodeBlock) IsUnknown() bool
- func (b *CodeBlock) IsUnnamed() bool
- func (CodeBlock) Kind() BlockKind
- func (b *CodeBlock) Language() string
- func (b *CodeBlock) Lines() []string
- func (b *CodeBlock) MarshalJSON() ([]byte, error)
- func (b *CodeBlock) Name() string
- func (b *CodeBlock) PrependLines(newLines []string)
- func (b *CodeBlock) PromptEnv() bool
- func (b *CodeBlock) PromptEnvStr() string
- func (b *CodeBlock) SetLine(p int, v string)
- func (b *CodeBlock) SetLines(newLines []string)
- func (b *CodeBlock) TextRange() (textRange TextRange)
- func (b *CodeBlock) Unwrap() ast.Node
- func (b *CodeBlock) Value() []byte
- type CodeBlocks
- type Document
- func (d *Document) Content() []byte
- func (d *Document) ContentOffset() int
- func (d *Document) Frontmatter() *Frontmatter
- func (d *Document) FrontmatterRaw() []byte
- func (d *Document) FrontmatterWithError() (*Frontmatter, error)
- func (d *Document) Parse() error
- func (d *Document) Root() (*Node, error)
- func (d *Document) RootAST() (ast.Node, error)
- func (d *Document) TrailingLineBreaksCount() int
- type Frontmatter
- type InnerBlock
- type MarkdownBlock
- type Node
- type ParsedSections
- type RunmeMetadata
- type RunmeMetadataDocument
- type RunmeMetadataSession
- type TextRange
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultAttributeParser = newFailoverAttributeParser(
[]attributeParser{
&jsonParser{},
&babikMLParser{},
},
&jsonParser{},
)
View Source
var ErrFrontmatterInvalid = stderrors.New("invalid frontmatter")
Functions ¶
func CountTrailingLineBreaks ¶
func DetectLineBreak ¶
Types ¶
type Attributes ¶
type CodeBlock ¶
type CodeBlock struct {
// contains filtered or unexported fields
}
func (*CodeBlock) Attributes ¶
func (*CodeBlock) Background ¶
func (*CodeBlock) Categories ¶
func (*CodeBlock) ExcludeFromRunAll ¶
func (*CodeBlock) Interactive ¶
func (*CodeBlock) InteractiveLegacy ¶
InteractiveLegacy returns true as a default value. Deprecated: use Interactive instead.
func (*CodeBlock) Interpreter ¶
func (*CodeBlock) MarshalJSON ¶
func (*CodeBlock) PrependLines ¶
func (*CodeBlock) PromptEnvStr ¶
type CodeBlocks ¶
type CodeBlocks []*CodeBlock
func CollectCodeBlocks ¶
func CollectCodeBlocks(node *Node) (result CodeBlocks)
func (CodeBlocks) Names ¶
func (b CodeBlocks) Names() (result []string)
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
func (*Document) ContentOffset ¶
ContentOffset returns the position of source from which the actual content starts. If a value <0 is returned, it means that the source is not parsed yet.
Frontmatter is not a part of the content.
func (*Document) Frontmatter ¶
func (d *Document) Frontmatter() *Frontmatter
func (*Document) FrontmatterRaw ¶ added in v3.4.1
func (*Document) FrontmatterWithError ¶ added in v3.4.1
func (d *Document) FrontmatterWithError() (*Frontmatter, error)
func (*Document) TrailingLineBreaksCount ¶
type Frontmatter ¶
type Frontmatter struct { Runme *RunmeMetadata `yaml:"runme,omitempty"` Shell string `yaml:"shell"` Cwd string `yaml:"cwd"` Category string `yaml:"category"` TerminalRows string `yaml:"terminalRows"` SkipPrompts bool `yaml:"skipPrompts,omitempty"` // contains filtered or unexported fields }
func NewYAMLFrontmatter ¶
func NewYAMLFrontmatter() *Frontmatter
func ParseFrontmatter ¶
func ParseFrontmatter(raw []byte) (*Frontmatter, error)
TODO(adamb): it should be removed when the complete refactoring of the project is finished.
type InnerBlock ¶
type InnerBlock struct {
// contains filtered or unexported fields
}
InnerBlock represents a non-leaf block. It helps to handle nested fenced code blocks for block quotes and list items.
func (InnerBlock) Kind ¶
func (InnerBlock) Kind() BlockKind
func (*InnerBlock) Unwrap ¶
func (b *InnerBlock) Unwrap() ast.Node
func (*InnerBlock) Value ¶
func (b *InnerBlock) Value() []byte
type MarkdownBlock ¶
type MarkdownBlock struct {
// contains filtered or unexported fields
}
func (MarkdownBlock) Kind ¶
func (MarkdownBlock) Kind() BlockKind
func (*MarkdownBlock) Unwrap ¶
func (b *MarkdownBlock) Unwrap() ast.Node
func (*MarkdownBlock) Value ¶
func (b *MarkdownBlock) Value() []byte
type ParsedSections ¶
func ParseSections ¶
func ParseSections(source []byte) (result ParsedSections, _ error)
type RunmeMetadata ¶
type RunmeMetadata struct { ID string `yaml:"id,omitempty" json:"id,omitempty" toml:"id,omitempty"` Version string `yaml:"version,omitempty" json:"version,omitempty" toml:"version,omitempty"` Document *RunmeMetadataDocument `yaml:"document,omitempty" json:"document,omitempty" toml:"document,omitempty"` Session *RunmeMetadataSession `yaml:"session,omitempty" json:"session,omitempty" toml:"session,omitempty"` }
func (*RunmeMetadata) IsEmpty ¶
func (m *RunmeMetadata) IsEmpty() bool
type RunmeMetadataDocument ¶
type RunmeMetadataDocument struct {
RelativePath string `yaml:"relativePath,omitempty" json:"relativePath,omitempty" toml:"relativePath,omitempty"`
}
type RunmeMetadataSession ¶
type RunmeMetadataSession struct { ID string `yaml:"id,omitempty" json:"id,omitempty" toml:"id,omitempty"` Updated string `yaml:"updated,omitempty" json:"updated,omitempty" toml:"updated,omitempty"` }
func (*RunmeMetadataSession) GetID ¶
func (s *RunmeMetadataSession) GetID() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.