attributes

package
v0.123.13 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Empty = &AttributesHolder{}

Empty holds no attributes.

Functions

func RenderASTAttributes

func RenderASTAttributes(w hugio.FlexiWriter, attributes ...ast.Attribute)

RenderASTAttributes writes the AST attributes to the given as attributes to an HTML element. This is used by the default HTML renderers, e.g. for headings etc. where no hook template could be found. This performs HTML esacaping of string attributes.

func RenderAttributes

func RenderAttributes(w hugio.FlexiWriter, skipClass bool, attributes ...Attribute)

RenderAttributes Render writes the attributes to the given as attributes to an HTML element. This is used for the default codeblock rendering. This performs HTML escaping of string attributes.

Types

type Attribute

type Attribute struct {
	Name  string
	Value any
}

func (Attribute) ValueString

func (a Attribute) ValueString() string

type Attributes

type Attributes map[string]any

type AttributesHolder

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

func New

func New(astAttributes []ast.Attribute, ownerType AttributesOwnerType) *AttributesHolder

func (*AttributesHolder) Attributes

func (a *AttributesHolder) Attributes() map[string]any

func (*AttributesHolder) AttributesSlice

func (a *AttributesHolder) AttributesSlice() []Attribute

func (*AttributesHolder) Options

func (a *AttributesHolder) Options() map[string]any

func (*AttributesHolder) OptionsSlice

func (a *AttributesHolder) OptionsSlice() []Attribute

type AttributesOwnerType

type AttributesOwnerType int
const (
	AttributesOwnerGeneral AttributesOwnerType = iota
	AttributesOwnerCodeBlockChroma
	AttributesOwnerCodeBlockCustom
)

Jump to

Keyboard shortcuts

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