markdown

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const MaxDepth = 6

Variables

View Source
var (
	KindGnoColumn       = ast.NewNodeKind("GnoColumn")
	GnoColumnsShorthand = []byte("|||") // shorthand for column separator
)
View Source
var Columns = &columns{}

Columns instance for extending markdown with column functionality.

View Source
var ErrLinkInvalidURL = errors.New("invalid URL format")

Error messages for invalid link formats

View Source
var GnoExtension = &gnoExtension{}
View Source
var KindGnoLink = ast.NewNodeKind("GnoLink")
View Source
var Links = &linkExtension{}

Links instance for extending markdown with link functionality

Functions

func NewGnoParserContext

func NewGnoParserContext(url *weburl.GnoURL) parser.Context

NewGnoParserContext creates a new parser context with GnoURL

func ParseHTMLTokens

func ParseHTMLTokens(r io.Reader) ([]html.Token, error)

ParseHTMLToken parse line for tokens

Types

type GenFunc

type GenFunc func(t *testing.T, nameIn string, input []byte) (nameOut string, output []byte)

type GnoColumnNode

type GnoColumnNode struct {
	ast.BaseBlock
	Index int          // Index of the column associated with the node.
	Tag   GnoColumnTag // Current Column Tag for this node.
	// contains filtered or unexported fields
}

GnoColumnNode represents a semantic tree for a "column".

func NewColumn

func NewColumn(ctx *columnsContext, tag GnoColumnTag) *GnoColumnNode

NewColumn initializes a ColumnNode object.

func UndefinedGnoColumnNode

func UndefinedGnoColumnNode() *GnoColumnNode

func (*GnoColumnNode) Dump

func (n *GnoColumnNode) Dump(source []byte, level int)

Dump implements Node.Dump for debug representation.

func (*GnoColumnNode) IsEmptyColumns

func (n *GnoColumnNode) IsEmptyColumns() bool

func (*GnoColumnNode) Kind

func (*GnoColumnNode) Kind() ast.NodeKind

Kind implements Node.Kind.

func (*GnoColumnNode) String

func (n *GnoColumnNode) String() string

type GnoColumnTag

type GnoColumnTag int

GnoColumnTag represents the type of tag in a column block.

const (
	GnoColumnTagUndefined GnoColumnTag = iota

	GnoColumnTagOpen
	GnoColumnTagClose

	GnoColumnTagSep
)
type GnoLink struct {
	*ast.Link
	LinkType GnoLinkType
	GnoURL   *weburl.GnoURL
}

GnoLink represents a link with Gno-specific metadata

func (*GnoLink) Dump

func (n *GnoLink) Dump(source []byte, level int)

func (*GnoLink) Kind

func (*GnoLink) Kind() ast.NodeKind

Kind implements Node.Kind.

type GnoLinkType

type GnoLinkType int

GnoLinkType represents the type of a link

const (
	GnoLinkTypeInvalid GnoLinkType = iota
	GnoLinkTypeExternal
	GnoLinkTypePackage
	GnoLinkTypeInternal
)

func (GnoLinkType) String

func (t GnoLinkType) String() string

type GoldenTests

type GoldenTests struct {
	Recurse      bool
	Update       bool
	GenerateFunc GenFunc
}

func NewGoldentTests

func NewGoldentTests(exec GenFunc) *GoldenTests

func (*GoldenTests) Run

func (g *GoldenTests) Run(t *testing.T, dir string)

type Toc

type Toc struct {
	Items []*TocItem
}

func TocInspect

func TocInspect(n ast.Node, src []byte, opts TocOptions) (Toc, error)

type TocItem

type TocItem struct {
	// Title of this item in the table of contents.
	//
	// This may be blank for items that don't refer to a heading, and only
	// have sub-items.
	Title []byte

	// ID is the identifier for the heading that this item refers to. This
	// is the fragment portion of the link without the "#".
	//
	// This may be blank if the item doesn't have an id assigned to it, or
	// if it doesn't have a title.
	//
	// Enable AutoHeadingID in your parser if you expected these to be set
	// but they weren't.
	ID []byte

	// Items references children of this item.
	//
	// For a heading at level 3, Items, contains the headings at level 4
	// under that section.
	Items []*TocItem
}

func (TocItem) Anchor

func (i TocItem) Anchor() string

type TocOptions

type TocOptions struct {
	MinDepth, MaxDepth int
}

Jump to

Keyboard shortcuts

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