blocktags

package
v0.0.0-...-a7c1438 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClosingBlockTagRe = regexp.MustCompile(`^{/([a-z]+)}`)
View Source
var DefaultTags = []*TagDef{
	{
		Name:              "cut",
		AllowedParentTags: nil,
	},
	{
		Name:              "spoiler",
		AllowedParentTags: []string{"cut"},
	},
	{
		Name:              "gallery",
		AllowedParentTags: []string{"spoiler", "cut"},
	},
}
View Source
var KindBlockTag = ast.NewNodeKind("BlockTag")
View Source
var OpeningBlockTagRe = regexp.MustCompile(`^{([a-z]+)(\s+([^}]+))?}`)

Functions

func NewBlockTagExtender

func NewBlockTagExtender(view types.HTMLView, link types.Link) goldmark.Extender

NewBlockTag creates a new goldmark.Extender that allow you to parse text that seems like a @userblockTag

func NewBlockTagParser

func NewBlockTagParser(allowed []*TagDef) *blockTagParser

func NewBlockTagRenderer

func NewBlockTagRenderer(view types.HTMLView, link types.Link, opts ...html.Option) renderer.NodeRenderer

func NewGalleryTransformer

func NewGalleryTransformer() *galleryTransformer

Types

type BlockTag

type BlockTag struct {
	ast.BaseBlock
	BlockTagName string
	BlockTitle   string
}

func NewBlockTag

func NewBlockTag(name string, title string) *BlockTag

func (*BlockTag) Dump

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

func (*BlockTag) Kind

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

type BlockTagRenderer

type BlockTagRenderer struct {
	html.Config
	// contains filtered or unexported fields
}

func (*BlockTagRenderer) RegisterFuncs

type DefMap

type DefMap map[string]*TagDef

func (DefMap) GetTag

func (dm DefMap) GetTag(name string) *TagDef

type TagDef

type TagDef struct {
	Name              string
	AllowedParentTags []string
}

Jump to

Keyboard shortcuts

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