ast

package
v0.0.0-...-35d07ea Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package ast declares structures used to represent mexdown syntax trees.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Citation

type Citation struct {
	Label string
	Src   string
}

A Citation statement represents the corresponding source for a cited label. This label can be referenced in links.

type Directive

type Directive struct {
	Command string
	Raw     string
}

A Directive statement represents either raw (preformatted) text, or an input string to pass into a command.

type FType

type FType int

An FType is the set of valid formats applied to text.

const (
	Cite          FType = iota // [src] or [label](src)
	Italic                     // *text*
	Bold                       // **text**
	BoldItalic                 // ***text***
	Underline                  // _text_
	Strikethrough              // --text--
	Raw                        // `text`
)

type File

type File struct {
	List []Stmt
	Cite map[string]string
}

File represents a mexdown source file. It stores a list of statements representing the source text and citations referenced by any links in the source.

type Format

type Format struct {
	Kind FType
	Beg  int
	End  int
}

Format holds position and type information for a body of text.

type Header struct {
	NThorpe int // Number of preceding octothorpes '#'
	Text    Text
}

A Header statement represents a multi-level section heading.

type List

type List struct {
	Items []ListItem
}

A List statement represents a sequence of list items.

type ListItem

type ListItem struct {
	NTab  int // Number of preceding tab characters '\t'
	Label string
	Text  Text
}

A ListItem node represents text preceded by a label.

type Node

type Node interface {
	// contains filtered or unexported methods
}

All Node types implement the Node interface.

type Paragraph

type Paragraph struct {
	Format []Format
	Body   string
}

A Paragraph statement represents a body of text with formatting applied.

type Stmt

type Stmt interface {
	Node
	// contains filtered or unexported methods
}

All statement nodes implement the Stmt interface.

type Text

type Text Paragraph

A Text node represents an arbitrary body of text with formatting applied.

Jump to

Keyboard shortcuts

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