sample_mk

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 1 Imported by: 3

Documentation

Index

Constants

View Source
const (
	NodeTypeBasic = 1 + iota
	NodeTypeHeader
	NodeTypeListItem
)

Variables

This section is empty.

Functions

func Equal

func Equal(n1, n2 Node) bool

Equal compare two nodes by strings.EqualFold

func GenerateText

func GenerateText(nodes []Node) string

GenerateText return single string which represents all markdown nodes

Types

type BasicItem

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

BasicItem basic item node without any markdown-syntax

func NewBasicItem

func NewBasicItem(text string) BasicItem

NewBasicItem new basic item node

func (BasicItem) String

func (i BasicItem) String() string

func (BasicItem) Type added in v1.2.0

func (i BasicItem) Type() int
type Header struct {
	// contains filtered or unexported fields
}

Header is markdown header node

func NewHeader

func NewHeader(level int, text string) Header

NewHeader new header node

level: header level will append headerToken as '#'

func (Header) Level added in v1.3.0

func (h Header) Level() int

func (Header) String

func (h Header) String() string

Example: # Your title

func (Header) Type added in v1.2.0

func (h Header) Type() int

type ListItem

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

func NewListItem

func NewListItem(text string) ListItem

func (ListItem) String

func (i ListItem) String() string

func (ListItem) Type added in v1.2.0

func (i ListItem) Type() int

type Node

type Node interface {
	// String return string representation of node
	String() string

	// Type return type of node
	Type() int
}

Node is single markdown syntax representation Example: Header, ListItem, BasicItem ...

func Parse

func Parse(lines []string) []Node

Parse

return all markdown nodes from lines

Jump to

Keyboard shortcuts

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