sectionwrapper

package module
v0.0.0-...-ac12bf5 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 7 Imported by: 0

README

Goldmark Section Wrapper Extension

[!IMPORTANT]

[DEPRECATED]

The main repository for this project has been moved to github.com/zmtcreative/gm-sectionwrapper. All future development will be done using that repository!

The new link on pkg.go.dev is github.com/zmtcreative/gm-sectionwrapper.

This is a Goldmark extension that automatically wraps headings and their content in HTML <section> elements with proper nesting. This extension transforms your Markdown document structure into semantic HTML sections, making it easier to style and navigate.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KindSection = ast.NewNodeKind("Section")

KindSection is the node kind for SectionNode

View Source
var SectionWrapper = NewSectionWrapper()

SectionWrapper is the default instance of sectionWrapper with default settings

Functions

func NewSectionWrapper added in v0.1.0

func NewSectionWrapper(options ...SectionWrapperOption) *sectionWrapper

New creates a new sectionWrapper extension with default values and optional configurations

Types

type SectionNode

type SectionNode struct {
	ast.BaseBlock
	Level int
}

SectionNode represents a <section> element in the AST

func NewSectionNode

func NewSectionNode(level int) *SectionNode

NewSectionNode creates a new SectionNode

func (*SectionNode) Dump

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

Dump dumps the SectionNode for debugging

func (*SectionNode) Kind

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

Kind returns the node kind for SectionNode

type SectionWrapperOption added in v0.1.0

type SectionWrapperOption func(*sectionWrapper)

SectionWrapperOption is a function type for configuring sectionWrapper

func WithCustomClass added in v0.1.0

func WithCustomClass(class string) SectionWrapperOption

WithCustomClass sets a custom class applied to all sections

func WithCustomClassPrefix added in v0.1.0

func WithCustomClassPrefix(prefix string) SectionWrapperOption

WithCustomClassPrefix sets a custom class prefix followed by heading level

func WithHeadingClass added in v0.1.0

func WithHeadingClass(enabled bool) SectionWrapperOption

WithHeadingClass enables h{level} classes

func WithSectionClass added in v0.1.0

func WithSectionClass(enabled bool) SectionWrapperOption

WithSectionClass enables section-h{level} classes

Jump to

Keyboard shortcuts

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