parser

package
v0.0.0-...-1bfbc23 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bold

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

<strong></strong>, bold text

func (Bold) String

func (p Bold) String() string

type Br

type Br struct{}

func (Br) String

func (p Br) String() string

type CodeBlock

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

<pre><code></code></pre>, contains plaintext and whitespaces, which MUST to be respec

func (CodeBlock) String

func (p CodeBlock) String() string

type CodeInline

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

<code></code>, inline code element, contains plain text

func (CodeInline) String

func (p CodeInline) String() string

type Heading

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

any of h1,h2,h3,h4,h5,h6, suffix is denoted using the lvl field

func (Heading) String

func (p Heading) String() string

type Highlight

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

func (Highlight) String

func (p Highlight) String() string

type Image

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

<img src="" alt="">, image with alt and src

func (Image) String

func (p Image) String() string

type Italic

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

<em></em>, italic text

func (Italic) String

func (p Italic) String() string
type Link struct {
	// contains filtered or unexported fields
}

<a href=""></a>, anchor with href and title

func (Link) String

func (p Link) String() string

type List

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

<ul></ul>, contains ListItem

func (List) String

func (p List) String() string

type ListItem

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

<li></li>, can contain almost everything else

func (ListItem) String

func (p ListItem) String() string

type Paragraph

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

<p></p> html paragraph

func (Paragraph) String

func (p Paragraph) String() string

type Parser

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

func New

func New(tokens []scanner.Token) Parser

creates a new instance of Parser

func (*Parser) GenerateToc

func (p *Parser) GenerateToc() string

generates a toc, but only if '--toc' is specified, by default only generates the toc out of headings from h1 to h3. If the user specifies the '--toc-full' option the h4,h5 and h6 headings are considered.

func (*Parser) Parse

func (p *Parser) Parse() []Tag

parses the tokens passed to parser.New(), returns an array of HTML tags

type Quote

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

<blockquote></blockquote>, can contain all the other elements

func (Quote) String

func (p Quote) String() string

type Ruler

type Ruler struct{}

<hr>

func (Ruler) String

func (p Ruler) String() string

type StrikeThrough

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

func (StrikeThrough) String

func (p StrikeThrough) String() string

type Tag

type Tag interface {
	String() string
}

generic interface, allows us to return nil and all the implementing structs in the parser

type Text

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

contains plaintext

func (Text) String

func (p Text) String() string

type TodoListItem

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

listitem but with a prefixed disabled checkmark

func (TodoListItem) String

func (p TodoListItem) String() string

Jump to

Keyboard shortcuts

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