Documentation
¶
Index ¶
- Constants
- Variables
- func NewGnoParserContext(url *weburl.GnoURL) parser.Context
- func ParseHTMLTokens(r io.Reader) ([]html.Token, error)
- type GenFunc
- type GnoColumnNode
- type GnoColumnTag
- type GnoExtension
- type GnoLink
- type GnoLinkType
- type GoldenTests
- type ImageValidatorFunc
- type Option
- type Toc
- type TocItem
- type TocOptions
Constants ¶
const MaxDepth = 6
Variables ¶
var ( KindGnoColumn = ast.NewNodeKind("GnoColumn") GnoColumnsShorthand = []byte("|||") // shorthand for column separator )
var ErrLinkInvalidURL = errors.New("invalid URL format")
Error messages for invalid link formats
var ExtColumns = &columns{}
ExtColumns instance for extending markdown with column functionality.
var ExtImageValidator = &imgValidatorExtension{}
ExtImageValidator is a Goldmark extension that pre validation on image URLs.
var ExtLinks = &linkExtension{}
ExtLinks instance for extending markdown with link functionality
var KindGnoLink = ast.NewNodeKind("GnoLink")
Functions ¶
func NewGnoParserContext ¶
NewGnoParserContext creates a new parser context with GnoURL
Types ¶
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) 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 GnoExtension ¶
type GnoExtension struct {
// contains filtered or unexported fields
}
func NewGnoExtension ¶
func NewGnoExtension(opts ...Option) *GnoExtension
func (*GnoExtension) Extend ¶
func (e *GnoExtension) Extend(m goldmark.Markdown)
Extend adds the Gno extension to the provided Goldmark markdown processor.
type GnoLink ¶
type GnoLink struct { *ast.Link LinkType GnoLinkType GnoURL *weburl.GnoURL }
GnoLink represents a link with Gno-specific metadata
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 ¶
func NewGoldentTests ¶
func NewGoldentTests(exec GenFunc) *GoldenTests
type ImageValidatorFunc ¶
ImageValidatorFunc validates image URLs. It should return `true` for any valid image URL.
type Option ¶
type Option func(cfg *config)
func WithImageValidator ¶
func WithImageValidator(valFunc ImageValidatorFunc) Option
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 }
type TocOptions ¶
type TocOptions struct {
MinDepth, MaxDepth int
}