common

package
v0.0.0-...-c7a0b58 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FootnoteExtension = &footnoteExtension{}

FootnoteExtension represents the Gitea Footnote

View Source
var GlobalVars = sync.OnceValue[*GlobalVarsType](func() *GlobalVarsType {
	v := &GlobalVarsType{}
	v.wwwURLRegxp = regexp.MustCompile(`^www\.[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}((?:/|[#?])[-a-zA-Z0-9@:%_\+.~#!?&//=\(\);,'">\^{}\[\]` + "`" + `]*)?`)
	v.LinkRegex, _ = xurls.StrictMatchingScheme("https?://")
	return v
})
View Source
var KindFootnote = ast.NewNodeKind("GiteaFootnote")

KindFootnote is a NodeKind of the Footnote node.

View Source
var KindFootnoteBackLink = ast.NewNodeKind("GiteaFootnoteBackLink")

KindFootnoteBackLink is a NodeKind of the FootnoteBackLink node.

View Source
var KindFootnoteLink = ast.NewNodeKind("GiteaFootnoteLink")

KindFootnoteLink is a NodeKind of the FootnoteLink node.

View Source
var KindFootnoteList = ast.NewNodeKind("GiteaFootnoteList")

KindFootnoteList is a NodeKind of the FootnoteList node.

View Source
var Linkify = &linkify{}

Linkify is an extension that allow you to parse text that seems like a URL.

Functions

func CleanValue

func CleanValue(value []byte) []byte

CleanValue will clean a value to make it safe to be an id This function is quite different from the original goldmark function and more closely matches the output from the shurcooL sanitizer In particular Unicode letters and numbers are a lot more than a-zA-Z0-9...

func NewFootnoteASTTransformer

func NewFootnoteASTTransformer() parser.ASTTransformer

NewFootnoteASTTransformer returns a new parser.ASTTransformer that insert a footnote list to the last of the document.

func NewFootnoteBlockParser

func NewFootnoteBlockParser() parser.BlockParser

NewFootnoteBlockParser returns a new parser.BlockParser that can parse footnotes of the Markdown(PHP Markdown Extra) text.

func NewFootnoteHTMLRenderer

func NewFootnoteHTMLRenderer(opts ...html.Option) renderer.NodeRenderer

NewFootnoteHTMLRenderer returns a new FootnoteHTMLRenderer.

func NewFootnoteParser

func NewFootnoteParser() parser.InlineParser

NewFootnoteParser returns a new parser.InlineParser that can parse footnote links of the Markdown(PHP Markdown Extra) text.

func NewLinkifyParser

func NewLinkifyParser() parser.InlineParser

NewLinkifyParser return a new InlineParser can parse text that seems like a URL.

Types

type Footnote

type Footnote struct {
	ast.BaseBlock
	Ref   []byte
	Index int
	Name  []byte
}

A Footnote struct represents a footnote of Markdown (PHP Markdown Extra) text.

func NewFootnote

func NewFootnote(ref []byte) *Footnote

NewFootnote returns a new Footnote node.

func (*Footnote) Dump

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

Dump implements Node.Dump.

func (*Footnote) Kind

func (n *Footnote) Kind() ast.NodeKind

Kind implements Node.Kind.

type FootnoteBackLink struct {
	ast.BaseInline
	Index int
	Name  []byte
}

A FootnoteBackLink struct represents a link to a footnote of Markdown (PHP Markdown Extra) text.

func NewFootnoteBackLink(index int, name []byte) *FootnoteBackLink

NewFootnoteBackLink returns a new FootnoteBackLink node.

func (*FootnoteBackLink) Dump

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

Dump implements Node.Dump.

func (*FootnoteBackLink) Kind

func (n *FootnoteBackLink) Kind() ast.NodeKind

Kind implements Node.Kind.

type FootnoteHTMLRenderer

type FootnoteHTMLRenderer struct {
	html.Config
}

FootnoteHTMLRenderer is a renderer.NodeRenderer implementation that renders FootnoteLink nodes.

func (*FootnoteHTMLRenderer) RegisterFuncs

RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs.

type FootnoteLink struct {
	ast.BaseInline
	Index int
	Name  []byte
}

A FootnoteLink struct represents a link to a footnote of Markdown (PHP Markdown Extra) text.

func NewFootnoteLink(index int, name []byte) *FootnoteLink

NewFootnoteLink returns a new FootnoteLink node.

func (*FootnoteLink) Dump

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

Dump implements Node.Dump.

func (*FootnoteLink) Kind

func (n *FootnoteLink) Kind() ast.NodeKind

Kind implements Node.Kind.

type FootnoteList

type FootnoteList struct {
	ast.BaseBlock
	Count int
}

A FootnoteList struct represents footnotes of Markdown (PHP Markdown Extra) text.

func NewFootnoteList

func NewFootnoteList() *FootnoteList

NewFootnoteList returns a new FootnoteList node.

func (*FootnoteList) Dump

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

Dump implements Node.Dump.

func (*FootnoteList) Kind

func (n *FootnoteList) Kind() ast.NodeKind

Kind implements Node.Kind.

type GlobalVarsType

type GlobalVarsType struct {
	LinkRegex *regexp.Regexp // fast matching a URL link, no any extra validation.
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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