Documentation ¶
Overview ¶
package meta is a extension for the goldmark(http://github.com/yuin/goldmark).
This extension parses YAML metadata blocks and store metadata to a parser.Context.
Index ¶
- Variables
- func Get(pc parser.Context) map[string]interface{}
- func GetItems(pc parser.Context) yaml.MapSlice
- func New(opts ...Option) goldmark.Extender
- func NewParser() parser.BlockParser
- func TryGet(pc parser.Context) (map[string]interface{}, error)
- func TryGetItems(pc parser.Context) (yaml.MapSlice, error)
- func Unmarshal(pc parser.Context, out interface{}) error
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ContextKeyNotExist = errors.New("context key not exist") ContextDataAssertFailed = errors.New("context data assert failed") )
View Source
var Meta = &meta{}
Meta is a extension for the goldmark.
Functions ¶
func NewParser ¶
func NewParser() parser.BlockParser
NewParser returns a BlockParser that can parse YAML metadata blocks.
func TryGet ¶
TryGet tries to get a YAML metadata. If there are YAML parsing errors, then nil and error are returned
func TryGetItems ¶
TryGetItems returns a YAML metadata. TryGetItems preserves defined key order. If there are YAML parsing errors, then nil and erro are returned.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option interface sets options for this extension.
func WithStoresInDocument ¶
func WithStoresInDocument() Option
WithStoresInDocument is a functional option that parser will store YAML meta in ast.Document.Meta().
Click to show internal directories.
Click to hide internal directories.