plugins

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 54 Imported by: 0

Documentation

Overview

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides core plugins for the markata-go static site generator.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Package plugins provides lifecycle plugins for markata-go.

Index

Constants

View Source
const (
	// BoolTrue is the string representation of true.
	BoolTrue = "true"

	// AdmonitionTypeAside is the aside admonition type.
	AdmonitionTypeAside = "aside"

	// PositionLeft is the left position value.
	PositionLeft = "left"

	// PositionStart is the start position value.
	PositionStart = "start"

	// PositionEnd is the end position value.
	PositionEnd = "end"

	// PluginNameTemplates is the templates plugin name.
	PluginNameTemplates = "templates"

	// ThemeDefault is the default theme name.
	ThemeDefault = "default"

	// DefaultSiteURL is the default site URL used when none is configured.
	DefaultSiteURL = "https://example.com"
)

String constants used throughout the plugins package. These constants help avoid magic strings and satisfy goconst linter.

View Source
const JSONFeedVersion = "https://jsonfeed.org/version/1.1"

JSONFeedVersion is the JSON Feed specification version.

Variables

View Source
var ErrInvalidFrontmatter = errors.New("invalid frontmatter")

ErrInvalidFrontmatter indicates the frontmatter could not be parsed.

View Source
var KindAdmonition = ast.NewNodeKind("Admonition")

KindAdmonition is the AST node kind for admonitions.

Functions

func ByNames

func ByNames(names []string) (pluginList []lifecycle.Plugin, warnings []string)

ByNames creates plugin instances from a list of names. Unknown plugin names are skipped with a warning returned.

func DefaultPlugins

func DefaultPlugins() []lifecycle.Plugin

DefaultPlugins returns all standard plugins in their recommended execution order. This is the typical set of plugins for a complete markata build.

func ExtractFrontmatter

func ExtractFrontmatter(content string) (frontmatter, body string, err error)

ExtractFrontmatter splits content into frontmatter YAML string and body content. Returns:

  • frontmatter: the raw YAML string between --- delimiters (empty if no frontmatter)
  • body: the content after the frontmatter
  • err: error if frontmatter is malformed

Edge cases:

  • No frontmatter (doesn't start with ---): returns empty frontmatter, full content as body
  • Empty frontmatter (---, then ---): returns empty frontmatter, content after second ---
  • Unclosed frontmatter: returns error

func GenerateAtom

func GenerateAtom(feed *lifecycle.Feed, config *lifecycle.Config) (string, error)

GenerateAtom generates an Atom feed from a lifecycle.Feed.

func GenerateAtomFromFeedConfig

func GenerateAtomFromFeedConfig(fc *models.FeedConfig, config *lifecycle.Config) (string, error)

GenerateAtomFromFeedConfig generates an Atom feed from a FeedConfig.

func GenerateJSONFeed

func GenerateJSONFeed(feed *lifecycle.Feed, config *lifecycle.Config) (string, error)

GenerateJSONFeed generates a JSON Feed 1.1 document from a lifecycle.Feed.

func GenerateJSONFeedFromFeedConfig

func GenerateJSONFeedFromFeedConfig(fc *models.FeedConfig, config *lifecycle.Config) (string, error)

GenerateJSONFeedFromFeedConfig generates a JSON Feed 1.1 from a FeedConfig.

func GenerateRSS

func GenerateRSS(feed *lifecycle.Feed, config *lifecycle.Config) (string, error)

GenerateRSS generates an RSS 2.0 feed from a lifecycle.Feed.

func GenerateRSSFromFeedConfig

func GenerateRSSFromFeedConfig(fc *models.FeedConfig, config *lifecycle.Config) (string, error)

GenerateRSSFromFeedConfig generates an RSS 2.0 feed from a FeedConfig.

func GetBool

func GetBool(metadata map[string]interface{}, key string, defaultVal bool) bool

GetBool extracts a boolean value from metadata, returning defaultVal if not found or wrong type. Handles YAML boolean values: true, false, yes, no, on, off.

func GetPlatformAssetName added in v0.3.0

func GetPlatformAssetName() (string, error)

GetPlatformAssetName returns the Pagefind asset name for the current platform.

func GetString

func GetString(metadata map[string]interface{}, key string) string

GetString extracts a string value from metadata, returning empty string if not found or wrong type.

func GetStringSlice

func GetStringSlice(metadata map[string]interface{}, key string) []string

GetStringSlice extracts a string slice from metadata. Handles both []interface{} (common from YAML) and []string.

func MinimalPlugins

func MinimalPlugins() []lifecycle.Plugin

MinimalPlugins returns a minimal set of plugins for basic builds. This includes only essential plugins for rendering posts without feeds.

func ParseFrontmatter

func ParseFrontmatter(content string) (metadata map[string]interface{}, body string, err error)

ParseFrontmatter parses content containing optional YAML frontmatter. Returns the parsed metadata as a map, the body content, and any error.

The frontmatter must be delimited by --- at the start of the content.

Example:

---
title: My Post
date: 2024-01-15
tags:
  - go
  - programming
---
# Content here

Edge cases handled:

  • No frontmatter: returns empty map, full content as body
  • Empty frontmatter: returns empty map, content after delimiters
  • Invalid YAML: returns error with context

func PluginByName

func PluginByName(name string) (lifecycle.Plugin, bool)

PluginByName returns a new instance of a plugin by its name. Returns the plugin and true if found, or nil and false if not found.

func RegisterPluginConstructor

func RegisterPluginConstructor(name string, constructor func() lifecycle.Plugin)

RegisterPluginConstructor registers a plugin constructor with the given name. This allows third-party plugins to be registered and used by name.

func RegisteredPlugins

func RegisteredPlugins() []string

RegisteredPlugins returns a list of all registered plugin names.

func TransformPlugins

func TransformPlugins() []lifecycle.Plugin

TransformPlugins returns only the transform-stage plugins. Useful for adding to a custom plugin set.

Types

type Admonition

type Admonition struct {
	ast.BaseBlock
	AdmonitionType  string
	AdmonitionTitle string
	Collapsible     bool   // true if ??? or ???+ syntax
	DefaultOpen     bool   // true if ???+ (expanded by default)
	Position        string // "left", "right", or "" (for aside type; "" means right/default)
}

Admonition is an AST node representing an admonition block.

func NewAdmonition

func NewAdmonition(adType, title string, collapsible, defaultOpen bool, position string) *Admonition

NewAdmonition creates a new Admonition node.

func (*Admonition) Dump

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

Dump dumps the node for debugging.

func (*Admonition) Kind

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

Kind returns the kind of this node.

type AdmonitionExtension

type AdmonitionExtension struct{}

AdmonitionExtension is a goldmark extension for admonitions.

func (*AdmonitionExtension) Extend

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

Extend adds the admonition parser and renderer to goldmark.

type AdmonitionParser

type AdmonitionParser struct{}

AdmonitionParser is a block parser for admonitions.

func NewAdmonitionParser

func NewAdmonitionParser() *AdmonitionParser

NewAdmonitionParser creates a new AdmonitionParser.

func (*AdmonitionParser) CanAcceptIndentedLine

func (p *AdmonitionParser) CanAcceptIndentedLine() bool

CanAcceptIndentedLine returns true if the parser can accept indented lines.

func (*AdmonitionParser) CanInterruptParagraph

func (p *AdmonitionParser) CanInterruptParagraph() bool

CanInterruptParagraph returns true if the parser can interrupt a paragraph.

func (*AdmonitionParser) Close

func (p *AdmonitionParser) Close(_ ast.Node, _ text.Reader, _ parser.Context)

Close is called when the admonition block is closed.

func (*AdmonitionParser) Continue

func (p *AdmonitionParser) Continue(_ ast.Node, reader text.Reader, _ parser.Context) parser.State

Continue checks if the admonition block continues. Admonition content is indented with at least 4 spaces.

func (*AdmonitionParser) Open

func (p *AdmonitionParser) Open(_ ast.Node, reader text.Reader, _ parser.Context) (ast.Node, parser.State)

Open parses the opening line of an admonition block.

func (*AdmonitionParser) Trigger

func (p *AdmonitionParser) Trigger() []byte

Trigger returns the characters that trigger this parser.

type AdmonitionRenderer

type AdmonitionRenderer struct {
	html.Config
}

AdmonitionRenderer renders Admonition nodes to HTML.

func NewAdmonitionRenderer

func NewAdmonitionRenderer() *AdmonitionRenderer

NewAdmonitionRenderer creates a new AdmonitionRenderer.

func (*AdmonitionRenderer) RegisterFuncs

RegisterFuncs registers the render functions for Admonition nodes.

type AtomAuthor

type AtomAuthor struct {
	Name  string `xml:"name"`
	Email string `xml:"email,omitempty"`
	URI   string `xml:"uri,omitempty"`
}

AtomAuthor represents an author element in an Atom feed.

type AtomContent

type AtomContent struct {
	Type  string `xml:"type,attr"`
	Value string `xml:",chardata"`
}

AtomContent represents content with a type attribute.

type AtomEntry

type AtomEntry struct {
	Title     string         `xml:"title"`
	ID        string         `xml:"id"`
	Updated   string         `xml:"updated"`
	Published string         `xml:"published,omitempty"`
	Links     []AtomFeedLink `xml:"link"`
	Summary   *AtomContent   `xml:"summary,omitempty"`
	Content   *AtomContent   `xml:"content,omitempty"`
	Author    *AtomAuthor    `xml:"author,omitempty"`
}

AtomEntry represents an entry element in an Atom feed.

type AtomFeed

type AtomFeed struct {
	XMLName xml.Name       `xml:"feed"`
	Xmlns   string         `xml:"xmlns,attr"`
	Title   string         `xml:"title"`
	ID      string         `xml:"id"`
	Updated string         `xml:"updated"`
	Links   []AtomFeedLink `xml:"link"`
	Author  *AtomAuthor    `xml:"author,omitempty"`
	Entries []AtomEntry    `xml:"entry"`
}

AtomFeed represents an Atom feed.

type AtomFeedLink struct {
	Href string `xml:"href,attr"`
	Rel  string `xml:"rel,attr,omitempty"`
	Type string `xml:"type,attr,omitempty"`
}

AtomFeedLink represents a link element in an Atom feed.

type AtomLink struct {
	Href string `xml:"href,attr"`
	Rel  string `xml:"rel,attr"`
	Type string `xml:"type,attr"`
}

AtomLink represents an atom:link element for RSS feed self-reference.

type AutoArchiveConfig

type AutoArchiveConfig struct {
	// Enabled enables generation of archive feeds
	Enabled bool `json:"enabled" yaml:"enabled" toml:"enabled"`

	// SlugPrefix is the URL prefix for archives (e.g., "archive" -> /archive/2024/)
	SlugPrefix string `json:"slug_prefix" yaml:"slug_prefix" toml:"slug_prefix"`

	// YearlyFeeds enables year-based archive feeds
	YearlyFeeds bool `json:"yearly_feeds" yaml:"yearly_feeds" toml:"yearly_feeds"`

	// MonthlyFeeds enables month-based archive feeds
	MonthlyFeeds bool `json:"monthly_feeds" yaml:"monthly_feeds" toml:"monthly_feeds"`

	// Formats specifies which output formats to generate
	Formats models.FeedFormats `json:"formats" yaml:"formats" toml:"formats"`
}

AutoArchiveConfig configures automatic date archive feeds.

type AutoFeedTypeConfig

type AutoFeedTypeConfig struct {
	// Enabled enables generation of this feed type
	Enabled bool `json:"enabled" yaml:"enabled" toml:"enabled"`

	// SlugPrefix is the URL prefix for feeds (e.g., "tags" -> /tags/python/)
	SlugPrefix string `json:"slug_prefix" yaml:"slug_prefix" toml:"slug_prefix"`

	// Formats specifies which output formats to generate
	Formats models.FeedFormats `json:"formats" yaml:"formats" toml:"formats"`
}

AutoFeedTypeConfig configures a type of auto-generated feed (tags, categories).

type AutoFeedsConfig

type AutoFeedsConfig struct {
	// Tags configures automatic tag feeds
	Tags AutoFeedTypeConfig `json:"tags" yaml:"tags" toml:"tags"`

	// Categories configures automatic category feeds
	Categories AutoFeedTypeConfig `json:"categories" yaml:"categories" toml:"categories"`

	// Archives configures automatic date archive feeds
	Archives AutoArchiveConfig `json:"archives" yaml:"archives" toml:"archives"`
}

AutoFeedsConfig configures automatic feed generation.

type AutoFeedsPlugin

type AutoFeedsPlugin struct{}

AutoFeedsPlugin automatically generates feeds for tags, categories, and date archives.

func NewAutoFeedsPlugin

func NewAutoFeedsPlugin() *AutoFeedsPlugin

NewAutoFeedsPlugin creates a new AutoFeedsPlugin.

func (*AutoFeedsPlugin) Collect

func (p *AutoFeedsPlugin) Collect(m *lifecycle.Manager) error

Collect generates automatic feeds for tags, categories, and date archives.

func (*AutoFeedsPlugin) Name

func (p *AutoFeedsPlugin) Name() string

Name returns the unique name of the plugin.

type AutoTitlePlugin

type AutoTitlePlugin struct{}

AutoTitlePlugin auto-generates human-readable titles for posts that don't have one. It derives titles from filenames by replacing hyphens and underscores with spaces and applying title case.

func NewAutoTitlePlugin

func NewAutoTitlePlugin() *AutoTitlePlugin

NewAutoTitlePlugin creates a new AutoTitlePlugin.

func (*AutoTitlePlugin) Name

func (p *AutoTitlePlugin) Name() string

Name returns the unique name of the plugin.

func (*AutoTitlePlugin) Priority

func (p *AutoTitlePlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin priority for the given stage. Auto title should run very early in transform to have title available for other plugins.

func (*AutoTitlePlugin) Transform

func (p *AutoTitlePlugin) Transform(m *lifecycle.Manager) error

Transform generates titles for posts that don't have one.

type CSVFencePlugin

type CSVFencePlugin struct {
	// contains filtered or unexported fields
}

CSVFencePlugin converts CSV code blocks into HTML tables. It processes article_html during the render stage, after render_markdown.

func NewCSVFencePlugin

func NewCSVFencePlugin() *CSVFencePlugin

NewCSVFencePlugin creates a new CSVFencePlugin with default settings.

func (*CSVFencePlugin) Configure

func (p *CSVFencePlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin from config.Extra. Configuration is expected in config.Extra["csv_fence"] as a map.

func (*CSVFencePlugin) Name

func (p *CSVFencePlugin) Name() string

Name returns the unique name of the plugin.

func (*CSVFencePlugin) Priority

func (p *CSVFencePlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin's priority for the render stage. Returns a positive priority to run after render_markdown.

func (*CSVFencePlugin) Render

func (p *CSVFencePlugin) Render(m *lifecycle.Manager) error

Render processes article_html and converts CSV blocks to HTML tables. Posts with Skip=true or empty ArticleHTML are skipped.

func (*CSVFencePlugin) SetDelimiter

func (p *CSVFencePlugin) SetDelimiter(delimiter rune)

SetDelimiter sets the CSV field delimiter.

func (*CSVFencePlugin) SetEnabled

func (p *CSVFencePlugin) SetEnabled(enabled bool)

SetEnabled enables or disables the plugin.

func (*CSVFencePlugin) SetHasHeader

func (p *CSVFencePlugin) SetHasHeader(hasHeader bool)

SetHasHeader sets whether the first row is treated as a header.

func (*CSVFencePlugin) SetTableClass

func (p *CSVFencePlugin) SetTableClass(class string)

SetTableClass sets the CSS class for generated tables.

type ChartJSPlugin added in v0.2.0

type ChartJSPlugin struct {
	// contains filtered or unexported fields
}

ChartJSPlugin converts Chart.js JSON code blocks into rendered charts. It runs at the render stage (after markdown conversion).

func NewChartJSPlugin added in v0.2.0

func NewChartJSPlugin() *ChartJSPlugin

NewChartJSPlugin creates a new ChartJSPlugin with default settings.

func (*ChartJSPlugin) Config added in v0.2.0

func (p *ChartJSPlugin) Config() models.ChartJSConfig

Config returns the current chartjs configuration.

func (*ChartJSPlugin) Configure added in v0.2.0

func (p *ChartJSPlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin from config.Extra. Configuration is expected under the "chartjs" key.

func (*ChartJSPlugin) Name added in v0.2.0

func (p *ChartJSPlugin) Name() string

Name returns the unique name of the plugin.

func (*ChartJSPlugin) Priority added in v0.2.0

func (p *ChartJSPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin's priority for a given stage. This plugin runs after render_markdown (which has default priority 0).

func (*ChartJSPlugin) Render added in v0.2.0

func (p *ChartJSPlugin) Render(m *lifecycle.Manager) error

Render processes chartjs code blocks in the rendered HTML for all posts.

func (*ChartJSPlugin) SetConfig added in v0.2.0

func (p *ChartJSPlugin) SetConfig(config models.ChartJSConfig)

SetConfig sets the chartjs configuration directly. This is useful for testing or programmatic configuration.

type ChromaCSSPlugin added in v0.3.0

type ChromaCSSPlugin struct {
	// contains filtered or unexported fields
}

ChromaCSSPlugin generates CSS for syntax highlighting from Chroma themes. It runs during the Write stage and creates css/chroma.css with the syntax highlighting styles that correspond to the configured theme.

This plugin works in conjunction with RenderMarkdownPlugin which uses CSS classes for syntax highlighting (via WithClasses option).

func NewChromaCSSPlugin added in v0.3.0

func NewChromaCSSPlugin() *ChromaCSSPlugin

NewChromaCSSPlugin creates a new ChromaCSSPlugin.

func (*ChromaCSSPlugin) Configure added in v0.3.0

func (p *ChromaCSSPlugin) Configure(m *lifecycle.Manager) error

Configure reads the highlight theme configuration.

func (*ChromaCSSPlugin) Name added in v0.3.0

func (p *ChromaCSSPlugin) Name() string

Name returns the unique name of the plugin.

func (*ChromaCSSPlugin) Priority added in v0.3.0

func (p *ChromaCSSPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin priority for the write stage. Should run after static_assets so it can add to the css directory.

func (*ChromaCSSPlugin) Write added in v0.3.0

func (p *ChromaCSSPlugin) Write(m *lifecycle.Manager) error

Write generates the Chroma CSS file.

type DescriptionPlugin

type DescriptionPlugin struct {
	// contains filtered or unexported fields
}

DescriptionPlugin auto-generates descriptions for posts that don't have one. It extracts the first paragraph of content, strips markdown formatting, and truncates to a reasonable length for meta descriptions.

func NewDescriptionPlugin

func NewDescriptionPlugin() *DescriptionPlugin

NewDescriptionPlugin creates a new DescriptionPlugin with default settings.

func (*DescriptionPlugin) Configure

func (p *DescriptionPlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin.

func (*DescriptionPlugin) Name

func (p *DescriptionPlugin) Name() string

Name returns the unique name of the plugin.

func (*DescriptionPlugin) Priority

func (p *DescriptionPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin priority for the given stage. Description should run early in transform to have content available for other plugins.

func (*DescriptionPlugin) SetMaxLength

func (p *DescriptionPlugin) SetMaxLength(length int)

SetMaxLength sets the maximum length for generated descriptions.

func (*DescriptionPlugin) Transform

func (p *DescriptionPlugin) Transform(m *lifecycle.Manager) error

Transform generates descriptions for posts that don't have one.

type FeedsPlugin

type FeedsPlugin struct{}

FeedsPlugin processes configured feeds during the collect stage. It filters posts, sorts them, and paginates the results.

func NewFeedsPlugin

func NewFeedsPlugin() *FeedsPlugin

NewFeedsPlugin creates a new FeedsPlugin.

func (*FeedsPlugin) Collect

func (p *FeedsPlugin) Collect(m *lifecycle.Manager) error

Collect processes each FeedConfig and creates feeds with filtered, sorted, and paginated posts.

func (*FeedsPlugin) Name

func (p *FeedsPlugin) Name() string

Name returns the unique name of the plugin.

type GlobPlugin

type GlobPlugin struct {
	// contains filtered or unexported fields
}

GlobPlugin discovers content files using glob patterns.

func NewGlobPlugin

func NewGlobPlugin() *GlobPlugin

NewGlobPlugin creates a new GlobPlugin with default settings.

func (*GlobPlugin) Configure

func (p *GlobPlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration from the manager and initializes the plugin.

func (*GlobPlugin) Glob

func (p *GlobPlugin) Glob(m *lifecycle.Manager) error

Glob discovers content files matching the configured patterns.

func (*GlobPlugin) Name

func (p *GlobPlugin) Name() string

Name returns the plugin identifier.

func (*GlobPlugin) SetPatterns

func (p *GlobPlugin) SetPatterns(patterns []string)

SetPatterns sets the glob patterns to use for file discovery.

func (*GlobPlugin) SetUseGitignore

func (p *GlobPlugin) SetUseGitignore(use bool)

SetUseGitignore enables or disables gitignore support.

type GlossaryConfig

type GlossaryConfig struct {
	// Enabled controls whether the plugin is active
	Enabled bool `json:"enabled" yaml:"enabled" toml:"enabled"`

	// LinkClass is the CSS class for glossary links (default: "glossary-term")
	LinkClass string `json:"link_class" yaml:"link_class" toml:"link_class"`

	// CaseSensitive controls whether term matching is case-sensitive (default: false)
	CaseSensitive bool `json:"case_sensitive" yaml:"case_sensitive" toml:"case_sensitive"`

	// Tooltip controls whether to add a title attribute with description (default: true)
	Tooltip bool `json:"tooltip" yaml:"tooltip" toml:"tooltip"`

	// MaxLinksPerTerm limits how many times each term is linked (0 = all, default: 1)
	MaxLinksPerTerm int `json:"max_links_per_term" yaml:"max_links_per_term" toml:"max_links_per_term"`

	// ExcludeTags lists tags that should not have glossary terms linked
	ExcludeTags []string `json:"exclude_tags" yaml:"exclude_tags" toml:"exclude_tags"`

	// ExportJSON controls whether to export glossary.json (default: true)
	ExportJSON bool `json:"export_json" yaml:"export_json" toml:"export_json"`

	// GlossaryPath is the path prefix for glossary posts (default: "glossary")
	GlossaryPath string `json:"glossary_path" yaml:"glossary_path" toml:"glossary_path"`

	// TemplateKey identifies glossary posts by templateKey frontmatter
	TemplateKey string `json:"template_key" yaml:"template_key" toml:"template_key"`
}

GlossaryConfig holds configuration for the glossary plugin.

func NewGlossaryConfig

func NewGlossaryConfig() *GlossaryConfig

NewGlossaryConfig creates a GlossaryConfig with default values.

type GlossaryExport

type GlossaryExport struct {
	Terms []*GlossaryTerm `json:"terms"`
}

GlossaryExport represents the JSON export format.

type GlossaryPlugin

type GlossaryPlugin struct {
	// contains filtered or unexported fields
}

GlossaryPlugin automatically links glossary terms in post content.

func NewGlossaryPlugin

func NewGlossaryPlugin() *GlossaryPlugin

NewGlossaryPlugin creates a new GlossaryPlugin with default configuration.

func (*GlossaryPlugin) Config

func (p *GlossaryPlugin) Config() *GlossaryConfig

Config returns the current glossary configuration.

func (*GlossaryPlugin) Configure

func (p *GlossaryPlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin.

func (*GlossaryPlugin) Name

func (p *GlossaryPlugin) Name() string

Name returns the unique name of the plugin.

func (*GlossaryPlugin) Priority

func (p *GlossaryPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin priority for the given stage. Glossary should run late in render (post_render) to process article_html.

func (*GlossaryPlugin) Render

func (p *GlossaryPlugin) Render(m *lifecycle.Manager) error

Render processes glossary terms and links them in post content.

func (*GlossaryPlugin) SetConfig

func (p *GlossaryPlugin) SetConfig(config *GlossaryConfig)

SetConfig sets the glossary configuration.

func (*GlossaryPlugin) Terms

func (p *GlossaryPlugin) Terms() []*GlossaryTerm

Terms returns a copy of all glossary terms.

func (*GlossaryPlugin) Write

func (p *GlossaryPlugin) Write(m *lifecycle.Manager) error

Write exports the glossary JSON file if configured.

type GlossaryTerm

type GlossaryTerm struct {
	// Term is the primary term name
	Term string `json:"term"`

	// Slug is the URL-safe identifier
	Slug string `json:"slug"`

	// Description is the term description
	Description string `json:"description"`

	// Aliases are alternative names for the term
	Aliases []string `json:"aliases,omitempty"`

	// Href is the URL path to the term's page
	Href string `json:"href"`
	// contains filtered or unexported fields
}

GlossaryTerm represents a single glossary term with its definition.

type HeadingAnchorsPlugin

type HeadingAnchorsPlugin struct {
	// contains filtered or unexported fields
}

HeadingAnchorsPlugin adds anchor links to headings in rendered HTML. It processes article_html during the render stage, after render_markdown.

func NewHeadingAnchorsPlugin

func NewHeadingAnchorsPlugin() *HeadingAnchorsPlugin

NewHeadingAnchorsPlugin creates a new HeadingAnchorsPlugin with default settings.

func (*HeadingAnchorsPlugin) Configure

func (p *HeadingAnchorsPlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin from config.Extra. Configuration is expected in config.Extra["heading_anchors"] as a map.

func (*HeadingAnchorsPlugin) Name

func (p *HeadingAnchorsPlugin) Name() string

Name returns the unique name of the plugin.

func (*HeadingAnchorsPlugin) Priority

func (p *HeadingAnchorsPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin's priority for the render stage. Returns a positive priority to run after render_markdown.

func (*HeadingAnchorsPlugin) Render

Render processes article_html and adds anchor links to headings. Posts with Skip=true or empty ArticleHTML are skipped.

func (*HeadingAnchorsPlugin) SetClass

func (p *HeadingAnchorsPlugin) SetClass(class string)

SetClass sets the anchor link CSS class.

func (*HeadingAnchorsPlugin) SetEnabled

func (p *HeadingAnchorsPlugin) SetEnabled(enabled bool)

SetEnabled enables or disables the plugin.

func (*HeadingAnchorsPlugin) SetLevelRange

func (p *HeadingAnchorsPlugin) SetLevelRange(minLevel, maxLevel int)

SetLevelRange sets the minimum and maximum heading levels to process.

func (*HeadingAnchorsPlugin) SetPosition

func (p *HeadingAnchorsPlugin) SetPosition(position string)

SetPosition sets the anchor position ("start" or "end").

func (*HeadingAnchorsPlugin) SetSymbol

func (p *HeadingAnchorsPlugin) SetSymbol(symbol string)

SetSymbol sets the anchor link symbol.

type JSONFeed

type JSONFeed struct {
	Version     string           `json:"version"`
	Title       string           `json:"title"`
	HomePageURL string           `json:"home_page_url,omitempty"`
	FeedURL     string           `json:"feed_url,omitempty"`
	Description string           `json:"description,omitempty"`
	UserComment string           `json:"user_comment,omitempty"`
	NextURL     string           `json:"next_url,omitempty"`
	Icon        string           `json:"icon,omitempty"`
	Favicon     string           `json:"favicon,omitempty"`
	Authors     []JSONFeedAuthor `json:"authors,omitempty"`
	Language    string           `json:"language,omitempty"`
	Expired     bool             `json:"expired,omitempty"`
	Items       []JSONFeedItem   `json:"items"`
}

JSONFeed represents a JSON Feed 1.1 document. See https://jsonfeed.org/version/1.1

type JSONFeedAuthor

type JSONFeedAuthor struct {
	Name   string `json:"name,omitempty"`
	URL    string `json:"url,omitempty"`
	Avatar string `json:"avatar,omitempty"`
}

JSONFeedAuthor represents an author in a JSON Feed.

type JSONFeedItem

type JSONFeedItem struct {
	ID            string           `json:"id"`
	URL           string           `json:"url,omitempty"`
	ExternalURL   string           `json:"external_url,omitempty"`
	Title         string           `json:"title,omitempty"`
	ContentHTML   string           `json:"content_html,omitempty"`
	ContentText   string           `json:"content_text,omitempty"`
	Summary       string           `json:"summary,omitempty"`
	Image         string           `json:"image,omitempty"`
	BannerImage   string           `json:"banner_image,omitempty"`
	DatePublished string           `json:"date_published,omitempty"`
	DateModified  string           `json:"date_modified,omitempty"`
	Authors       []JSONFeedAuthor `json:"authors,omitempty"`
	Tags          []string         `json:"tags,omitempty"`
	Language      string           `json:"language,omitempty"`
}

JSONFeedItem represents an item in a JSON Feed.

type JinjaMdPlugin

type JinjaMdPlugin struct {
	// contains filtered or unexported fields
}

JinjaMdPlugin processes Jinja2 templates in markdown content. This allows using template syntax within markdown files before they are converted to HTML. It operates during the transform stage.

Posts must have `jinja: true` in their frontmatter to be processed.

Available template variables:

  • post: The current post object
  • config: The site configuration
  • posts: All posts (via core.Posts())
  • core: The lifecycle manager (for filter/map operations)

func NewJinjaMdPlugin

func NewJinjaMdPlugin() *JinjaMdPlugin

NewJinjaMdPlugin creates a new jinja_md plugin.

func (*JinjaMdPlugin) Configure

func (p *JinjaMdPlugin) Configure(m *lifecycle.Manager) error

Configure initializes the template engine. If the templates plugin has already initialized an engine, reuse it.

func (*JinjaMdPlugin) Engine

func (p *JinjaMdPlugin) Engine() *templates.Engine

Engine returns the template engine for use by other plugins.

func (*JinjaMdPlugin) Name

func (p *JinjaMdPlugin) Name() string

Name returns the plugin name.

func (*JinjaMdPlugin) Priority

func (p *JinjaMdPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin priority for the given stage. JinjaMd should run early in the transform stage, before other transforms.

func (*JinjaMdPlugin) Transform

func (p *JinjaMdPlugin) Transform(m *lifecycle.Manager) error

Transform processes jinja templates in markdown content. Only posts with `jinja: true` in their frontmatter are processed.

type LinkCollectorPlugin

type LinkCollectorPlugin struct {
	// contains filtered or unexported fields
}

LinkCollectorPlugin collects all hyperlinks from posts and tracks inlinks (pages linking TO a post) and outlinks (pages a post links TO). It runs in the render stage after render_markdown.

func NewLinkCollectorPlugin

func NewLinkCollectorPlugin() *LinkCollectorPlugin

NewLinkCollectorPlugin creates a new LinkCollectorPlugin with default settings.

func (*LinkCollectorPlugin) Configure

func (p *LinkCollectorPlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin.

func (*LinkCollectorPlugin) Name

func (p *LinkCollectorPlugin) Name() string

Name returns the unique name of the plugin.

func (*LinkCollectorPlugin) Priority

func (p *LinkCollectorPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin's priority for the render stage. Returns a late priority to ensure it runs after render_markdown.

func (*LinkCollectorPlugin) Render

Render collects all links from posts and populates inlinks/outlinks.

func (*LinkCollectorPlugin) SetIncludeFeeds

func (p *LinkCollectorPlugin) SetIncludeFeeds(include bool)

SetIncludeFeeds enables or disables including feed pages in inlinks.

func (*LinkCollectorPlugin) SetIncludeIndex

func (p *LinkCollectorPlugin) SetIncludeIndex(include bool)

SetIncludeIndex enables or disables including the index page in inlinks.

func (*LinkCollectorPlugin) SetSiteURL

func (p *LinkCollectorPlugin) SetSiteURL(siteURL string)

SetSiteURL sets the site URL for determining internal vs external links.

type LoadPlugin

type LoadPlugin struct{}

LoadPlugin parses markdown files into Post objects.

func NewLoadPlugin

func NewLoadPlugin() *LoadPlugin

NewLoadPlugin creates a new LoadPlugin.

func (*LoadPlugin) Load

func (p *LoadPlugin) Load(m *lifecycle.Manager) error

Load reads and parses all discovered files into Post objects. Files are loaded in parallel using a worker pool for improved I/O performance.

func (*LoadPlugin) Name

func (p *LoadPlugin) Name() string

Name returns the plugin identifier.

type MDVideoPlugin

type MDVideoPlugin struct {
	// contains filtered or unexported fields
}

MDVideoPlugin converts markdown image syntax for video files into HTML video elements. It runs at the render stage (late priority, after markdown conversion).

Example input (markdown):

![Video description](video.mp4)

Example output (HTML):

<video autoplay loop muted playsinline controls class="md-video">
  <source src="video.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

func NewMDVideoPlugin

func NewMDVideoPlugin() *MDVideoPlugin

NewMDVideoPlugin creates a new MDVideoPlugin with default settings.

func (*MDVideoPlugin) Config

func (p *MDVideoPlugin) Config() models.MDVideoConfig

Config returns the current md_video configuration.

func (*MDVideoPlugin) Configure

func (p *MDVideoPlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin from config.Extra. Configuration is expected under the "md_video" key.

func (*MDVideoPlugin) Name

func (p *MDVideoPlugin) Name() string

Name returns the unique name of the plugin.

func (*MDVideoPlugin) Priority

func (p *MDVideoPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin's priority for a given stage. This plugin runs after render_markdown (which has default priority 0).

func (*MDVideoPlugin) Render

func (p *MDVideoPlugin) Render(m *lifecycle.Manager) error

Render processes video image tags in the rendered HTML for all posts.

func (*MDVideoPlugin) SetConfig

func (p *MDVideoPlugin) SetConfig(config models.MDVideoConfig)

SetConfig sets the md_video configuration directly. This is useful for testing or programmatic configuration.

type MermaidPlugin

type MermaidPlugin struct {
	// contains filtered or unexported fields
}

MermaidPlugin converts Mermaid code blocks into rendered diagrams. It runs at the render stage (post_render, after markdown conversion).

func NewMermaidPlugin

func NewMermaidPlugin() *MermaidPlugin

NewMermaidPlugin creates a new MermaidPlugin with default settings.

func (*MermaidPlugin) Config

func (p *MermaidPlugin) Config() models.MermaidConfig

Config returns the current mermaid configuration.

func (*MermaidPlugin) Configure

func (p *MermaidPlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin from config.Extra. Configuration is expected under the "mermaid" key.

func (*MermaidPlugin) Name

func (p *MermaidPlugin) Name() string

Name returns the unique name of the plugin.

func (*MermaidPlugin) Priority

func (p *MermaidPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin's priority for a given stage. This plugin runs after render_markdown (which has default priority 0).

func (*MermaidPlugin) Render

func (p *MermaidPlugin) Render(m *lifecycle.Manager) error

Render processes mermaid code blocks in the rendered HTML for all posts.

func (*MermaidPlugin) SetConfig

func (p *MermaidPlugin) SetConfig(config models.MermaidConfig)

SetConfig sets the mermaid configuration directly. This is useful for testing or programmatic configuration.

type OneLineLinkPlugin added in v0.2.0

type OneLineLinkPlugin struct {
	// contains filtered or unexported fields
}

OneLineLinkPlugin expands URLs that appear alone in a paragraph into rich preview cards. It runs at the render stage (after markdown conversion).

func NewOneLineLinkPlugin added in v0.2.0

func NewOneLineLinkPlugin() *OneLineLinkPlugin

NewOneLineLinkPlugin creates a new OneLineLinkPlugin with default settings.

func (*OneLineLinkPlugin) Config added in v0.2.0

Config returns the current plugin configuration.

func (*OneLineLinkPlugin) Configure added in v0.2.0

func (p *OneLineLinkPlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin from config.Extra. Configuration is expected under the "one_line_link" key.

func (*OneLineLinkPlugin) Name added in v0.2.0

func (p *OneLineLinkPlugin) Name() string

Name returns the unique name of the plugin.

func (*OneLineLinkPlugin) Priority added in v0.2.0

func (p *OneLineLinkPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin's priority for a given stage. This plugin runs after render_markdown (which has default priority 0).

func (*OneLineLinkPlugin) Render added in v0.2.0

func (p *OneLineLinkPlugin) Render(m *lifecycle.Manager) error

Render processes paragraphs containing only URLs in the rendered HTML.

func (*OneLineLinkPlugin) SetConfig added in v0.2.0

func (p *OneLineLinkPlugin) SetConfig(config models.OneLineLinkConfig)

SetConfig sets the plugin configuration directly. This is useful for testing or programmatic configuration.

type OverwriteCheckPlugin added in v0.3.0

type OverwriteCheckPlugin struct {
	// contains filtered or unexported fields
}

OverwriteCheckPlugin detects when multiple posts or feeds would write to the same output path, preventing accidental content overwrites.

func NewOverwriteCheckPlugin added in v0.3.0

func NewOverwriteCheckPlugin() *OverwriteCheckPlugin

NewOverwriteCheckPlugin creates a new OverwriteCheckPlugin.

func (*OverwriteCheckPlugin) Collect added in v0.3.0

Collect checks for output path conflicts between posts and feeds.

func (*OverwriteCheckPlugin) Conflicts added in v0.3.0

func (p *OverwriteCheckPlugin) Conflicts() []PathConflict

Conflicts returns the detected path conflicts.

func (*OverwriteCheckPlugin) Name added in v0.3.0

func (p *OverwriteCheckPlugin) Name() string

Name returns the unique name of the plugin.

func (*OverwriteCheckPlugin) Priority added in v0.3.0

func (p *OverwriteCheckPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin execution priority for the given stage. Run before other collect plugins to catch conflicts early.

func (*OverwriteCheckPlugin) SetWarnOnly added in v0.3.0

func (p *OverwriteCheckPlugin) SetWarnOnly(warnOnly bool)

SetWarnOnly configures whether to warn or fail on conflicts.

type PagefindInstallError added in v0.3.0

type PagefindInstallError struct {
	Operation string
	Message   string
	Err       error
}

PagefindInstallError indicates an error during Pagefind installation.

func NewPagefindInstallError added in v0.3.0

func NewPagefindInstallError(operation, message string, err error) *PagefindInstallError

NewPagefindInstallError creates a new PagefindInstallError.

func (*PagefindInstallError) Error added in v0.3.0

func (e *PagefindInstallError) Error() string

func (*PagefindInstallError) Unwrap added in v0.3.0

func (e *PagefindInstallError) Unwrap() error

type PagefindInstaller added in v0.3.0

type PagefindInstaller struct {
	// CacheDir is the directory where binaries are cached.
	CacheDir string

	// Version is the Pagefind version to install (e.g., "v1.4.0" or "latest").
	Version string
	// contains filtered or unexported fields
}

PagefindInstaller handles automatic downloading and caching of Pagefind binaries.

func NewPagefindInstaller added in v0.3.0

func NewPagefindInstaller() *PagefindInstaller

NewPagefindInstaller creates a new PagefindInstaller with default settings.

func NewPagefindInstallerWithConfig added in v0.3.0

func NewPagefindInstallerWithConfig(config PagefindInstallerConfig) *PagefindInstaller

NewPagefindInstallerWithConfig creates a new PagefindInstaller from config.

func (*PagefindInstaller) GetCacheDir added in v0.3.0

func (i *PagefindInstaller) GetCacheDir() (string, error)

GetCacheDir returns the cache directory, creating it if necessary.

func (*PagefindInstaller) GetCachedBinaryPath added in v0.3.0

func (i *PagefindInstaller) GetCachedBinaryPath(version string) (string, error)

GetCachedBinaryPath returns the path to a cached Pagefind binary for the given version.

func (*PagefindInstaller) GetLatestVersion added in v0.3.0

func (i *PagefindInstaller) GetLatestVersion() (string, error)

GetLatestVersion fetches the latest Pagefind version from GitHub releases.

func (*PagefindInstaller) Install added in v0.3.0

func (i *PagefindInstaller) Install() (string, error)

Install downloads and caches the Pagefind binary for the current platform. Returns the path to the installed binary.

func (*PagefindInstaller) IsCached added in v0.3.0

func (i *PagefindInstaller) IsCached(version string) (bool, error)

IsCached checks if a specific version is already cached and valid.

func (*PagefindInstaller) ResolveVersion added in v0.3.0

func (i *PagefindInstaller) ResolveVersion() (string, error)

ResolveVersion resolves "latest" to an actual version number.

type PagefindInstallerConfig added in v0.3.0

type PagefindInstallerConfig struct {
	// AutoInstall enables automatic Pagefind installation (default: true).
	AutoInstall *bool `json:"auto_install,omitempty" yaml:"auto_install,omitempty" toml:"auto_install,omitempty"`

	// Version is the Pagefind version to install (default: "latest").
	Version string `json:"version,omitempty" yaml:"version,omitempty" toml:"version,omitempty"`

	// CacheDir is the directory for caching binaries (default: ~/.markata-go/bin/).
	CacheDir string `json:"cache_dir,omitempty" yaml:"cache_dir,omitempty" toml:"cache_dir,omitempty"`
}

PagefindInstallerConfig configures the Pagefind installer.

func NewPagefindInstallerConfig added in v0.3.0

func NewPagefindInstallerConfig() PagefindInstallerConfig

NewPagefindInstallerConfig creates a new PagefindInstallerConfig with default values.

func (*PagefindInstallerConfig) IsAutoInstallEnabled added in v0.3.0

func (c *PagefindInstallerConfig) IsAutoInstallEnabled() bool

IsAutoInstallEnabled returns whether auto-install is enabled. Defaults to true if not explicitly set.

type PagefindPlugin added in v0.3.0

type PagefindPlugin struct{}

PagefindPlugin runs Pagefind to generate a search index after all HTML files are written. Pagefind is a static site search tool that creates an optimized search index that can be queried entirely client-side.

This plugin runs in the Cleanup stage with PriorityLast to ensure all HTML files have been written before indexing begins.

For more information about Pagefind, see: https://pagefind.app/

func NewPagefindPlugin added in v0.3.0

func NewPagefindPlugin() *PagefindPlugin

NewPagefindPlugin creates a new PagefindPlugin.

func (*PagefindPlugin) Cleanup added in v0.3.0

func (p *PagefindPlugin) Cleanup(m *lifecycle.Manager) error

Cleanup runs Pagefind to index the generated site. This runs after all HTML files have been written in the Write stage.

func (*PagefindPlugin) Name added in v0.3.0

func (p *PagefindPlugin) Name() string

Name returns the unique name of the plugin.

func (*PagefindPlugin) Priority added in v0.3.0

func (p *PagefindPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin priority for the cleanup stage. Pagefind runs last in cleanup to ensure all HTML files are written first.

type PaletteCSSPlugin

type PaletteCSSPlugin struct{}

PaletteCSSPlugin generates CSS variables from the configured color palette. It runs during the Write stage and creates/overwrites css/variables.css with the palette's CSS custom properties. It runs after static_assets to overwrite the default variables.css with palette-specific values.

The plugin maps palette colors to the theme's expected CSS variable names, preserving fonts, spacing, and other non-color variables from the default theme.

func NewPaletteCSSPlugin

func NewPaletteCSSPlugin() *PaletteCSSPlugin

NewPaletteCSSPlugin creates a new PaletteCSSPlugin.

func (*PaletteCSSPlugin) Name

func (p *PaletteCSSPlugin) Name() string

Name returns the unique name of the plugin.

func (*PaletteCSSPlugin) Priority

func (p *PaletteCSSPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin priority for the write stage. Should run after static_assets so it can overwrite the default variables.css

func (*PaletteCSSPlugin) Write

func (p *PaletteCSSPlugin) Write(m *lifecycle.Manager) error

Write generates CSS from the configured palette and writes it to the output directory.

type PathConflict added in v0.3.0

type PathConflict struct {
	// OutputPath is the conflicting output path
	OutputPath string

	// Sources are the content sources (posts, feeds) that conflict
	Sources []string
}

PathConflict represents a conflict between two content sources that would result in the same output path.

type PrevNextPlugin

type PrevNextPlugin struct{}

PrevNextPlugin calculates previous/next post links for navigation. It runs in the collect stage after feeds have been created.

func NewPrevNextPlugin

func NewPrevNextPlugin() *PrevNextPlugin

NewPrevNextPlugin creates a new PrevNextPlugin.

func (*PrevNextPlugin) Collect

func (p *PrevNextPlugin) Collect(m *lifecycle.Manager) error

Collect calculates prev/next links for all posts based on the configured strategy.

func (*PrevNextPlugin) Name

func (p *PrevNextPlugin) Name() string

Name returns the unique name of the plugin.

func (*PrevNextPlugin) Priority

func (p *PrevNextPlugin) Priority(stage lifecycle.Stage) int

Priority ensures this plugin runs after the feeds plugin.

type PublishFeedsPlugin

type PublishFeedsPlugin struct{}

PublishFeedsPlugin writes feeds to multiple output formats during the write stage.

func NewPublishFeedsPlugin

func NewPublishFeedsPlugin() *PublishFeedsPlugin

NewPublishFeedsPlugin creates a new PublishFeedsPlugin.

func (*PublishFeedsPlugin) Name

func (p *PublishFeedsPlugin) Name() string

Name returns the unique name of the plugin.

func (*PublishFeedsPlugin) Write

Write generates and writes feed files in all configured formats.

type PublishHTMLPlugin

type PublishHTMLPlugin struct{}

PublishHTMLPlugin writes individual post HTML files during the write stage. It supports multiple output formats: HTML, Markdown source, and OG card HTML.

func NewPublishHTMLPlugin

func NewPublishHTMLPlugin() *PublishHTMLPlugin

NewPublishHTMLPlugin creates a new PublishHTMLPlugin.

func (*PublishHTMLPlugin) Name

func (p *PublishHTMLPlugin) Name() string

Name returns the unique name of the plugin.

func (*PublishHTMLPlugin) Write

Write outputs each post to the configured output directory in enabled formats.

type QRCodePlugin added in v0.2.0

type QRCodePlugin struct {
	// contains filtered or unexported fields
}

QRCodePlugin generates QR code images for each post's URL. It runs at the write stage to generate QR code files.

func NewQRCodePlugin added in v0.2.0

func NewQRCodePlugin() *QRCodePlugin

NewQRCodePlugin creates a new QRCodePlugin with default settings.

func (*QRCodePlugin) Config added in v0.2.0

func (p *QRCodePlugin) Config() models.QRCodeConfig

Config returns the current plugin configuration.

func (*QRCodePlugin) Configure added in v0.2.0

func (p *QRCodePlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin from config.Extra. Configuration is expected under the "qrcode" key.

func (*QRCodePlugin) Name added in v0.2.0

func (p *QRCodePlugin) Name() string

Name returns the unique name of the plugin.

func (*QRCodePlugin) Priority added in v0.2.0

func (p *QRCodePlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin's priority for a given stage. This plugin runs late in write stage to ensure all post data is finalized.

func (*QRCodePlugin) SetBaseURL added in v0.2.0

func (p *QRCodePlugin) SetBaseURL(url string)

SetBaseURL sets the base URL for testing.

func (*QRCodePlugin) SetConfig added in v0.2.0

func (p *QRCodePlugin) SetConfig(config models.QRCodeConfig)

SetConfig sets the plugin configuration directly. This is useful for testing or programmatic configuration.

func (*QRCodePlugin) SetOutputDir added in v0.2.0

func (p *QRCodePlugin) SetOutputDir(dir string)

SetOutputDir sets the output directory for testing.

func (*QRCodePlugin) Write added in v0.2.0

func (p *QRCodePlugin) Write(m *lifecycle.Manager) error

Write generates QR code images for all posts.

type RSS

type RSS struct {
	XMLName xml.Name   `xml:"rss"`
	Version string     `xml:"version,attr"`
	Atom    string     `xml:"xmlns:atom,attr,omitempty"`
	Channel RSSChannel `xml:"channel"`
}

RSS represents an RSS 2.0 feed.

type RSSChannel

type RSSChannel struct {
	Title         string    `xml:"title"`
	Link          string    `xml:"link"`
	Description   string    `xml:"description"`
	Language      string    `xml:"language,omitempty"`
	LastBuildDate string    `xml:"lastBuildDate,omitempty"`
	AtomLink      *AtomLink `xml:"atom:link,omitempty"`
	Items         []RSSItem `xml:"item"`
}

RSSChannel represents the channel element in an RSS feed.

type RSSGUID

type RSSGUID struct {
	Value       string `xml:",chardata"`
	IsPermaLink bool   `xml:"isPermaLink,attr"`
}

RSSGUID represents a globally unique identifier for an RSS item.

type RSSItem

type RSSItem struct {
	Title       string  `xml:"title"`
	Link        string  `xml:"link"`
	Description string  `xml:"description"`
	PubDate     string  `xml:"pubDate,omitempty"`
	GUID        RSSGUID `xml:"guid"`
	Author      string  `xml:"author,omitempty"`
}

RSSItem represents an item element in an RSS feed.

type ReadingTimePlugin

type ReadingTimePlugin struct {
	// contains filtered or unexported fields
}

ReadingTimePlugin calculates the word count and estimated reading time for each post during the transform stage.

func NewReadingTimePlugin

func NewReadingTimePlugin() *ReadingTimePlugin

NewReadingTimePlugin creates a new ReadingTimePlugin with default settings.

func (*ReadingTimePlugin) Configure

func (p *ReadingTimePlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin.

func (*ReadingTimePlugin) Name

func (p *ReadingTimePlugin) Name() string

Name returns the unique name of the plugin.

func (*ReadingTimePlugin) SetWordsPerMinute

func (p *ReadingTimePlugin) SetWordsPerMinute(wpm int)

SetWordsPerMinute sets the average reading speed.

func (*ReadingTimePlugin) Transform

func (p *ReadingTimePlugin) Transform(m *lifecycle.Manager) error

Transform calculates word count and reading time for each post.

type ReadingTimeResult

type ReadingTimeResult struct {
	// WordCount is the number of words in the post
	WordCount int `json:"word_count"`

	// ReadingTime is the estimated reading time in minutes
	ReadingTime int `json:"reading_time"`

	// ReadingTimeText is a formatted reading time string
	ReadingTimeText string `json:"reading_time_text"`
}

ReadingTimeResult holds the calculated reading metrics for a post.

func GetReadingTime

func GetReadingTime(post *models.Post) *ReadingTimeResult

GetReadingTime extracts reading time data from a post's Extra map. Returns nil if reading time hasn't been calculated.

type Redirect

type Redirect struct {
	// Original is the source path (the old URL).
	Original string

	// New is the destination path (the new URL).
	New string
}

Redirect represents a single URL redirect rule.

type RedirectsConfig

type RedirectsConfig struct {
	// RedirectsFile is the path to the _redirects file.
	// Default: "static/_redirects"
	RedirectsFile string

	// RedirectTemplate is an optional path to a custom template.
	// If empty, the default template is used.
	RedirectTemplate string
}

RedirectsConfig holds configuration for the redirects plugin.

type RedirectsPlugin

type RedirectsPlugin struct {
	// contains filtered or unexported fields
}

RedirectsPlugin generates HTML redirect pages from a _redirects file. It creates index.html files at each source path that redirect to the destination.

func NewRedirectsPlugin

func NewRedirectsPlugin() *RedirectsPlugin

NewRedirectsPlugin creates a new RedirectsPlugin with default configuration.

func (*RedirectsPlugin) Configure

func (p *RedirectsPlugin) Configure(m *lifecycle.Manager) error

Configure loads plugin configuration from the manager.

func (*RedirectsPlugin) GetConfig

func (p *RedirectsPlugin) GetConfig() RedirectsConfig

GetConfig returns the current plugin configuration.

func (*RedirectsPlugin) Name

func (p *RedirectsPlugin) Name() string

Name returns the unique name of the plugin.

func (*RedirectsPlugin) Priority

func (p *RedirectsPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin priority for the given stage. Redirects should run late in the write stage, after content is written.

func (*RedirectsPlugin) SetConfig

func (p *RedirectsPlugin) SetConfig(config RedirectsConfig)

SetConfig allows setting the plugin configuration directly (useful for testing).

func (*RedirectsPlugin) Write

func (p *RedirectsPlugin) Write(m *lifecycle.Manager) error

Write generates redirect pages for each redirect rule.

type RenderMarkdownPlugin

type RenderMarkdownPlugin struct {
	// contains filtered or unexported fields
}

RenderMarkdownPlugin converts markdown content to HTML using goldmark.

func NewRenderMarkdownPlugin

func NewRenderMarkdownPlugin() *RenderMarkdownPlugin

NewRenderMarkdownPlugin creates a new RenderMarkdownPlugin with goldmark configured. The goldmark instance is configured with: - GFM extensions (tables, strikethrough, autolinks, task lists) - Syntax highlighting using chroma - HTML rendering with unsafe mode (allow raw HTML) - Auto heading IDs - Custom admonition support

The initial configuration uses a default theme. The Configure() method will reconfigure the markdown renderer with the appropriate theme based on the site's palette configuration.

func (*RenderMarkdownPlugin) Configure

func (p *RenderMarkdownPlugin) Configure(m *lifecycle.Manager) error

Configure initializes the plugin during the configure stage. It reads the highlight theme from configuration, falling back to the theme derived from the site's color palette if not explicitly set.

Configuration priority: 1. markdown.highlight.theme in config (explicit override) 2. Theme derived from theme.palette (automatic matching) 3. Default theme based on palette variant (github/github-dark)

func (*RenderMarkdownPlugin) Name

func (p *RenderMarkdownPlugin) Name() string

Name returns the unique name of the plugin.

func (*RenderMarkdownPlugin) Render

Render converts markdown content to HTML for all posts. Posts with Skip=true are skipped. The rendered HTML is stored in post.ArticleHTML.

type SitemapPlugin

type SitemapPlugin struct{}

SitemapPlugin generates a sitemap.xml file during the write stage. The sitemap includes all published posts and feed index pages.

func NewSitemapPlugin

func NewSitemapPlugin() *SitemapPlugin

NewSitemapPlugin creates a new SitemapPlugin.

func (*SitemapPlugin) Name

func (p *SitemapPlugin) Name() string

Name returns the unique name of the plugin.

func (*SitemapPlugin) Priority

func (p *SitemapPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin priority for the given stage. Sitemap should run late in the write stage, after all other content is written.

func (*SitemapPlugin) Write

func (p *SitemapPlugin) Write(m *lifecycle.Manager) error

Write generates and writes the sitemap.xml file.

type SitemapURL

type SitemapURL struct {
	Loc        string `xml:"loc"`
	LastMod    string `xml:"lastmod,omitempty"`
	ChangeFreq string `xml:"changefreq,omitempty"`
	Priority   string `xml:"priority,omitempty"`
}

SitemapURL represents a single URL entry in the sitemap.

type StaticAssetsPlugin

type StaticAssetsPlugin struct{}

StaticAssetsPlugin copies static assets from themes and project directories to output. It handles: 1. Theme static files (themes/[theme]/static/*) 2. Project static files (static/*) Project files take precedence over theme files (local override).

func NewStaticAssetsPlugin

func NewStaticAssetsPlugin() *StaticAssetsPlugin

NewStaticAssetsPlugin creates a new StaticAssetsPlugin.

func (*StaticAssetsPlugin) Name

func (p *StaticAssetsPlugin) Name() string

Name returns the unique name of the plugin.

func (*StaticAssetsPlugin) Priority

func (p *StaticAssetsPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin priority for the write stage. Static assets should be written early so that other plugins can reference them.

func (*StaticAssetsPlugin) Write

Write copies static assets to the output directory. Files are copied in layers with increasing priority: 1. Embedded theme static files (lowest priority, base layer) 2. Filesystem theme static files (can override embedded) 3. Project static files (highest priority, can override all)

type StructuredDataPlugin added in v0.3.0

type StructuredDataPlugin struct{}

StructuredDataPlugin generates JSON-LD Schema.org markup, OpenGraph meta tags, and Twitter Cards for SEO and social media optimization.

func NewStructuredDataPlugin added in v0.3.0

func NewStructuredDataPlugin() *StructuredDataPlugin

NewStructuredDataPlugin creates a new StructuredDataPlugin.

func (*StructuredDataPlugin) Name added in v0.3.0

func (p *StructuredDataPlugin) Name() string

Name returns the unique name of the plugin.

func (*StructuredDataPlugin) Priority added in v0.3.0

func (p *StructuredDataPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin priority for the given stage. Runs in mid-transform, after description plugin has run.

func (*StructuredDataPlugin) Transform added in v0.3.0

func (p *StructuredDataPlugin) Transform(m *lifecycle.Manager) error

Transform generates structured data for each post.

type TemplatesPlugin

type TemplatesPlugin struct {
	// contains filtered or unexported fields
}

TemplatesPlugin wraps rendered markdown content in HTML templates. It operates during the render stage, after markdown has been converted to HTML.

func NewTemplatesPlugin

func NewTemplatesPlugin() *TemplatesPlugin

NewTemplatesPlugin creates a new templates plugin.

func (*TemplatesPlugin) Configure

func (p *TemplatesPlugin) Configure(m *lifecycle.Manager) error

Configure initializes the template engine from the config.

func (*TemplatesPlugin) Engine

func (p *TemplatesPlugin) Engine() *templates.Engine

Engine returns the template engine for use by other plugins.

func (*TemplatesPlugin) Name

func (p *TemplatesPlugin) Name() string

Name returns the plugin name.

func (*TemplatesPlugin) Priority

func (p *TemplatesPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin priority for the given stage. Templates should run late in the render stage, after markdown rendering.

func (*TemplatesPlugin) Render

func (p *TemplatesPlugin) Render(m *lifecycle.Manager) error

Render wraps markdown content in templates. This runs after markdown rendering, using post.ArticleHTML as the body.

type TocEntry

type TocEntry struct {
	// Level is the heading level (1-6)
	Level int `json:"level"`

	// Text is the heading text
	Text string `json:"text"`

	// ID is the anchor ID for the heading
	ID string `json:"id"`

	// Children contains nested headings
	Children []*TocEntry `json:"children,omitempty"`
}

TocEntry represents a single entry in the table of contents.

type TocPlugin

type TocPlugin struct {
	// contains filtered or unexported fields
}

TocPlugin extracts headings from markdown content and builds a hierarchical table of contents during the transform stage.

func NewTocPlugin

func NewTocPlugin() *TocPlugin

NewTocPlugin creates a new TocPlugin with default settings.

func (*TocPlugin) Configure

func (p *TocPlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin.

func (*TocPlugin) Name

func (p *TocPlugin) Name() string

Name returns the unique name of the plugin.

func (*TocPlugin) SetLevelRange

func (p *TocPlugin) SetLevelRange(minLevel, maxLevel int)

SetLevelRange sets the minimum and maximum heading levels to include.

func (*TocPlugin) Transform

func (p *TocPlugin) Transform(m *lifecycle.Manager) error

Transform extracts headings from markdown and builds a TOC for each post.

type URLSet

type URLSet struct {
	XMLName xml.Name     `xml:"urlset"`
	XMLNS   string       `xml:"xmlns,attr"`
	URLs    []SitemapURL `xml:"url"`
}

URLSet represents the root element of a sitemap.

type WikilinkHoverPlugin added in v0.2.0

type WikilinkHoverPlugin struct {
	// contains filtered or unexported fields
}

WikilinkHoverPlugin adds hover preview data attributes to wikilinks. It runs at the render stage (after wikilinks have been converted to HTML). This plugin finds <a class="wikilink"> tags and adds: - data-preview: truncated description/content for hover tooltips - data-preview-image: featured image URL if available - data-preview-screenshot: screenshot URL if service is configured

func NewWikilinkHoverPlugin added in v0.2.0

func NewWikilinkHoverPlugin() *WikilinkHoverPlugin

NewWikilinkHoverPlugin creates a new WikilinkHoverPlugin with default settings.

func (*WikilinkHoverPlugin) Config added in v0.2.0

Config returns the current plugin configuration.

func (*WikilinkHoverPlugin) Configure added in v0.2.0

func (p *WikilinkHoverPlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin from config.Extra. Configuration is expected under the "wikilink_hover" key.

func (*WikilinkHoverPlugin) Name added in v0.2.0

func (p *WikilinkHoverPlugin) Name() string

Name returns the unique name of the plugin.

func (*WikilinkHoverPlugin) Priority added in v0.2.0

func (p *WikilinkHoverPlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin's priority for a given stage. This plugin runs late in render stage (after wikilinks have been converted).

func (*WikilinkHoverPlugin) Render added in v0.2.0

Render processes wikilinks in all post HTML to add hover data attributes.

func (*WikilinkHoverPlugin) SetConfig added in v0.2.0

func (p *WikilinkHoverPlugin) SetConfig(config models.WikilinkHoverConfig)

SetConfig sets the plugin configuration directly. This is useful for testing or programmatic configuration.

type WikilinksPlugin

type WikilinksPlugin struct {
	// contains filtered or unexported fields
}

WikilinksPlugin transforms [[slug]] and [[slug|text]] wikilink syntax into HTML anchor tags during the transform stage.

func NewWikilinksPlugin

func NewWikilinksPlugin() *WikilinksPlugin

NewWikilinksPlugin creates a new WikilinksPlugin.

func (*WikilinksPlugin) Configure

func (p *WikilinksPlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin.

func (*WikilinksPlugin) Name

func (p *WikilinksPlugin) Name() string

Name returns the unique name of the plugin.

func (*WikilinksPlugin) SetWarnOnBroken

func (p *WikilinksPlugin) SetWarnOnBroken(warn bool)

SetWarnOnBroken enables or disables warnings for broken links.

func (*WikilinksPlugin) Transform

func (p *WikilinksPlugin) Transform(m *lifecycle.Manager) error

Transform processes wikilinks in all post content.

type YouTubePlugin added in v0.3.0

type YouTubePlugin struct {
	// contains filtered or unexported fields
}

YouTubePlugin converts YouTube URLs into embedded iframes. It runs at the render stage (after markdown conversion) and handles both plain URLs and autolinked URLs (from the Linkify extension).

func NewYouTubePlugin added in v0.3.0

func NewYouTubePlugin() *YouTubePlugin

NewYouTubePlugin creates a new YouTubePlugin with default settings.

func (*YouTubePlugin) Config added in v0.3.0

func (p *YouTubePlugin) Config() models.YouTubeConfig

Config returns the current plugin configuration.

func (*YouTubePlugin) Configure added in v0.3.0

func (p *YouTubePlugin) Configure(m *lifecycle.Manager) error

Configure reads configuration options for the plugin from config.Extra. Configuration is expected under the "youtube" key.

func (*YouTubePlugin) Name added in v0.3.0

func (p *YouTubePlugin) Name() string

Name returns the unique name of the plugin.

func (*YouTubePlugin) Priority added in v0.3.0

func (p *YouTubePlugin) Priority(stage lifecycle.Stage) int

Priority returns the plugin's priority for a given stage. This plugin runs after render_markdown (which has default priority 0).

func (*YouTubePlugin) Render added in v0.3.0

func (p *YouTubePlugin) Render(m *lifecycle.Manager) error

Render processes YouTube URLs in the rendered HTML.

func (*YouTubePlugin) SetConfig added in v0.3.0

func (p *YouTubePlugin) SetConfig(config models.YouTubeConfig)

SetConfig sets the plugin configuration directly.

Jump to

Keyboard shortcuts

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