pandoc

package module
v0.0.0-...-ab6e432 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package pandoc implements the Pandoc AST as defined in Pandoc Types.

Index

Constants

View Source
const BlockQuoteTag = Tag("BlockQuote")
View Source
const BulletListTag = Tag("BulletList")
View Source
const CiteTag = Tag("Cite")
View Source
const CodeBlockTag = Tag("CodeBlock")
View Source
const CodeTag = Tag("Code")
View Source
const DefinitionListTag = Tag("DefinitionList")
View Source
const DivTag = Tag("Div")
View Source
const EmphTag = Tag("Emph")
View Source
const FigureTag = Tag("Figure")
View Source
const HeaderTag = Tag("Header")
View Source
const HorizontalRuleTag = Tag("HorizontalRule")
View Source
const ImageTag = Tag("Image")
View Source
const LineBlockTag = Tag("LineBlock")
View Source
const LineBreakTag = Tag("LineBreak")
View Source
const LinkTag = Tag("Link")
View Source
const MathTag = Tag("Math")
View Source
const MetaBlocksTag = Tag("MetaBlocks")
View Source
const MetaBoolTag = Tag("MetaBool")
View Source
const MetaInlinesTag = Tag("MetaInlines")
View Source
const MetaListTag = Tag("MetaList")
View Source
const MetaMapTag = Tag("MetaMap")
View Source
const MetaStringTag = Tag("MetaString")
View Source
const NoteTag = Tag("Note")
View Source
const OrderedListTag = Tag("OrderedList")
View Source
const ParaTag = Tag("Para")
View Source
const PlainTag = Tag("Plain")
View Source
const QuotedTag = Tag("Quoted")
View Source
const RawBlockTag = Tag("RawBlock")
View Source
const RawInlineTag = Tag("RawInline")
View Source
const SmallCapsTag = Tag("SmallCaps")
View Source
const SoftBreakTag = Tag("SoftBreak")
View Source
const SpaceTag = Tag("Space")
View Source
const SpanTag = Tag("Span")
View Source
const StrTag = Tag("Str")
View Source
const StrikeoutTag = Tag("Strikeout")
View Source
const StrongTag = Tag("Strong")
View Source
const SubscriptTag = Tag("Subscript")
View Source
const SuperscriptTag = Tag("Superscript")
View Source
const TableTag = Tag("Table")
View Source
const UnderlineTag = Tag("Underline")
View Source
const Version = "1.23.1"

Implemented Pandoc protocol version.

Variables

View Source
var (
	// Continue indicates that the traversal should continue, including
	// children of the current element.
	Continue = func() error { return traversalResult(0) }()

	// Skip indicates that the traversal should continue, but skip processing
	// children of the current element.
	Skip = func() error { return traversalResult(skipChildren) }()

	// Halt indicates that the traversal should stop.
	Halt = func() error { return traversalResult(haltTraversal) }()

	// ReplaceContinue indicates that the current element should be
	// replaced with the elements returned by the function, and the
	// function should be applied to the children of the returned elements.
	ReplaceContinue = func() error { return traversalResult(replaceElement) }()

	// ReplaceSkip indicates that the current element should be replaced with the
	// elements returned by the function. No children of the returned elements
	// will be processed, but the traversal will continue with the siblings of
	// the current element (if any).
	ReplaceSkip = func() error { return traversalResult(replaceElement | skipChildren) }()

	// ReplaceHalt indicates that the current element should be replaced with the
	// elements returned by the function, and the traversal should stop.
	// No children of the returned elements will be processed.
	// Might be useful to change or remove the only specific element in the AST.
	ReplaceHalt = func() error { return traversalResult(replaceElement | haltTraversal) }()

	// Returned by Filter if the function returns the wrong type.
	ErrUnexpectedType = errors.New("unexpected type")
)
View Source
var DefaultFormat = Conf{
	Format: "markdown",
}
View Source
var LB = &LineBreak{}
View Source
var SB = &SoftBreak{}
View Source
var SP = &Space{}

Functions

func Clone

func Clone[P Element](elt P) P

Returs a shallow copy of an element. Intended for use in Filter.

func Filter

func Filter[P any, E Element, R Element](elt E, fun func(P) ([]R, error)) (E, error)

Filter applies the specified function 'fun' to each child element of the provided element 'elt'. The function 'fun' is not applied to 'elt' itself, even if 'elt's type matches the parameter type of 'fun'.

The parameter type P should be the same as or implement the return type R. This relationship is not enforced by the type system. If this condition is not met, the filter operation will still execute, but the intended modifications may not be applied.

The parameter type P must be also a slice of R. In this case the function will be applied to all the lists of Inlines, or Blocks, (but not both). In latter case the order of traversal is reverted: fun will be applied to all the children and the to the current element's list.

The behavior of the filter depends on the error returned by 'fun':

  • TraverseChildren: Continie traversing including children of the current element.
  • SkipChildren: Continue traversing AST, but skip processing children of the current element.
  • StopTraversal: Skips processing children of the current element and terminates the traversal process immediately.
  • Replace: Replaces the current element with the elements returned by 'fun'.
  • any other error: Terminates the traversal process immediately and returns the error.

To remove an element, 'fun' should return an empty slice of elements along with Replace.

The function returns an updated version of the 'elt' after applying the specified function 'fun' (it might be the same 'elt' if no changes were made).

Example:

 import . "github.com/growler/go-pandoc/cons"

	doc = pandoc.Filter(doc, func (str *pandoc.Str) ([]pandoc.Inline, error) {
	    return Inlines(Quoted(SingleQuote, Str("foo"))), Replace
	})

func Fprint

func Fprint(w io.Writer, e Element) error

Prints the JSON encoding of element e to w. Usefull for debugging.

func Index

func Index[E Element, L Element](lst []L) (int, E)

Index returns index of the first element of type E in the list of elements implementing interface L (either Block or Inline), and the element itself. Returns -1, nil if []L does not contain any element of type E

Example:

  Filter(doc, func(lst []Inline) ([]Inline, error) {
	     ...
      if span, idx := Index[*Span](lst); idx >= 0 {

func Index2

func Index2[E1 Element, E2 Element, L Element](lst []L) (int, E1, E2)

Index2 returns index of the first sequence of elements of types E1 and E2 in the list of elements implementing interface L (either Block or Inline), and the elements themselves. Returns -1, nil, nil if []L does not contain any element of type E

Example:

  Filter(doc, func(lst []Block) ([]Block, error) {
	     ...
      if para, block, idx := Index2[*Plain, *CodeBlock](lst); idx >= 0 {

func Index3

func Index3[E1 Element, E2 Element, E3 Element, L Element](lst []L) (int, E1, E2, E3)

Index3 returns index of the first sequence of elements of types E1, E2 and E3 in the list of elements implementing interface L (either Block or Inline), and the elements themselves. Returns -1, nil, nil, nil if []L does not contain any element of type E

Example:

  Filter(doc, func(lst []Inline) ([]Inline, error) {
	     ...
      if _, str, _, idx := Index3[*Space, *Str, *Space](lst); idx >= 0 {

func InlinesToIdent

func InlinesToIdent(inlines []Inline) string

Converts list of inlines to identifier.

func Is

func Is[P any, S Element](elt S) bool

A convenience function to check if an element is of a particular type.

Example:

if pandoc.Is[*pandoc.Str](elt) {
    ...

if pandoc.Is[pandoc.Inline](elt) {
    ...

func Match

func Match[T Element, E Element](m T, e E) (T, bool)

Matches element E of type E agains template m of type T. Returns T and true if e matches. Does not modify m.

Example:

  var tmpl = &Para{[]Inline{&Code{}, &Link{}}}
  Query(doc, func(e Block) {
	     if para, ok := Match(tmpl, e); ok {
	         ... // para is Para that consists of a single Code followed by Link

func Print

func Print(e Element) error

Prints the JSON encoding of element e to stdout. Usefull for debugging.

func Query

func Query[P any, E Element](elt E, fun func(P))

Query works the same way as QueryE, but fun does not return errors and traverse all the AST.

func QueryE

func QueryE[P any, E Element](elt E, fun func(P) error) error

QueryE applies the specified function 'fun' to each child element of the provided element 'elt'. The function 'fun' is not applied to 'elt' itself, regardless of whether 'elt's type matches the parameter type of 'fun'.

This function is used for walking through the child elements of 'elt' and applying the function 'fun' to perform checks or actions, without altering the structure of 'elt'. It is particularly useful for operations like searching or validation where modification of the element is not required.

The function 'fun' returns an error to control the traversal process:

  • Continue: Continie traversing the tree. Also nil works as well.
  • Skip: Skips processing children of the current element.
  • SkipAll: Skips processing children of the current element and terminates the traversal process immediately.
  • Replace: Not allowed. The function should not return this error. However, works as Continue.
  • any other error: Terminates the traversal process immediately and returns the error.

Unlike Filter, Query does not modify the element 'elt' or its children. It strictly performs read-only operations as defined in 'fun'.

The fun may update the elements in-place, however this must be used with caution.

Example:

var headers int
pandoc.Query(doc, func (str *pandoc.Header) { headers++ })

pandoc.QueryE(doc, func (str *pandoc.Header) error {

})

func Sprint

func Sprint(e Element) string

Returns the JSON encoding of element e as a string. Usefull for debugging.

func StoreFile

func StoreFile(f string, conf Conf, meta Meta, docs ...*Pandoc) error

func StoreTo

func StoreTo(w io.Writer, conf Conf, meta Meta, docs ...*Pandoc) error

func StringToIdent

func StringToIdent(s string) string

Converts string to identifier.

func Transformer

func Transformer[E Element, P any, R Element](fun func(P) ([]R, error)) func(E) (E, error)

Takes a filter function and returns a transformer function that can be used with element.Apply.

Example:

  doc.Apply(
	    pandoc.Transformer[*pandoc.Pandoc](func (e *pandoc.Span) ([]pandoc.Inline, error) {
		    ...
	    }),
	    pandoc.Transformer[*pandoc.Pandoc](func (e *pandoc.Header) ([]pandoc.Block, error) {
		    ...
	    }),
  )

Types

type Alignment

type Alignment Tag
const (
	AlignLeft    Alignment = "AlignLeft"
	AlignRight   Alignment = "AlignRight"
	AlignCenter  Alignment = "AlignCenter"
	AlignDefault Alignment = "AlignDefault"
)

type Attr

type Attr struct {
	Id      string   // Element ID
	Classes []string // Element classes
	KVs     []KV     // Element attributes' key-value pairs
}

Pandoc elements attribute.

func (*Attr) Get

func (a *Attr) Get(key string) (string, bool)

Returns a value of the given key or false if the key is not present.

func (*Attr) HasClass

func (a *Attr) HasClass(c string) bool

Returns true if attribute has the given class.

func (*Attr) HasOneOfClasses

func (a *Attr) HasOneOfClasses(c ...string) bool

Returns true if attribute has one of the given classes.

func (*Attr) Ident

func (a *Attr) Ident() string

Returns the element's ID.

func (*Attr) SetIdent

func (a *Attr) SetIdent(id string)

Sets the element's ID in-place. This method is intended to quickly modify an element's ID in Query or QueryE without cloning it.

func (Attr) WithClass

func (a Attr) WithClass(c string) Attr

Returns a copy of attributes with the given class.

func (Attr) WithIdent

func (a Attr) WithIdent(id string) Attr

Returns a copy of attributes with the given ID.

func (Attr) WithKV

func (a Attr) WithKV(key, value string) Attr

Returns a copy of attributes with the given key-value pair.

func (Attr) WithKVs

func (a Attr) WithKVs(pairs ...string) Attr

Returns a copy of attributes with the given key-value pairs.

func (Attr) WithoutClass

func (a Attr) WithoutClass(c string) Attr

Returns a copy of attributes without the given class.

func (Attr) WithoutKey

func (a Attr) WithoutKey(key string) Attr

Returns a copy of attributes without the given key.

func (Attr) WithoutKeys

func (a Attr) WithoutKeys(keys ...string) Attr

Returns a copy of attributes without the given keys.

type Block

type Block interface {
	Element
	Tagged
	// contains filtered or unexported methods
}

Pandoc AST block element

type BlockQuote

type BlockQuote struct {
	Blocks []Block
}

Block quote (list of blocks)

func (*BlockQuote) Apply

func (b *BlockQuote) Apply(transformers ...func(*BlockQuote) (*BlockQuote, error)) (*BlockQuote, error)

func (*BlockQuote) Tag

func (b *BlockQuote) Tag() Tag

type BulletList

type BulletList struct {
	Items [][]Block
}

Bullet list (list of items, each a list of blocks)

func (*BulletList) Apply

func (l *BulletList) Apply(transformers ...func(*BulletList) (*BulletList, error)) (*BulletList, error)

func (*BulletList) Tag

func (l *BulletList) Tag() Tag

type Caption

type Caption struct {
	Short []Inline
	Long  []Block
}

type Citation

type Citation struct {
	Id      string
	Prefix  []Inline
	Suffix  []Inline
	Mode    CitationMode
	NoteNum int
	Hash    int
}

func (*Citation) Apply

func (c *Citation) Apply(transformers ...func(*Citation) (*Citation, error)) (*Citation, error)

type CitationMode

type CitationMode Tag
const (
	NormalCitation CitationMode = "NormalCitation"
	SuppressAuthor CitationMode = "SuppressAuthor"
	AuthorInText   CitationMode = "AuthorInText"
)

type Cite

type Cite struct {
	Citations []*Citation
	Inlines   []Inline
}

Citation (list of inlines)

func (*Cite) Apply

func (c *Cite) Apply(transformers ...func(*Cite) (*Cite, error)) (*Cite, error)

func (*Cite) Tag

func (c *Cite) Tag() Tag

type Code

type Code struct {
	Attr
	Text string
}

Inline code (literal)

func (*Code) Tag

func (c *Code) Tag() Tag

type CodeBlock

type CodeBlock struct {
	Attr
	Text string
}

Code block (literal)

func (*CodeBlock) Tag

func (b *CodeBlock) Tag() Tag

type ColSpec

type ColSpec struct {
	Align Alignment
	Width ColWidth
}

type ColWidth

type ColWidth struct {
	Width   float64
	Default bool
}

func DefaultColWidth

func DefaultColWidth() ColWidth

func (ColWidth) Tag

func (c ColWidth) Tag() string

type Conf

type Conf struct {
	Pandoc string   // Path to pandoc executable
	Dir    string   // Working directory
	Format string   // Format to load or store.
	Ext    []string // List of format extensions, each must start with '+' or '-'
	Opts   []string // Additional options
}

A configuration for running pandoc executable.

func Format

func Format(f string) Conf

Makes a new Conf for format f.

func (Conf) WithDir

func (c Conf) WithDir(dir string) Conf

func (Conf) WithExt

func (c Conf) WithExt(ext string) Conf

func (Conf) WithOpt

func (c Conf) WithOpt(opt string, val ...string) Conf

Add an option to the configuration. Accepts:

  • single-letter option, e.g. "s"
  • single-letter option with value, e.g. "s", "foo"
  • long option, e.g. "smart"
  • long option with value, e.g. "smart", "foo"

func (Conf) WithPandoc

func (c Conf) WithPandoc(path string) Conf

Returns a Conf with a specified path to pandoc executable.

func (Conf) WithoutExt

func (c Conf) WithoutExt(ext string) Conf

type Definition

type Definition struct {
	Term       []Inline
	Definition [][]Block
}

type DefinitionList

type DefinitionList struct {
	Items []Definition
}

Definition list (list of items, each a pair of inlines and a list of blocks)

func (*DefinitionList) Apply

func (d *DefinitionList) Apply(transformers ...func(*DefinitionList) (*DefinitionList, error)) (*DefinitionList, error)

func (*DefinitionList) Tag

func (d *DefinitionList) Tag() Tag

type Div

type Div struct {
	Attr
	Blocks []Block
}

Generic block container with attributes

func (*Div) Apply

func (d *Div) Apply(transformers ...func(*Div) (*Div, error)) (*Div, error)

func (*Div) Tag

func (d *Div) Tag() Tag

type Element

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

Pandoc AST element interface

type Emph

type Emph struct {
	Inlines []Inline
}

Emphasized text (list of inlines)

func (*Emph) Apply

func (e *Emph) Apply(transformers ...func(*Emph) (*Emph, error)) (*Emph, error)

func (*Emph) Tag

func (e *Emph) Tag() Tag

type Figure

type Figure struct {
	Attr
	Caption Caption
	Blocks  []Block
}

Figure, with attributes, caption, and content (list of blocks)

func (*Figure) Apply

func (f *Figure) Apply(transformers ...func(*Figure) (*Figure, error)) (*Figure, error)

func (*Figure) Tag

func (f *Figure) Tag() Tag
type Header struct {
	Attr
	Level   int
	Inlines []Inline
}

Header - level (integer) and text (inlines)

func (*Header) Apply

func (h *Header) Apply(transformers ...func(*Header) (*Header, error)) (*Header, error)

func (*Header) Tag

func (h *Header) Tag() Tag

func (*Header) Title

func (h *Header) Title() string

type HorizontalRule

type HorizontalRule struct{}

Horizontal rule

func (*HorizontalRule) Tag

func (*HorizontalRule) Tag() Tag

type Image

type Image struct {
	Attr
	Inlines []Inline
	Target  Target
}

Image: alt text (list of inlines), target

func (*Image) Apply

func (i *Image) Apply(transformers ...func(*Image) (*Image, error)) (*Image, error)

func (*Image) Tag

func (i *Image) Tag() Tag

type Inline

type Inline interface {
	Element
	Tagged
	// contains filtered or unexported methods
}

Pandoc AST inline element

type KV

type KV struct {
	Key   string
	Value string
}

Pandoc elements attribute' key-value pair.

type LineBlock

type LineBlock struct {
	Inlines [][]Inline
}

Multiple non-breaking lines

func (*LineBlock) Apply

func (b *LineBlock) Apply(transformers ...func(*LineBlock) (*LineBlock, error)) (*LineBlock, error)

func (*LineBlock) Tag

func (b *LineBlock) Tag() Tag

type LineBreak

type LineBreak struct{}

Hard line break

func (*LineBreak) Tag

func (*LineBreak) Tag() Tag
type Link struct {
	Attr
	Inlines []Inline
	Target  Target
}

Hyperlink: alt text (list of inlines), target

func (*Link) Apply

func (l *Link) Apply(transformers ...func(*Link) (*Link, error)) (*Link, error)

func (*Link) Tag

func (l *Link) Tag() Tag

type Linkable

type Linkable interface {
	Element
	Ident() string
	SetIdent(string)
}

Pandoc AST element that can be referred to.

type ListAttrs

type ListAttrs struct {
	Start     int
	Style     ListNumberStyle
	Delimiter ListNumberDelim
}

type ListNumberDelim

type ListNumberDelim Tag
const (
	DefaultDelim ListNumberDelim = "DefaultDelim"
	Period       ListNumberDelim = "Period"
	OneParen     ListNumberDelim = "OneParen"
	TwoParens    ListNumberDelim = "TwoParens"
)

type ListNumberStyle

type ListNumberStyle Tag
const (
	DefaultStyle ListNumberStyle = "DefaultStyle"
	Example      ListNumberStyle = "Example"
	Decimal      ListNumberStyle = "Decimal"
	LowerRoman   ListNumberStyle = "LowerRoman"
	UpperRoman   ListNumberStyle = "UpperRoman"
	LowerAlpha   ListNumberStyle = "LowerAlpha"
	UpperAlpha   ListNumberStyle = "UpperAlpha"
)

type Math

type Math struct {
	MathType MathType
	Text     string
}

TeX math (literal)

func (*Math) Tag

func (m *Math) Tag() Tag

type MathType

type MathType Tag
const (
	DisplayMath MathType = "DisplayMath"
	InlineMath  MathType = "InlineMath"
)

type Meta

type Meta []MetaMapEntry

Pandoc's Meta

func (*Meta) Get

func (m *Meta) Get(key string) MetaValue

Returns a value of the given key or nil if the key is not present.

func (*Meta) Set

func (m *Meta) Set(key string, value MetaValue)

Sets a value for the given key. If the value is nil, the key is removed.

func (*Meta) SetBlocks

func (m *Meta) SetBlocks(key string, value ...Block)

Sets a list of blocks for the given key.

func (*Meta) SetBool

func (m *Meta) SetBool(key string, value bool)

Sets a boolean value for the given key.

func (*Meta) SetInlines

func (m *Meta) SetInlines(key string, value ...Inline)

Sets a list of inlines for the given key.

func (*Meta) SetString

func (m *Meta) SetString(key string, value string)

Sets a string value for the given key.

type MetaBlocks

type MetaBlocks struct {
	Blocks []Block
}

Pandoc document metadata blocks block

func (*MetaBlocks) Tag

func (m *MetaBlocks) Tag() Tag

type MetaBool

type MetaBool bool

Pandoc document metadata boolean

func (MetaBool) Tag

func (b MetaBool) Tag() Tag

type MetaInlines

type MetaInlines struct {
	Inlines []Inline
}

Pandoc document metadata inlines block

func (*MetaInlines) Tag

func (m *MetaInlines) Tag() Tag

func (*MetaInlines) Text

func (m *MetaInlines) Text() string

type MetaList

type MetaList struct {
	Entries []MetaValue
}

Pandoc document metadata list

func (*MetaList) Tag

func (m *MetaList) Tag() Tag

type MetaMap

type MetaMap struct {
	Entries Meta
}

Pandoc document metadata map

func (*MetaMap) Get

func (m *MetaMap) Get(key string) MetaValue

Returns a value of the given key or nil if the key is not present.

func (*MetaMap) Set

func (m *MetaMap) Set(key string, value MetaValue)

Sets a value for the given key. If the value is nil, the key is removed.

func (*MetaMap) Tag

func (m *MetaMap) Tag() Tag

type MetaMapEntry

type MetaMapEntry struct {
	Key   string
	Value MetaValue
}

Pandoc's MetaMap entry.

type MetaString

type MetaString string

Pandoc document metadata string

func (MetaString) String

func (s MetaString) String() string

func (MetaString) Tag

func (MetaString) Tag() Tag

type MetaValue

type MetaValue interface {
	Element
	Tagged
	// contains filtered or unexported methods
}

Pandoc document metadata value

type Note

type Note struct {
	Blocks []Block
}

Footnote: list of blocks

func (*Note) Apply

func (n *Note) Apply(transformers ...func(*Note) (*Note, error)) (*Note, error)

func (*Note) Tag

func (n *Note) Tag() Tag

type OrderedList

type OrderedList struct {
	Attr  ListAttrs
	Items [][]Block
}

Ordered list (attributes and a list of items, each a list of blocks)

func (*OrderedList) Apply

func (l *OrderedList) Apply(transformers ...func(*OrderedList) (*OrderedList, error)) (*OrderedList, error)

func (*OrderedList) Tag

func (l *OrderedList) Tag() Tag

type Pandoc

type Pandoc struct {
	Meta   Meta
	Blocks []Block
}

Pandoc document

func LoadFile

func LoadFile(f string, conf Conf) (*Pandoc, error)

func LoadFiles

func LoadFiles(f []string, conf Conf) (*Pandoc, error)

func LoadFrom

func LoadFrom(r io.Reader, conf Conf) (*Pandoc, error)

func ReadFrom

func ReadFrom(r io.Reader) (*Pandoc, error)

ReadFrom parses a Pandoc AST JSON from the reader.

func (*Pandoc) Apply

func (p *Pandoc) Apply(transformers ...func(*Pandoc) (*Pandoc, error)) (*Pandoc, error)

func (*Pandoc) StoreFile

func (p *Pandoc) StoreFile(f string, conf Conf) error

func (*Pandoc) StoreTo

func (p *Pandoc) StoreTo(w io.Writer, conf Conf) error

func (*Pandoc) WriteTo

func (p *Pandoc) WriteTo(w io.Writer) error

Write writes the JSON encoding of pandoc AST to w.

Example:

var doc pandoc.Pandoc
...
if err := doc.WriteTo(os.Stdout); err != nil {
	log.Fatal(err)
}

type Para

type Para struct {
	Inlines []Inline
}

Paragraph (list of inlines)

func (*Para) Apply

func (p *Para) Apply(transformers ...func(*Para) (*Para, error)) (*Para, error)

func (*Para) Tag

func (p *Para) Tag() Tag

type Plain

type Plain struct {
	Inlines []Inline
}

Plain text, not a paragraph

func (*Plain) Apply

func (p *Plain) Apply(transformers ...func(*Plain) (*Plain, error)) (*Plain, error)

func (*Plain) Tag

func (p *Plain) Tag() Tag

type QuoteType

type QuoteType Tag
const (
	SingleQuote QuoteType = "SingleQuote"
	DoubleQuote QuoteType = "DoubleQuote"
)

type Quoted

type Quoted struct {
	QuoteType QuoteType
	Inlines   []Inline
}

Quoted text (list of inlines)

func (*Quoted) Apply

func (q *Quoted) Apply(transformers ...func(*Quoted) (*Quoted, error)) (*Quoted, error)

func (*Quoted) Tag

func (q *Quoted) Tag() Tag

type RawBlock

type RawBlock struct {
	Format string
	Text   string
}

Raw block

func (*RawBlock) Tag

func (b *RawBlock) Tag() Tag

type RawInline

type RawInline struct {
	Format string
	Text   string
}

Raw inline

func (*RawInline) Tag

func (r *RawInline) Tag() Tag

type SmallCaps

type SmallCaps struct {
	Inlines []Inline
}

Small capitals (list of inlines)

func (*SmallCaps) Apply

func (s *SmallCaps) Apply(transformers ...func(*SmallCaps) (*SmallCaps, error)) (*SmallCaps, error)

func (*SmallCaps) Tag

func (s *SmallCaps) Tag() Tag

type SoftBreak

type SoftBreak struct{}

Soft line break

func (*SoftBreak) Tag

func (*SoftBreak) Tag() Tag

type Space

type Space struct{}

Inter-word space

func (*Space) Tag

func (*Space) Tag() Tag

type Span

type Span struct {
	Attr
	Inlines []Inline
}

Generic inline container with attributes

func (*Span) Apply

func (s *Span) Apply(transformers ...func(*Span) (*Span, error)) (*Span, error)

func (*Span) Tag

func (s *Span) Tag() Tag

type Str

type Str struct {
	Text string
}

Text (string)

func (*Str) Tag

func (s *Str) Tag() Tag

type Strikeout

type Strikeout struct {
	Inlines []Inline
}

Strikeout text (list of inlines)

func (*Strikeout) Apply

func (s *Strikeout) Apply(transformers ...func(*Strikeout) (*Strikeout, error)) (*Strikeout, error)

func (*Strikeout) Tag

func (s *Strikeout) Tag() Tag

type Strong

type Strong struct {
	Inlines []Inline
}

Strongly emphasized text (list of inlines)

func (*Strong) Apply

func (s *Strong) Apply(transformers ...func(*Strong) (*Strong, error)) (*Strong, error)

func (*Strong) Tag

func (s *Strong) Tag() Tag

type Subscript

type Subscript struct {
	Inlines []Inline
}

Subscripted text (list of inlines)

func (*Subscript) Apply

func (s *Subscript) Apply(transformers ...func(*Subscript) (*Subscript, error)) (*Subscript, error)

func (*Subscript) Tag

func (s *Subscript) Tag() Tag

type Superscript

type Superscript struct {
	Inlines []Inline
}

Superscripted text (list of inlines)

func (*Superscript) Apply

func (s *Superscript) Apply(transformers ...func(*Superscript) (*Superscript, error)) (*Superscript, error)

func (*Superscript) Tag

func (s *Superscript) Tag() Tag

type Table

type Table struct {
	Attr
	Caption Caption
	Aligns  []ColSpec
	Head    TableHeadFoot
	Bodies  []*TableBody
	Foot    TableHeadFoot
}

Table, with attributes, caption, optional short caption, column alignments and widths (required), table head, table bodies, and table foot

func (*Table) Apply

func (t *Table) Apply(transformers ...func(*Table) (*Table, error)) (*Table, error)

func (*Table) Tag

func (t *Table) Tag() Tag

type TableBody

type TableBody struct {
	Attr
	RowHeadColumns int
	Head           []*TableRow
	Body           []*TableRow
}

func (*TableBody) Apply

func (t *TableBody) Apply(transformers ...func(*TableBody) (*TableBody, error)) (*TableBody, error)

type TableCell

type TableCell struct {
	Attr
	Align   Alignment
	RowSpan int
	ColSpan int
	Blocks  []Block
}

func (*TableCell) Apply

func (t *TableCell) Apply(transformers ...func(*TableCell) (*TableCell, error)) (*TableCell, error)

type TableHeadFoot

type TableHeadFoot struct {
	Attr
	Rows []*TableRow
}

func (*TableHeadFoot) Apply

func (t *TableHeadFoot) Apply(transformers ...func(*TableHeadFoot) (*TableHeadFoot, error)) (*TableHeadFoot, error)

type TableRow

type TableRow struct {
	Attr
	Cells []*TableCell
}

func (*TableRow) Apply

func (t *TableRow) Apply(transformers ...func(*TableRow) (*TableRow, error)) (*TableRow, error)

type Tag

type Tag string

Pandoc AST object tag

func (Tag) String

func (t Tag) String() string

func (Tag) Tag

func (t Tag) Tag() Tag

type Tagged

type Tagged interface {
	Tag() Tag
}

Pandoc AST object with tag

type Target

type Target struct {
	Url   string
	Title string
}

type Underline

type Underline struct {
	Inlines []Inline
}

Underlined text (list of inlines)

func (*Underline) Apply

func (u *Underline) Apply(transformers ...func(*Underline) (*Underline, error)) (*Underline, error)

func (*Underline) Tag

func (u *Underline) Tag() Tag

type WhiteSpace

type WhiteSpace interface {
	Inline
	// contains filtered or unexported methods
}

Pandoc AST inline's whitespaces (Space, SoftBreak, LineBreak)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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