parser

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document interface {
	// ListLinks iterates parsed links in this document
	// and invokes cb on every link
	ListLinks(cb OnLinkListed)
	// Bytes returns the  parsed document content bytes
	Bytes() []byte
}

Document is the markdown model parsed from bytes data

type Link interface {
	SetText(text []byte)
	SetDestination(text []byte)
	SetTitle(text []byte)
	GetText() []byte
	GetDestination() []byte
	GetTitle() []byte
	Remove(leaveText bool)
	IsImage() bool
	IsAutoLink() bool
	IsNormalLink() bool
}

Link is a markdown link which can be a normal link or an embedded image reference

type OnLinkListed

type OnLinkListed func(link Link)

OnLinkListed is a callback function invoked by the ListLinks iterator in Document

type Parser

type Parser interface {
	Parse(data []byte) Document
}

Parser is the interface for parsing data into Document

func NewParser

func NewParser() Parser

NewParser creates Parser objects

Jump to

Keyboard shortcuts

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