parser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2025 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFrontMatter = errors.New("invalid front matter yaml")
	// ErrItemHidden is returned when an item is hidden based on the hidden property configuration.
	ErrItemHidden = errors.New("item is hidden based on front matter property")
)

Functions

func Parse

func Parse(src sourcer.Source) (*api.Item, error)

Parse reads the content of a source and extracts the front matter and markdown content.

func ParseWithConfig

func ParseWithConfig(src sourcer.Source, config Config) (*api.Item, error)

ParseWithConfig reads the content of a source and extracts the front matter and markdown content, applying the provided configuration options.

Types

type Config

type Config struct {
	// HiddenProperty is the name of the front matter property that determines if an item is hidden.
	// If empty, no filtering based on visibility is performed.
	HiddenProperty string

	// HiddenValue determines how to interpret the hidden property value.
	// If true, truthy values (true, "true", "yes", "1", etc.) indicate the item is hidden.
	// If false, falsy values (false, "false", "no", "0", etc.) indicate the item is hidden.
	HiddenValue bool

	// ParseWikilinks determines if wikilinks should be parsed.
	ParseWikilinks bool

	// AdditionalMetadata is a map of additional metadata to be added to the item.
	AdditionalMetadata map[string]any
}

Config holds configuration options for the parser.

Jump to

Keyboard shortcuts

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