markdown

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FontmatterDelimeterYAML rune = '-'
	FrontmaterDelimeterTOML rune = '+'
	FrontmaterDelimeterCue  rune = ':'
)

Variables

View Source
var (
	DefaultLightTheme = Theme{
		Color: Palette{
			Action:     "#3a86ff",
			Heading:    "#11267",
			Text:       "#11226a",
			Link:       "#335c9c",
			BlockQuote: "#e8ecfb",
			Border:     "#335c4c",
			Table:      "#e8ecfb",
			Shadow:     "#e8ecfb",
		},
		FontFamily: "Georgia",
		FontSize:   12,
	}
)
View Source
var KindActionButton = ast.NewNodeKind("ActionButton")

Functions

func ApplyStyle added in v0.2.3

func ApplyStyle(n ast.Node, style string)

func CopyWithRelativePathPrefix added in v0.0.5

func CopyWithRelativePathPrefix(
	w io.Writer,
	source []byte,
	relativePathPrefix string,
) (err error)

func Escape added in v0.4.1

func Escape(input string) string

func GetFirstHeadingText added in v0.1.8

func GetFirstHeadingText(source []byte) (result string)

func IndexImages added in v0.4.1

func IndexImages(parser parser.Parser, source []byte) iter.Seq[InlineImage]

IndexImages finds all inline images and references that might point to an inline image in the source content.

func IsValidFontFamily added in v0.2.6

func IsValidFontFamily(ff string) bool

func NewColor added in v0.2.5

func NewColor(s string) (string, error)

func NewColorFromAny added in v0.2.5

func NewColorFromAny(v any) (string, error)

func NewParser added in v0.2.1

func NewParser(theme Theme) parser.Parser

func NewPlaintextRenderer added in v0.0.5

func NewPlaintextRenderer() renderer.Renderer

NewPlaintextRenderer creates and returns a new PlaintextRenderer instance.

func NewRendererHTML added in v0.2.1

func NewRendererHTML() renderer.Renderer

func ParseFrontmatter added in v0.0.5

func ParseFrontmatter(source []byte, delimeter rune) (frontmatter map[string]any, err error)

func SplitFrontmatterFromContent added in v0.0.5

func SplitFrontmatterFromContent(source []byte) (frontmatter, content []byte, delimeter rune, err error)

func SplitOnLastHorizontalRule added in v0.0.5

func SplitOnLastHorizontalRule(data []byte) (most, tail []byte, ok bool)

Types

type ActionButtonInjector added in v0.2.0

type ActionButtonInjector struct{}

func (*ActionButtonInjector) RegisterFuncs added in v0.2.3

func (*ActionButtonInjector) Transform added in v0.2.0

func (g *ActionButtonInjector) Transform(node *ast.Document, reader text.Reader, pc parser.Context)

type ActionButtonNode added in v0.2.0

type ActionButtonNode struct {
	ast.BaseBlock
	Link ast.Link
}

func (*ActionButtonNode) Dump added in v0.2.0

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

func (*ActionButtonNode) Kind added in v0.2.0

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

type InlineImage added in v0.4.1

type InlineImage struct {
	Title string
	Alt   string
	// Reference     string
	Location   string
	LocationAt int
}
type Link struct {
	Name        string
	Destination string
}

type Palette added in v0.2.5

type Palette struct {
	Action     string
	Heading    string
	Text       string
	Link       string
	BlockQuote string
	Border     string // thematic break, tables, code block, blockquote margin
	Table      string // table row background
	Shadow     string // blockquote, table alt row background, inline code
}

func NewPaletteFromMap added in v0.2.5

func NewPaletteFromMap(m map[string]any) (p Palette, err error)

type Theme added in v0.2.3

type Theme struct {
	Color Palette

	FontFamily string
	FontSize   uint8
}

func NewThemeFromMap added in v0.2.5

func NewThemeFromMap(m map[string]any) (t Theme, err error)

func (Theme) Transform added in v0.2.3

func (t Theme) Transform(node *ast.Document, reader text.Reader, pc parser.Context)

Jump to

Keyboard shortcuts

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