Documentation
¶
Index ¶
- Constants
- func NewEscapedQuotedText(backslashes string, punctuation string, content []interface{}) ([]interface{}, error)
- func NewListItemContent(content []interface{}) ([]interface{}, error)
- func NewQuoteAttributes(kind, author, title string) (map[string]interface{}, error)
- func None(content []interface{}) ([]interface{}, error)
- func ResetFootnoteSequence()
- func Verbatim(content []interface{}) ([]interface{}, error)
- func WithAttributes(element interface{}, attributes []interface{}) (interface{}, error)
- type AdmonitionKind
- type BlankLine
- type BlockKind
- type BulletStyle
- type ContinuedListElement
- type CrossReference
- type DefaultAttribute
- type DelimitedBlock
- type Document
- type DocumentAttributeDeclaration
- type DocumentAttributeReset
- type DocumentAttributeSubstitution
- type DocumentAttributes
- func (a DocumentAttributes) Add(key string, value interface{}) DocumentAttributes
- func (a DocumentAttributes) AddAll(attrs DocumentAttributes) DocumentAttributes
- func (a DocumentAttributes) AddDeclaration(attr DocumentAttributeDeclaration)
- func (a DocumentAttributes) AddNonEmpty(key string, value interface{})
- func (a DocumentAttributes) GetAsString(key string) string
- func (a DocumentAttributes) GetTOCLevels() (*int, error)
- func (a DocumentAttributes) GetTitle() (SectionTitle, error)
- func (a DocumentAttributes) Has(key string) bool
- func (a DocumentAttributes) HasAuthors() bool
- func (a DocumentAttributes) HasTitle() bool
- func (a DocumentAttributes) Reset(attr DocumentAttributeReset)
- type DocumentAuthor
- type DocumentHeader
- type DocumentRevision
- type ElementAttributes
- func NewAdmonitionAttribute(k AdmonitionKind) (ElementAttributes, error)
- func NewAttributeGroup(attributes []interface{}) (ElementAttributes, error)
- func NewElementAttributes(attributes []interface{}, extras ...ElementAttributes) ElementAttributes
- func NewElementID(id string) (ElementAttributes, error)
- func NewElementRole(role string) (ElementAttributes, error)
- func NewElementTitle(title string) (ElementAttributes, error)
- func NewGenericAttribute(key string, value interface{}) (ElementAttributes, error)
- func NewImageAttributes(alt, width, height interface{}, otherattrs []interface{}) (ElementAttributes, error)
- func NewInlineElementID(id string) (ElementAttributes, error)
- func NewInlineLinkAttributes(text interface{}, otherattrs []interface{}) (ElementAttributes, error)
- func NewLiteralAttribute() (ElementAttributes, error)
- func NewSourceAttributes(language string) (ElementAttributes, error)
- type ElementReferences
- type ElementReferencesCollector
- type ElementWithAttributes
- type Footnote
- type FootnoteReferences
- type Footnotes
- type FootnotesCollector
- type FrontMatter
- type ImageBlock
- type InlineElements
- type InlineImage
- type InlineLink
- type LabeledList
- type LabeledListItem
- type LineBreak
- type List
- type ListItem
- type LiteralBlock
- type NormalizationFunc
- type NumberingStyle
- type OrderedList
- type OrderedListItem
- type OrderedListItemPrefix
- type Paragraph
- type Passthrough
- type PassthroughKind
- type Preamble
- type QuotedText
- type QuotedTextKind
- type Section
- type SectionTitle
- type SingleLineComment
- type StringElement
- type Substitution
- type Table
- type TableLine
- type TableOfContentsMacro
- type UnorderedList
- type UnorderedListItem
- type UnorderedListItemCheckStyle
- type UnorderedListItemPrefix
- type Visitable
- type Visitor
Constants ¶
const ( // AttrID the key to retrieve the ID in the element attributes AttrID string = "id" // AttrCustomID the key to retrieve the flag that indicates if the element ID is custom or generated AttrCustomID string = "customID" // AttrIDPrefix the key to retrieve the ID Prefix in the element attributes AttrIDPrefix string = "idprefix" // AttrTitle the key to retrieve the title in the element attributes AttrTitle string = "title" // AttrRole the key to retrieve the role in the element attributes AttrRole string = "role" // AttrInlineLink the key to retrieve the link in the element attributes AttrInlineLink string = "link" // AttrAdmonitionKind the key to retrieve the kind of admonition in the element attributes, if a "masquerade" is used AttrAdmonitionKind string = "admonitionKind" // AttrQuoteAuthor attribute for the author of a verse AttrQuoteAuthor string = "quoteAuthor" // AttrQuoteTitle attribute for the title of a verse AttrQuoteTitle string = "quoteTitle" // AttrSource the "source" attribute for a source block or a source paragraph (this is a placeholder, ie, it does not expect any value for this attribute) AttrSource string = "source" // AttrLanguage the associated "language" attribute for a source block or a source paragraph AttrLanguage string = "language" // AttrCheckStyle the attribute to mark the first element of an unordered list itemd as a checked or not AttrCheckStyle string = "checkstyle" // AttrStart the "start" attribute in an ordered list AttrStart string = "start" // AttrQandA the "qanda" attribute for Q&A labeled lists AttrQandA string = "qanda" )
const ( // AttrKind the key for the kind of block AttrKind string = "kind" // Fenced a fenced block Fenced BlockKind = "fenced" // Listing a listing block Listing BlockKind = "listing" // Example an example block Example BlockKind = "example" // Comment a comment block Comment BlockKind = "comment" // Quote a quote block Quote BlockKind = "quote" // Verse a verse block Verse BlockKind = "verse" // Sidebar a sidebar block Sidebar BlockKind = "sidebar" // Literal a literal block Literal BlockKind = "literal" // Source a source block Source BlockKind = "source" )
const ( // AttrImageAlt the image `alt` attribute AttrImageAlt string = "alt" // AttrImageWidth the image `width` attribute AttrImageWidth string = "width" // AttrImageHeight the image `height` attribute AttrImageHeight string = "height" // AttrImageTitle the image `title` attribute AttrImageTitle string = "title" )
const ( // AttrLiteralBlockType the type of literal block, ie, how it was parsed AttrLiteralBlockType = "literalBlockType" // LiteralBlockWithDelimiter a literal block parsed with a delimiter LiteralBlockWithDelimiter = "literalBlockWithDelimiter" // LiteralBlockWithSpacesOnFirstLine a literal block parsed with one or more spaces on the first line LiteralBlockWithSpacesOnFirstLine = "literalBlockWithSpacesOnFirstLine" // LiteralBlockWithAttribute a literal block parsed with a `[literal]` attribute` LiteralBlockWithAttribute = "literalBlockWithAttribute" )
const AttrHardBreaks = "%hardbreaks"
AttrHardBreaks the attribute to set on a paragraph to render with hard breaks on each line
const AttrInlineLinkText string = "text"
AttrInlineLinkText the link `text` attribute
const DocumentAttrHardBreaks = "hardbreaks"
DocumentAttrHardBreaks the attribute to set at the document level to render with hard breaks on each line of all paragraphs
Variables ¶
This section is empty.
Functions ¶
func NewEscapedQuotedText ¶
func NewEscapedQuotedText(backslashes string, punctuation string, content []interface{}) ([]interface{}, error)
NewEscapedQuotedText returns a new InlineElements where the nested elements are preserved (ie, substituted as expected)
func NewListItemContent ¶
func NewListItemContent(content []interface{}) ([]interface{}, error)
NewListItemContent initializes a new `UnorderedListItemContent`
func NewQuoteAttributes ¶
NewQuoteAttributes initializes a new map of attributes for a verse paragraph
func None ¶
func None(content []interface{}) ([]interface{}, error)
None returns the content as-is, but nil-safe
func ResetFootnoteSequence ¶
func ResetFootnoteSequence()
ResetFootnoteSequence resets the footnote sequence (for test purpose only)
func Verbatim ¶
func Verbatim(content []interface{}) ([]interface{}, error)
Verbatim the verbatim substitution: the given content is converted into an array of strings.
func WithAttributes ¶
func WithAttributes(element interface{}, attributes []interface{}) (interface{}, error)
WithAttributes set the attributes on the given elements if its type is supported, otherwise returns an error
Types ¶
type AdmonitionKind ¶
type AdmonitionKind string
AdmonitionKind the type of admonition
const ( // Tip the 'TIP' type of admonition Tip AdmonitionKind = "tip" // Note the 'NOTE' type of admonition Note AdmonitionKind = "note" // Important the 'IMPORTANT' type of admonition Important AdmonitionKind = "important" // Warning the 'WARNING' type of admonition Warning AdmonitionKind = "warning" // Caution the 'CAUTION' type of admonition Caution AdmonitionKind = "caution" // Unknown is the zero value for admonition kind Unknown AdmonitionKind = "" )
type BlankLine ¶
type BlankLine struct { }
BlankLine the structure for the empty lines, which are used to separate logical blocks
func NewBlankLine ¶
NewBlankLine initializes a new `BlankLine`
func (BlankLine) AddAttributes ¶
func (l BlankLine) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
type BulletStyle ¶
type BulletStyle string
BulletStyle the type of bullet for items in an unordered list
const ( // UnknownBulletStyle the default, unknown type UnknownBulletStyle BulletStyle = "unkwown" // Dash an unordered item can begin with a single dash Dash BulletStyle = "dash" // OneAsterisk an unordered item marked with a single asterisk OneAsterisk BulletStyle = "1asterisk" // TwoAsterisks an unordered item marked with two asterisks TwoAsterisks BulletStyle = "2asterisks" // ThreeAsterisks an unordered item marked with three asterisks ThreeAsterisks BulletStyle = "3asterisks" // FourAsterisks an unordered item marked with four asterisks FourAsterisks BulletStyle = "4asterisks" // FiveAsterisks an unordered item marked with five asterisks FiveAsterisks BulletStyle = "5asterisks" )
type ContinuedListElement ¶ added in v0.2.0
type ContinuedListElement struct { Offset int // the relative ancestor. Should be a negative number Element interface{} }
ContinuedListElement a wrapper for an element which should be attached to a list item (same level or an ancestor)
func NewContinuedListElement ¶ added in v0.2.0
func NewContinuedListElement(offset int, element interface{}) (ContinuedListElement, error)
NewContinuedListElement returns a wrapper for an element which should be attached to a list item (same level or an ancestor)
type CrossReference ¶
CrossReference the struct for Cross References
func NewCrossReference ¶
func NewCrossReference(id string, label interface{}) (CrossReference, error)
NewCrossReference initializes a new `CrossReference` from the given ID
type DefaultAttribute ¶
type DefaultAttribute func(map[string]interface{})
DefaultAttribute a function to specify a default attribute
func WithNumberingStyle ¶
func WithNumberingStyle(t NumberingStyle) DefaultAttribute
WithNumberingStyle specifies the numbering type in an OrderedList
type DelimitedBlock ¶
type DelimitedBlock struct { Kind BlockKind Attributes ElementAttributes Elements []interface{} }
DelimitedBlock the structure for the delimited blocks
func NewDelimitedBlock ¶
func NewDelimitedBlock(kind BlockKind, content []interface{}, substitution Substitution) (DelimitedBlock, error)
NewDelimitedBlock initializes a new `DelimitedBlock` of the given kind with the given content
func (*DelimitedBlock) AddAttributes ¶
func (b *DelimitedBlock) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
type Document ¶
type Document struct { Attributes DocumentAttributes Elements []interface{} ElementReferences ElementReferences Footnotes Footnotes FootnoteReferences FootnoteReferences }
Document the top-level structure for a document
func NewDocument ¶
NewDocument initializes a new `Document` from the given lines
type DocumentAttributeDeclaration ¶
DocumentAttributeDeclaration the type for Document Attribute Declarations
func NewDocumentAttributeDeclaration ¶
func NewDocumentAttributeDeclaration(name string, value interface{}) (DocumentAttributeDeclaration, error)
NewDocumentAttributeDeclaration initializes a new DocumentAttributeDeclaration with the given name and optional value
func (DocumentAttributeDeclaration) AddAttributes ¶
func (d DocumentAttributeDeclaration) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
type DocumentAttributeReset ¶
type DocumentAttributeReset struct {
Name string
}
DocumentAttributeReset the type for DocumentAttributeReset
func NewDocumentAttributeReset ¶
func NewDocumentAttributeReset(attrName string) (DocumentAttributeReset, error)
NewDocumentAttributeReset initializes a new Document Attribute Resets.
func (DocumentAttributeReset) AddAttributes ¶
func (r DocumentAttributeReset) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
type DocumentAttributeSubstitution ¶
type DocumentAttributeSubstitution struct {
Name string
}
DocumentAttributeSubstitution the type for DocumentAttributeSubstitution
func NewDocumentAttributeSubstitution ¶
func NewDocumentAttributeSubstitution(attrName string) (DocumentAttributeSubstitution, error)
NewDocumentAttributeSubstitution initializes a new Document Attribute Substitutions
type DocumentAttributes ¶
type DocumentAttributes map[string]interface{}
DocumentAttributes the document attributes
func (DocumentAttributes) Add ¶
func (a DocumentAttributes) Add(key string, value interface{}) DocumentAttributes
Add adds the given attribute if its value is non-nil TODO: raise a warning if there was already a name/value
func (DocumentAttributes) AddAll ¶ added in v0.2.0
func (a DocumentAttributes) AddAll(attrs DocumentAttributes) DocumentAttributes
AddAll adds the given attributes
func (DocumentAttributes) AddDeclaration ¶ added in v0.2.0
func (a DocumentAttributes) AddDeclaration(attr DocumentAttributeDeclaration)
AddDeclaration adds the given attribute TODO: raise a warning if there was already a name/value
func (DocumentAttributes) AddNonEmpty ¶
func (a DocumentAttributes) AddNonEmpty(key string, value interface{})
AddNonEmpty adds the given attribute if its value is non-nil and non-empty TODO: raise a warning if there was already a name/value
func (DocumentAttributes) GetAsString ¶
func (a DocumentAttributes) GetAsString(key string) string
GetAsString gets the string value for the given key, or nil if none was found
func (DocumentAttributes) GetTOCLevels ¶
func (a DocumentAttributes) GetTOCLevels() (*int, error)
GetTOCLevels returns the value of the `toclevels` attribute if it was specified, or `2` as the default value
func (DocumentAttributes) GetTitle ¶
func (a DocumentAttributes) GetTitle() (SectionTitle, error)
GetTitle retrieves the document title in its metadata, or returns nil if the title was not specified
func (DocumentAttributes) Has ¶
func (a DocumentAttributes) Has(key string) bool
Has returns the true if an entry with the given key exists
func (DocumentAttributes) HasAuthors ¶
func (a DocumentAttributes) HasAuthors() bool
HasAuthors returns `true` if the document has one or more authors, `false` otherwise.
func (DocumentAttributes) HasTitle ¶ added in v0.2.0
func (a DocumentAttributes) HasTitle() bool
HasTitle returns `true` if the document has a title, ie, a section with level = 0
func (DocumentAttributes) Reset ¶
func (a DocumentAttributes) Reset(attr DocumentAttributeReset)
Reset resets the given attribute
type DocumentAuthor ¶
type DocumentAuthor struct { FullName string Initials string FirstName string MiddleName string LastName string Email string }
DocumentAuthor a document author
func NewDocumentAuthor ¶
func NewDocumentAuthor(namePart1, namePart2, namePart3, emailAddress interface{}) (DocumentAuthor, error)
NewDocumentAuthor initializes a new DocumentAuthor
func NewDocumentAuthors ¶
func NewDocumentAuthors(authors []interface{}) ([]DocumentAuthor, error)
NewDocumentAuthors converts the given authors into an array of `DocumentAuthor`
func (*DocumentAuthor) String ¶
func (a *DocumentAuthor) String() string
type DocumentHeader ¶
type DocumentHeader struct {
Content DocumentAttributes
}
DocumentHeader the document header
func NewDocumentHeader ¶
func NewDocumentHeader(header, authors, revision interface{}, otherAttributes []interface{}) (DocumentHeader, error)
NewDocumentHeader initializes a new DocumentHeader
type DocumentRevision ¶
DocumentRevision a document revision
func NewDocumentRevision ¶
func NewDocumentRevision(revnumber, revdate, revremark interface{}) (DocumentRevision, error)
NewDocumentRevision intializes a new DocumentRevision
func (DocumentRevision) String ¶
func (r DocumentRevision) String() string
type ElementAttributes ¶
type ElementAttributes map[string]interface{}
ElementAttributes is a map[string]interface{} with some utility methods
func NewAdmonitionAttribute ¶
func NewAdmonitionAttribute(k AdmonitionKind) (ElementAttributes, error)
NewAdmonitionAttribute initializes a new attribute map with a single entry for the admonition kind using the given value
func NewAttributeGroup ¶
func NewAttributeGroup(attributes []interface{}) (ElementAttributes, error)
NewAttributeGroup initializes a group of attributes from the given generic attributes.
func NewElementAttributes ¶
func NewElementAttributes(attributes []interface{}, extras ...ElementAttributes) ElementAttributes
NewElementAttributes retrieves the ElementID, ElementTitle and ElementInlineLink from the given slice of attributes
func NewElementID ¶
func NewElementID(id string) (ElementAttributes, error)
NewElementID initializes a new attribute map with a single entry for the ID using the given value
func NewElementRole ¶
func NewElementRole(role string) (ElementAttributes, error)
NewElementRole initializes a new attribute map with a single entry for the title using the given value
func NewElementTitle ¶
func NewElementTitle(title string) (ElementAttributes, error)
NewElementTitle initializes a new attribute map with a single entry for the title using the given value
func NewGenericAttribute ¶
func NewGenericAttribute(key string, value interface{}) (ElementAttributes, error)
NewGenericAttribute initializes a new ElementAttribute from the given key and optional value
func NewImageAttributes ¶
func NewImageAttributes(alt, width, height interface{}, otherattrs []interface{}) (ElementAttributes, error)
NewImageAttributes returns a map of image attributes, some of which have implicit keys (`alt`, `width` and `height`)
func NewInlineElementID ¶
func NewInlineElementID(id string) (ElementAttributes, error)
NewInlineElementID initializes a new attribute map with a single entry for the ID using the given value
func NewInlineLinkAttributes ¶
func NewInlineLinkAttributes(text interface{}, otherattrs []interface{}) (ElementAttributes, error)
NewInlineLinkAttributes returns a map of image attributes, some of which have implicit keys (`text`)
func NewLiteralAttribute ¶
func NewLiteralAttribute() (ElementAttributes, error)
NewLiteralAttribute initializes a new attribute map with a single entry for the literal kind of block
func NewSourceAttributes ¶
func NewSourceAttributes(language string) (ElementAttributes, error)
NewSourceAttributes initializes a new attribute map with two entries, one for the kind of element ("source") and another optional one for the language of the source code
func (ElementAttributes) AddAll ¶
func (a ElementAttributes) AddAll(attributes ElementAttributes)
AddAll adds all the given attributes to the current ones
func (ElementAttributes) GetAsBool ¶ added in v0.2.0
func (a ElementAttributes) GetAsBool(key string) bool
GetAsBool returns the value of the key as a bool, or `false` if the key did not exist or if its value was not a bool
func (ElementAttributes) GetAsString ¶
func (a ElementAttributes) GetAsString(key string) string
GetAsString returns the value of the key as a string, or empty string if the key did not exist
func (ElementAttributes) Has ¶
func (a ElementAttributes) Has(key string) bool
Has returns the true if an entry with the given key exists
type ElementReferences ¶
type ElementReferences map[string]interface{}
ElementReferences the element references in the document
type ElementReferencesCollector ¶
type ElementReferencesCollector struct {
ElementReferences ElementReferences
}
ElementReferencesCollector the visitor that traverses the whole document structure in search for elements with an ID
func NewElementReferencesCollector ¶
func NewElementReferencesCollector() *ElementReferencesCollector
NewElementReferencesCollector initializes a new ElementReferencesCollector
func (*ElementReferencesCollector) Visit ¶
func (c *ElementReferencesCollector) Visit(element Visitable) error
Visit Implements Visitable#Visit()
type ElementWithAttributes ¶ added in v0.2.0
type ElementWithAttributes interface {
AddAttributes(attributes ElementAttributes)
}
ElementWithAttributes an element on which attributes can be added/set
type Footnote ¶
type Footnote struct { ID int // Ref the optional reference Ref string // the footnote content (can be "rich") Elements InlineElements }
Footnote a foot note, without or without explicit reference (an explicit reference is used to refer multiple times to the same footnote across the document)
func NewFootnote ¶
func NewFootnote(ref string, elements InlineElements) (Footnote, error)
NewFootnote returns a new Footnote with the given content
type FootnoteReferences ¶
FootnoteReferences some footnote have a ref to be re-used in the document
type Footnotes ¶
type Footnotes []Footnote
Footnotes the footnotes of a document. Footnotes are "collected" during the parsing phase and displayed at the bottom of the document during the rendering.
type FootnotesCollector ¶
type FootnotesCollector struct { Footnotes Footnotes FootnoteReferences FootnoteReferences }
FootnotesCollector the visitor that traverses the whole document structure in search for footnotes
func NewFootnotesCollector ¶
func NewFootnotesCollector() *FootnotesCollector
NewFootnotesCollector initializes a new FootnotesCollector
func (*FootnotesCollector) Visit ¶
func (c *FootnotesCollector) Visit(element Visitable) error
Visit Implements Visitable#Visit()
type FrontMatter ¶
type FrontMatter struct {
Content map[string]interface{}
}
FrontMatter the structure for document front-matter
func NewYamlFrontMatter ¶
func NewYamlFrontMatter(content string) (FrontMatter, error)
NewYamlFrontMatter initializes a new FrontMatter from the given `content`
type ImageBlock ¶
type ImageBlock struct { Path string Attributes ElementAttributes }
ImageBlock the structure for the block images
func NewImageBlock ¶
func NewImageBlock(path string, inlineAttributes ElementAttributes) (ImageBlock, error)
NewImageBlock initializes a new `ImageBlock`
func (ImageBlock) AddAttributes ¶
func (i ImageBlock) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
type InlineElements ¶
type InlineElements []interface{}
InlineElements the structure for the lines in paragraphs
func NewInlineElements ¶
func NewInlineElements(elements ...interface{}) (InlineElements, error)
NewInlineElements initializes a new `InlineElements` from the given values
func (InlineElements) Accept ¶
func (e InlineElements) Accept(v Visitor) error
Accept implements Visitable#Accept(Visitor)
type InlineImage ¶
type InlineImage struct { Path string Attributes ElementAttributes }
InlineImage the structure for the inline image macros
func NewInlineImage ¶
func NewInlineImage(path string, attributes ElementAttributes) (InlineImage, error)
NewInlineImage initializes a new `InlineImage` (similar to ImageBlock, but without attributes)
type InlineLink ¶
type InlineLink struct { URL string Attributes ElementAttributes }
InlineLink the structure for the external links
func NewInlineLink ¶
func NewInlineLink(url string, attributes interface{}) (InlineLink, error)
NewInlineLink initializes a new inline `InlineLink`
func (InlineLink) Text ¶
func (l InlineLink) Text() string
Text returns the `text` value for the InlineLink,
type LabeledList ¶
type LabeledList struct { Attributes ElementAttributes Items []LabeledListItem }
LabeledList the structure for the Labeled Lists
func (LabeledList) AddAttributes ¶
func (l LabeledList) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
func (LabeledList) GetItems ¶ added in v0.2.0
func (l LabeledList) GetItems() []ListItem
GetItems returns the items of this list
type LabeledListItem ¶
type LabeledListItem struct { Term string Level int Attributes ElementAttributes Elements []interface{} }
LabeledListItem an item in a labeled
func NewLabeledListItem ¶
func NewLabeledListItem(level int, term string, elements []interface{}) (LabeledListItem, error)
NewLabeledListItem initializes a new LabeledListItem
func (*LabeledListItem) AddAttributes ¶
func (i *LabeledListItem) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
func (*LabeledListItem) AddElement ¶ added in v0.2.0
func (i *LabeledListItem) AddElement(element interface{})
AddElement add an element to this LabeledListItem
func (LabeledListItem) GetElements ¶ added in v0.2.0
func (i LabeledListItem) GetElements() []interface{}
GetElements returns the elements of this LabeledListItem
func (*LabeledListItem) SetElements ¶ added in v0.2.0
func (i *LabeledListItem) SetElements(elements []interface{})
SetElements set the elements of this LabeledListItem
type LineBreak ¶
type LineBreak struct{}
LineBreak an explicit line break in a paragraph
func NewLineBreak ¶
NewLineBreak returns a new line break, that's all.
type List ¶
type List interface { GetItems() []ListItem // contains filtered or unexported methods }
List a list
type ListItem ¶
type ListItem interface { GetElements() []interface{} AddElement(interface{}) SetElements([]interface{}) // contains filtered or unexported methods }
ListItem a list item
type LiteralBlock ¶
type LiteralBlock struct { Attributes ElementAttributes Lines []string }
LiteralBlock the structure for the literal blocks
func NewLiteralBlock ¶
func NewLiteralBlock(origin string, lines []interface{}, attributes ...interface{}) (LiteralBlock, error)
NewLiteralBlock initializes a new `DelimitedBlock` of the given kind with the given content, along with the given sectionTitle spaces
func (LiteralBlock) AddAttributes ¶
func (b LiteralBlock) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
type NormalizationFunc ¶
NormalizationFunc a function that is used to normalize a string.
type NumberingStyle ¶
type NumberingStyle string
NumberingStyle the type of numbering for items in an ordered list
const ( // UnknownNumberingStyle the default, unknown type UnknownNumberingStyle NumberingStyle = "unknown" // Arabic the arabic numbering (1, 2, 3, etc.) Arabic NumberingStyle = "arabic" // Decimal the decimal numbering (01, 02, 03, etc.) Decimal NumberingStyle = "decimal" // LowerAlpha the lower-alpha numbering (a, b, c, etc.) LowerAlpha NumberingStyle = "loweralpha" // UpperAlpha the upper-alpha numbering (A, B, C, etc.) UpperAlpha NumberingStyle = "upperalpha" // LowerRoman the lower-roman numbering (i, ii, iii, etc.) LowerRoman NumberingStyle = "lowerroman" // UpperRoman the upper-roman numbering (I, II, III, etc.) UpperRoman NumberingStyle = "upperroman" // LowerGreek the lower-greek numbering (alpha, beta, etc.) LowerGreek NumberingStyle = "lowergreek" // UpperGreek the upper-roman numbering (Alpha, Beta, etc.) UpperGreek NumberingStyle = "uppergreek" )
type OrderedList ¶
type OrderedList struct { Attributes ElementAttributes Items []OrderedListItem }
OrderedList the structure for the Ordered Lists
func (OrderedList) AddAttributes ¶
func (l OrderedList) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
func (OrderedList) GetItems ¶ added in v0.2.0
func (l OrderedList) GetItems() []ListItem
GetItems returns the items of this list
type OrderedListItem ¶
type OrderedListItem struct { Attributes ElementAttributes Level int Position int NumberingStyle NumberingStyle Elements []interface{} }
OrderedListItem the structure for the ordered list items
func NewOrderedListItem ¶
func NewOrderedListItem(prefix OrderedListItemPrefix, elements []interface{}) (OrderedListItem, error)
NewOrderedListItem initializes a new `orderedListItem` from the given content
func (*OrderedListItem) AddAttributes ¶
func (i *OrderedListItem) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
func (*OrderedListItem) AddElement ¶ added in v0.2.0
func (i *OrderedListItem) AddElement(element interface{})
AddElement add an element to this OrderedListItem
func (OrderedListItem) GetElements ¶ added in v0.2.0
func (i OrderedListItem) GetElements() []interface{}
GetElements returns the elements of this OrderedListItem
func (*OrderedListItem) SetElements ¶ added in v0.2.0
func (i *OrderedListItem) SetElements(elements []interface{})
SetElements set the elements of this OrderedListItem
type OrderedListItemPrefix ¶
type OrderedListItemPrefix struct { NumberingStyle NumberingStyle Level int }
OrderedListItemPrefix the prefix used to construct an OrderedListItem
func NewOrderedListItemPrefix ¶
func NewOrderedListItemPrefix(s NumberingStyle, l int) (OrderedListItemPrefix, error)
NewOrderedListItemPrefix initializes a new OrderedListItemPrefix
type Paragraph ¶
type Paragraph struct { Attributes ElementAttributes Lines []InlineElements }
Paragraph the structure for the paragraphs
func NewAdmonitionParagraph ¶
func NewAdmonitionParagraph(lines []interface{}, admonitionKind AdmonitionKind, attributes ...interface{}) (Paragraph, error)
NewAdmonitionParagraph returns a new Paragraph with an extra admonition attribute
func NewParagraph ¶
NewParagraph initializes a new `Paragraph`
func (Paragraph) AddAttributes ¶
func (p Paragraph) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
type Passthrough ¶
type Passthrough struct { Kind PassthroughKind Elements InlineElements }
Passthrough the structure for Passthroughs
func NewPassthrough ¶
func NewPassthrough(kind PassthroughKind, elements []interface{}) (Passthrough, error)
NewPassthrough returns a new passthrough
type PassthroughKind ¶
type PassthroughKind int
PassthroughKind the kind of passthrough
const ( // SinglePlusPassthrough a passthrough with a single `+` punctuation SinglePlusPassthrough PassthroughKind = iota // TriplePlusPassthrough a passthrough with a triple `+++` punctuation TriplePlusPassthrough // PassthroughMacro a passthrough with the `pass:[]` macro PassthroughMacro )
type Preamble ¶
type Preamble struct {
Elements []interface{}
}
Preamble the structure for document Preamble
type QuotedText ¶
type QuotedText struct { Kind QuotedTextKind Elements InlineElements }
QuotedText the structure for quoted text
func NewQuotedText ¶
func NewQuotedText(kind QuotedTextKind, content []interface{}) (QuotedText, error)
NewQuotedText initializes a new `QuotedText` from the given kind and content
func (QuotedText) Accept ¶
func (t QuotedText) Accept(v Visitor) error
Accept implements Visitable#Accept(Visitor)
type QuotedTextKind ¶
type QuotedTextKind int
QuotedTextKind the type for
const ( // Bold bold quoted text (wrapped with '*' or '**') Bold QuotedTextKind = iota // Italic italic quoted text (wrapped with '_' or '__') Italic // Monospace monospace quoted text (wrapped with '`' or '“') Monospace // Subscript subscript quoted text (wrapped with '~' or '~~') Subscript // Superscript superscript quoted text (wrapped with '^' or '^^') Superscript )
type Section ¶
type Section struct { Level int Title SectionTitle Elements []interface{} }
Section the structure for a section
func NewSection ¶
func NewSection(level int, sectionTitle SectionTitle, blocks []interface{}) (Section, error)
NewSection initializes a new `Section` from the given section title and elements
func (Section) AddAttributes ¶
func (s Section) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
type SectionTitle ¶
type SectionTitle struct { Attributes ElementAttributes Elements InlineElements }
SectionTitle the structure for the section titles
func NewSectionTitle ¶
func NewSectionTitle(elements InlineElements, ids []interface{}) (SectionTitle, error)
NewSectionTitle initializes a new `SectionTitle“ from the given level and content, with the optional attributes. In the attributes, only the ElementID is retained
func (SectionTitle) Accept ¶
func (st SectionTitle) Accept(v Visitor) error
Accept implements Visitable#Accept(Visitor)
func (SectionTitle) AddAttributes ¶
func (st SectionTitle) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
type SingleLineComment ¶
type SingleLineComment struct {
Content string
}
SingleLineComment a single line comment
func NewSingleLineComment ¶
func NewSingleLineComment(content string) (SingleLineComment, error)
NewSingleLineComment initializes a new single line content
func (SingleLineComment) AddAttributes ¶ added in v0.2.0
func (l SingleLineComment) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
type StringElement ¶
type StringElement struct {
Content string
}
StringElement the structure for strings
func NewStringElement ¶
func NewStringElement(content string) StringElement
NewStringElement initializes a new `StringElement` from the given content
func (StringElement) Accept ¶
func (s StringElement) Accept(v Visitor) error
Accept implements Visitable#Accept(Visitor)
type Substitution ¶
type Substitution func([]interface{}) ([]interface{}, error)
Substitution the substitution group to apply when initializing a delimited block
type Table ¶
type Table struct { Attributes ElementAttributes Header TableLine Lines []TableLine }
Table the structure for the tables
func (Table) AddAttributes ¶
func (t Table) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
type TableLine ¶
type TableLine struct {
Cells []InlineElements
}
TableLine a table line is made of columns, each column being a group of InlineElements (to support quoted text, etc.)
func NewTableLine ¶
NewTableLine initializes a new TableLine with the given columns
type TableOfContentsMacro ¶
type TableOfContentsMacro struct { }
TableOfContentsMacro the structure for Table of Contents
func (TableOfContentsMacro) AddAttributes ¶
func (m TableOfContentsMacro) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
type UnorderedList ¶
type UnorderedList struct { Attributes ElementAttributes Items []UnorderedListItem }
UnorderedList the structure for the Unordered Lists
func (UnorderedList) AddAttributes ¶
func (l UnorderedList) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
func (UnorderedList) GetItems ¶ added in v0.2.0
func (l UnorderedList) GetItems() []ListItem
GetItems returns the items of this list
type UnorderedListItem ¶
type UnorderedListItem struct { Level int BulletStyle BulletStyle CheckStyle UnorderedListItemCheckStyle Attributes ElementAttributes Elements []interface{} }
UnorderedListItem the structure for the unordered list items
func NewUnorderedListItem ¶
func NewUnorderedListItem(prefix UnorderedListItemPrefix, checkstyle interface{}, elements []interface{}) (UnorderedListItem, error)
NewUnorderedListItem initializes a new `UnorderedListItem` from the given content
func (*UnorderedListItem) AddAttributes ¶
func (i *UnorderedListItem) AddAttributes(attributes ElementAttributes)
AddAttributes adds all given attributes to the current set of attribute of the element
func (*UnorderedListItem) AddElement ¶ added in v0.2.0
func (i *UnorderedListItem) AddElement(element interface{})
AddElement add an element to this UnorderedListItem
func (UnorderedListItem) GetElements ¶ added in v0.2.0
func (i UnorderedListItem) GetElements() []interface{}
GetElements returns the elements of this UnorderedListItem
func (*UnorderedListItem) SetElements ¶ added in v0.2.0
func (i *UnorderedListItem) SetElements(elements []interface{})
SetElements set the elements of this UnorderedListItem
type UnorderedListItemCheckStyle ¶ added in v0.2.0
type UnorderedListItemCheckStyle string
UnorderedListItemCheckStyle the check style that applies on an unordered list item
const ( // Checked when the unordered list item is checked Checked UnorderedListItemCheckStyle = "checked" // Unchecked when the unordered list item is not checked Unchecked UnorderedListItemCheckStyle = "unchecked" // NoCheck when the unodered list item has no specific check annotation NoCheck UnorderedListItemCheckStyle = "nocheck" )
type UnorderedListItemPrefix ¶
type UnorderedListItemPrefix struct { BulletStyle BulletStyle Level int }
UnorderedListItemPrefix the prefix used to construct an UnorderedListItem
func NewUnorderedListItemPrefix ¶
func NewUnorderedListItemPrefix(s BulletStyle, l int) (UnorderedListItemPrefix, error)
NewUnorderedListItemPrefix initializes a new UnorderedListItemPrefix