mdfront

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mdfront adds support for rendering frontmatter to markdown for goldmark.

Index

Constants

This section is empty.

Variables

View Source
var Kind = ast.NewNodeKind("Frontmatter")

Kind is the kind of hashtag AST nodes.

Functions

func NewTransformer

func NewTransformer() parser.ASTTransformer

NewTransformer adds a blank frontmatter node for filling with data during markdown rendering.

Types

type Extender

type Extender struct{}

Extender extends a goldmark Markdown object with support for setting up a frontmatter placeholder for later rendering.

Install it on your Markdown object upon creation.

goldmark.New(
  goldmark.WithExtensions(
    // ...
    &mdfront.Extender{},
  ),
  // ...
)

func (*Extender) Extend

func (e *Extender) Extend(m goldmark.Markdown)

Extend extends the provided goldmark Markdown object with support for a placeholder for rendering frontmatter.

type Node

type Node struct {
	ast.BaseInline

	// Frontmatter is a struct with yaml tags for rendering.
	Frontmatter any
}

Node is a hashtag node in a Goldmark Markdown document.

func (*Node) Dump

func (n *Node) Dump(src []byte, level int)

Dump dumps the contents of Node to stdout for debugging.

func (*Node) IsRaw

func (*Node) IsRaw() bool

Kind reports the kind of hashtag nodes.

func (*Node) Kind

func (*Node) Kind() ast.NodeKind

Kind reports the kind of hashtag nodes.

type NoopRenderer

type NoopRenderer struct{}

NoopRenderer renders nothing for a frontmatter block, for if the AST is rendered without the mdrender.Renderer

func (*NoopRenderer) RegisterFuncs

func (r *NoopRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)

Jump to

Keyboard shortcuts

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