plugins

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 58 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 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.

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"

	// DefaultFeedPath is the default path used for feed files when not specified.
	DefaultFeedPath = "feed"
)

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.

View Source
var KindContainer = ast.NewNodeKind("Container")

KindContainer is the AST node kind for container elements.

View Source
var KindKeys = ast.NewNodeKind("Keys")

KindKeys is the AST node kind for keyboard key elements.

View Source
var KindMark = ast.NewNodeKind("Mark")

KindMark is the AST node kind for mark (highlight) elements.

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 GetBuildCache added in v0.6.0

func GetBuildCache(m *lifecycle.Manager) *buildcache.Cache

GetBuildCache retrieves the build cache from the manager's cache. Returns nil if not found or caching is disabled.

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 ParseFrontmatterWithRaw added in v0.6.0

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

ParseFrontmatterWithRaw is like ParseFrontmatter but also returns the raw frontmatter string. This is useful for computing input hashes for incremental builds.

func PlatformColors added in v0.5.0

func PlatformColors() map[string]string

PlatformColors returns CSS color values for each platform.

func PlatformEmoji added in v0.5.0

func PlatformEmoji() map[string]string

PlatformEmoji returns an emoji for each platform.

func PlatformName added in v0.5.0

func PlatformName() map[string]string

PlatformName returns a display name for each platform.

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 ToModelsConfig added in v0.6.0

func ToModelsConfig(config *lifecycle.Config) *models.Config

ToModelsConfig converts lifecycle.Config to models.Config for template context. This is exported for use by other plugins that need to build template contexts with the full config (e.g., publish_feeds, blogroll).

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. Blank lines are allowed within admonitions if followed by indented content.

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,omitempty"`
	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,omitempty"`
	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. It implements ConfigurePlugin to pre-register synthetic posts for wikilink resolution, and CollectPlugin to generate the actual feed content.

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) Load added in v0.6.0

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

Load pre-registers synthetic posts for auto-generated feeds so they can be resolved by wikilinks during the Transform stage. This runs after posts are loaded but before Transform stage.

func (*AutoFeedsPlugin) Name

func (p *AutoFeedsPlugin) Name() string

Name returns the unique name of the plugin.

func (*AutoFeedsPlugin) Priority added in v0.6.0

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

Priority returns the plugin's priority for a given stage.

type AutoTitlePlugin

type AutoTitlePlugin struct{}

AutoTitlePlugin auto-generates human-readable titles for posts that don't have one. It uses a comprehensive fallback strategy to ensure every post has a title:

  1. Frontmatter title (explicit, highest priority)
  2. First H1 heading from markdown content
  3. Filename-based title (with date prefix stripping)
  4. Directory name (for index.md files)
  5. Generated fallback with timestamp

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. Uses a comprehensive fallback strategy to ensure no post has a nil title.

type BackgroundPlugin added in v0.6.0

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

BackgroundPlugin adds configurable multi-layered background decorations to pages. It runs at the configure stage to validate configuration.

func NewBackgroundPlugin added in v0.6.0

func NewBackgroundPlugin() *BackgroundPlugin

NewBackgroundPlugin creates a new BackgroundPlugin with default settings.

func (*BackgroundPlugin) Config added in v0.6.0

Config returns the current background configuration.

func (*BackgroundPlugin) Configure added in v0.6.0

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

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

func (*BackgroundPlugin) GenerateBackgroundCSS added in v0.6.0

func (p *BackgroundPlugin) GenerateBackgroundCSS() string

GenerateBackgroundCSS generates the CSS for background elements. This is called by templates to inject custom CSS.

func (*BackgroundPlugin) GenerateBackgroundHTML added in v0.6.0

func (p *BackgroundPlugin) GenerateBackgroundHTML() string

GenerateBackgroundHTML generates the HTML for background elements. This is called by templates to inject background decorations.

func (*BackgroundPlugin) GenerateBackgroundScripts added in v0.6.0

func (p *BackgroundPlugin) GenerateBackgroundScripts() string

GenerateBackgroundScripts generates the script tags for background elements. This is called by templates to inject scripts.

func (*BackgroundPlugin) IsEnabled added in v0.6.0

func (p *BackgroundPlugin) IsEnabled() bool

IsEnabled returns whether the background plugin is enabled.

func (*BackgroundPlugin) Name added in v0.6.0

func (p *BackgroundPlugin) Name() string

Name returns the unique name of the plugin.

func (*BackgroundPlugin) SetConfig added in v0.6.0

func (p *BackgroundPlugin) SetConfig(config models.BackgroundConfig)

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

type BlogrollPlugin added in v0.5.0

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

BlogrollPlugin fetches and processes external RSS/Atom feeds. It runs in the Configure stage to register synthetic posts for wikilink resolution, in the Collect stage to gather external feed entries, and in the Write stage to generate blogroll and reader pages.

func NewBlogrollPlugin added in v0.5.0

func NewBlogrollPlugin() *BlogrollPlugin

NewBlogrollPlugin creates a new BlogrollPlugin.

func (*BlogrollPlugin) Collect added in v0.5.0

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

Collect fetches and parses configured external feeds.

func (*BlogrollPlugin) Configure added in v0.6.0

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

Configure registers synthetic posts for blogroll and reader pages so they can be resolved by wikilinks during the Transform stage.

func (*BlogrollPlugin) Name added in v0.5.0

func (p *BlogrollPlugin) Name() string

Name returns the unique name of the plugin.

func (*BlogrollPlugin) Priority added in v0.5.0

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

Priority returns the plugin's priority for a given stage.

func (*BlogrollPlugin) Write added in v0.5.0

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

Write generates the blogroll and reader pages.

type Breadcrumb struct {
	// Label is the display text for the breadcrumb
	Label string `json:"label"`
	// URL is the href for the breadcrumb link
	URL string `json:"url"`
	// IsCurrent indicates if this is the current page (last item)
	IsCurrent bool `json:"is_current"`
	// Position is the 1-indexed position in the trail (for JSON-LD)
	Position int `json:"position"`
}

Breadcrumb represents a single item in the breadcrumb trail.

type BreadcrumbConfig struct {
	// Enabled controls whether breadcrumbs are shown (nil = use default)
	Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
	// Items allows manual override of breadcrumb trail
	Items []BreadcrumbItem `json:"items,omitempty" yaml:"items,omitempty"`
	// ShowHome overrides the global show_home setting
	ShowHome *bool `json:"show_home,omitempty" yaml:"show_home,omitempty"`
	// HomeLabel overrides the global home_label
	HomeLabel string `json:"home_label,omitempty" yaml:"home_label,omitempty"`
}

BreadcrumbConfig holds per-post breadcrumb configuration from frontmatter.

type BreadcrumbItem struct {
	Label string `json:"label" yaml:"label"`
	URL   string `json:"url" yaml:"url"`
}

BreadcrumbItem is a manual breadcrumb entry from frontmatter.

type BreadcrumbListItem struct {
	Type     string `json:"@type"`
	Position int    `json:"position"`
	Name     string `json:"name"`
	Item     string `json:"item,omitempty"`
}

BreadcrumbListItem is a single item in JSON-LD BreadcrumbList.

type BreadcrumbListJSON struct {
	Context         string               `json:"@context"`
	Type            string               `json:"@type"`
	ItemListElement []BreadcrumbListItem `json:"itemListElement"`
}

BreadcrumbListJSON is the JSON-LD structured data for breadcrumbs.

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

BreadcrumbsPlugin generates breadcrumb navigation for posts based on URL path. It supports auto-generation from directory structure, manual override via frontmatter, and produces JSON-LD structured data for SEO.

func NewBreadcrumbsPlugin added in v0.5.0

func NewBreadcrumbsPlugin() *BreadcrumbsPlugin

NewBreadcrumbsPlugin creates a new BreadcrumbsPlugin with default settings.

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

Configure reads configuration options for the plugin.

func (p *BreadcrumbsPlugin) Name() string

Name returns the unique name of the plugin.

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

Priority returns the plugin priority for the given stage. Breadcrumbs should run after auto_title so titles are available.

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

Transform generates breadcrumbs for each post.

type BridgingDetector added in v0.5.0

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

BridgingDetector detects and enriches webmentions with bridging metadata.

func NewBridgingDetector added in v0.5.0

func NewBridgingDetector(config models.BridgesConfig) *BridgingDetector

NewBridgingDetector creates a new BridgingDetector.

func (*BridgingDetector) DetectSource added in v0.5.0

func (d *BridgingDetector) DetectSource(sourceURL, sourceContent string) MentionSource

DetectSource detects the source platform from URL patterns.

func (*BridgingDetector) EnrichMention added in v0.5.0

func (d *BridgingDetector) EnrichMention(mention *ReceivedWebMention)

EnrichMention adds platform-specific metadata to a webmention.

func (*BridgingDetector) ShouldAccept added in v0.5.0

func (d *BridgingDetector) ShouldAccept(mention *ReceivedWebMention) bool

ShouldAccept checks if a mention should be accepted based on filters.

type BuildCachePlugin added in v0.6.0

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

BuildCachePlugin manages incremental build caching. It loads the build cache at the start and saves it at the end. Other plugins can use the cache to skip unchanged posts.

func NewBuildCachePlugin added in v0.6.0

func NewBuildCachePlugin() *BuildCachePlugin

NewBuildCachePlugin creates a new BuildCachePlugin.

func (*BuildCachePlugin) Cache added in v0.6.0

func (p *BuildCachePlugin) Cache() *buildcache.Cache

Cache returns the build cache instance.

func (*BuildCachePlugin) Cleanup added in v0.6.0

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

Cleanup saves the build cache to disk.

func (*BuildCachePlugin) Configure added in v0.6.0

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

Configure loads the build cache and checks for global invalidation.

func (*BuildCachePlugin) Enabled added in v0.6.0

func (p *BuildCachePlugin) Enabled() bool

Enabled returns whether the build cache is enabled.

func (*BuildCachePlugin) Name added in v0.6.0

func (p *BuildCachePlugin) Name() string

Name returns the unique name of the plugin.

func (*BuildCachePlugin) Priority added in v0.6.0

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

Priority returns high priority so it runs early in configure and late in cleanup. For transform, it runs late to collect dependencies after other plugins have processed links.

func (*BuildCachePlugin) Transform added in v0.6.0

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

Transform collects dependencies from posts after wikilinks/embeds have processed them. This runs late in the transform stage to ensure all dependencies have been collected.

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 Container added in v0.6.0

type Container struct {
	ast.BaseBlock
	// Classes holds the CSS classes for this container
	Classes []string
	// ContainerID holds the optional ID for this container
	ContainerID string
	// ExtraAttrs holds additional attributes
	ExtraAttrs map[string]string
}

Container is an AST node representing a container block (::: class).

func NewContainer added in v0.6.0

func NewContainer(classes []string, id string, attrs map[string]string) *Container

NewContainer creates a new Container node.

func (*Container) Dump added in v0.6.0

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

Dump dumps the node for debugging.

func (*Container) Kind added in v0.6.0

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

Kind returns the kind of this node.

type ContainerExtension added in v0.6.0

type ContainerExtension struct{}

ContainerExtension is a goldmark extension for container syntax.

func (*ContainerExtension) Extend added in v0.6.0

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

Extend adds the container parser and renderer to goldmark.

type ContributionGraphPlugin added in v0.6.0

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

ContributionGraphPlugin converts contribution-graph JSON code blocks into rendered Cal-Heatmap calendar heatmaps showing GitHub-style activity. It runs at the render stage (after markdown conversion).

func NewContributionGraphPlugin added in v0.6.0

func NewContributionGraphPlugin() *ContributionGraphPlugin

NewContributionGraphPlugin creates a new ContributionGraphPlugin with default settings.

func (*ContributionGraphPlugin) Config added in v0.6.0

Config returns the current contribution graph configuration.

func (*ContributionGraphPlugin) Configure added in v0.6.0

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

func (*ContributionGraphPlugin) Name added in v0.6.0

func (p *ContributionGraphPlugin) Name() string

Name returns the unique name of the plugin.

func (*ContributionGraphPlugin) Priority added in v0.6.0

func (p *ContributionGraphPlugin) 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 (*ContributionGraphPlugin) Render added in v0.6.0

Render processes contribution-graph code blocks in the rendered HTML for all posts.

func (*ContributionGraphPlugin) SetConfig added in v0.6.0

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

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, and strips wikilinks from all descriptions (including user-provided ones).

type EmbedsPlugin added in v0.5.0

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

EmbedsPlugin processes embed syntax in markdown content. It supports two types of embeds: - Internal embeds: ![[slug]] or ![[slug|display text]] - embed another post from the same site - External embeds: !embed(https://example.com/article) - embed external content with OG metadata

The plugin runs in the Transform stage, before markdown rendering.

func NewEmbedsPlugin added in v0.5.0

func NewEmbedsPlugin() *EmbedsPlugin

NewEmbedsPlugin creates a new EmbedsPlugin with default settings.

func (*EmbedsPlugin) Config added in v0.5.0

func (p *EmbedsPlugin) Config() models.EmbedsConfig

Config returns the current plugin configuration.

func (*EmbedsPlugin) Configure added in v0.5.0

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

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

func (*EmbedsPlugin) Name added in v0.5.0

func (p *EmbedsPlugin) Name() string

Name returns the unique name of the plugin.

func (*EmbedsPlugin) Priority added in v0.5.0

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

Priority returns the plugin's priority for a given stage. This plugin runs early in the transform stage, before wikilinks.

func (*EmbedsPlugin) SetConfig added in v0.5.0

func (p *EmbedsPlugin) SetConfig(config models.EmbedsConfig)

SetConfig sets the plugin configuration directly.

func (*EmbedsPlugin) Transform added in v0.5.0

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

Transform processes embed syntax in all post content.

type FeedStats added in v0.5.0

type FeedStats struct {
	// PostCount is the total number of posts in the feed
	PostCount int `json:"post_count"`
	// TotalWords is the sum of word counts across all posts
	TotalWords int `json:"total_words"`
	// TotalChars is the sum of character counts across all posts
	TotalChars int `json:"total_chars"`
	// TotalReadingTime is the sum of reading times in minutes
	TotalReadingTime int `json:"total_reading_time"`
	// TotalReadingTimeText is a formatted total reading time
	TotalReadingTimeText string `json:"total_reading_time_text"`
	// AverageWords is the average word count per post
	AverageWords int `json:"average_words"`
	// AverageReadingTime is the average reading time per post
	AverageReadingTime int `json:"average_reading_time"`
	// AverageReadingTimeText is formatted average reading time
	AverageReadingTimeText string `json:"average_reading_time_text"`
	// TotalCodeLines is the sum of code lines across all posts
	TotalCodeLines int `json:"total_code_lines"`
	// TotalCodeBlocks is the sum of code blocks across all posts
	TotalCodeBlocks int `json:"total_code_blocks"`
	// PostsByYear maps year to post count for this feed
	PostsByYear map[int]int `json:"posts_by_year"`
	// WordsByYear maps year to total word count for this feed
	WordsByYear map[int]int `json:"words_by_year"`
	// PostsByTag maps tag name to post count for this feed
	PostsByTag map[string]int `json:"posts_by_tag"`
}

FeedStats contains aggregated statistics for a feed.

func GetFeedStats added in v0.5.0

func GetFeedStats(m *lifecycle.Manager, feedSlug string) *FeedStats

GetFeedStats retrieves feed statistics from the cache.

type FeedStatsHelper added in v0.5.0

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

FeedStatsHelper provides template-friendly access to feed-specific statistics.

func (*FeedStatsHelper) AverageReadingTime added in v0.5.0

func (h *FeedStatsHelper) AverageReadingTime() int

AverageReadingTime returns the average reading time per post.

func (*FeedStatsHelper) AverageWords added in v0.5.0

func (h *FeedStatsHelper) AverageWords() int

AverageWords returns the average word count per post.

func (*FeedStatsHelper) Kpi added in v0.5.0

func (h *FeedStatsHelper) Kpi(name string) interface{}

Kpi returns a specific KPI value by name for this feed.

func (*FeedStatsHelper) PostCount added in v0.5.0

func (h *FeedStatsHelper) PostCount() int

PostCount returns the number of posts in the feed.

func (*FeedStatsHelper) PostsByTag added in v0.5.0

func (h *FeedStatsHelper) PostsByTag() map[string]int

PostsByTag returns a map of tag to post count for this feed.

func (*FeedStatsHelper) PostsByYear added in v0.5.0

func (h *FeedStatsHelper) PostsByYear() map[int]int

PostsByYear returns a map of year to post count for this feed.

func (*FeedStatsHelper) TotalCodeBlocks added in v0.5.0

func (h *FeedStatsHelper) TotalCodeBlocks() int

TotalCodeBlocks returns the total number of code blocks in the feed.

func (*FeedStatsHelper) TotalCodeLines added in v0.5.0

func (h *FeedStatsHelper) TotalCodeLines() int

TotalCodeLines returns the total lines of code in the feed.

func (*FeedStatsHelper) TotalReadingTime added in v0.5.0

func (h *FeedStatsHelper) TotalReadingTime() int

TotalReadingTime returns the total reading time for the feed.

func (*FeedStatsHelper) TotalReadingTimeText added in v0.5.0

func (h *FeedStatsHelper) TotalReadingTimeText() string

TotalReadingTimeText returns the formatted total reading time.

func (*FeedStatsHelper) TotalWords added in v0.5.0

func (h *FeedStatsHelper) TotalWords() int

TotalWords returns the total word count for the feed.

func (*FeedStatsHelper) WordsByYear added in v0.5.0

func (h *FeedStatsHelper) WordsByYear() map[int]int

WordsByYear returns a map of year to word count for this feed.

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 ImageZoomPlugin added in v0.6.0

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

ImageZoomPlugin adds optional image zoom/lightbox functionality using GLightbox. It runs at the render stage (post_render, after markdown conversion) to add data-zoomable attributes to images, and at the write stage to inject the required JavaScript and CSS.

func NewImageZoomPlugin added in v0.6.0

func NewImageZoomPlugin() *ImageZoomPlugin

NewImageZoomPlugin creates a new ImageZoomPlugin with default settings.

func (*ImageZoomPlugin) Config added in v0.6.0

Config returns the current image zoom configuration.

func (*ImageZoomPlugin) Configure added in v0.6.0

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

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

func (*ImageZoomPlugin) Name added in v0.6.0

func (p *ImageZoomPlugin) Name() string

Name returns the unique name of the plugin.

func (*ImageZoomPlugin) Priority added in v0.6.0

func (p *ImageZoomPlugin) 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) but BEFORE templates (which uses PriorityLate=100) so that glightbox_enabled is set in config.Extra before templates renders the HTML.

func (*ImageZoomPlugin) Render added in v0.6.0

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

Render processes images in the rendered HTML for all posts. It adds data-glightbox attributes to images that should be zoomable.

func (*ImageZoomPlugin) SetConfig added in v0.6.0

func (p *ImageZoomPlugin) SetConfig(config models.ImageZoomConfig)

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

func (*ImageZoomPlugin) Write added in v0.6.0

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

Write injects GLightbox CSS and JS into posts that need it.

type InlineAttributeTransformer added in v0.6.0

type InlineAttributeTransformer struct{}

InlineAttributeTransformer is a Goldmark AST transformer that handles inline attribute syntax for images and links.

This extends Goldmark's built-in attribute support (which only works for block-level elements like headings) to also work with inline elements.

Supported syntax:

  • {.classname} - adds a CSS class
  • {#idname} - adds an id attribute
  • {.class1 .class2} - multiple classes
  • {#id .class} - id and class combined

Example usage:

![alt text](image.webp){.more-cinematic}
[link text](url){.external-link}

func (*InlineAttributeTransformer) Transform added in v0.6.0

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

Transform implements parser.ASTTransformer. It walks the AST looking for inline elements (images, links) followed by text nodes containing attribute syntax, and applies those attributes to the preceding element.

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` or `jinja_md: true` in their frontmatter are processed.

type Keys added in v0.6.0

type Keys struct {
	ast.BaseInline
	// KeySequence holds the individual keys (e.g., ["Ctrl", "Alt", "Del"])
	KeySequence []string
}

Keys is an AST node representing keyboard keys (++Ctrl+Alt+Del++).

func NewKeys added in v0.6.0

func NewKeys(keys []string) *Keys

NewKeys creates a new Keys node.

func (*Keys) Dump added in v0.6.0

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

Dump dumps the node for debugging.

func (*Keys) Kind added in v0.6.0

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

Kind returns the kind of this node.

type KeysExtension added in v0.6.0

type KeysExtension struct{}

KeysExtension is a goldmark extension for keyboard keys syntax.

func (*KeysExtension) Extend added in v0.6.0

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

Extend adds the keys parser and renderer to goldmark.

type LeaderboardEntry added in v0.6.0

type LeaderboardEntry struct {
	Post      *models.Post `json:"post"`
	Href      string       `json:"href"`
	Title     string       `json:"title"`
	Likes     int          `json:"likes"`
	Reposts   int          `json:"reposts"`
	Replies   int          `json:"replies"`
	Bookmarks int          `json:"bookmarks"`
	Mentions  int          `json:"mentions"`
	Total     int          `json:"total"`
}

LeaderboardEntry represents a post with its webmention counts.

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. Uses ModTime-based caching to skip re-parsing unchanged files.

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 Mark added in v0.6.0

type Mark struct {
	ast.BaseInline
}

Mark is an AST node representing highlighted text (==text==).

func NewMark added in v0.6.0

func NewMark() *Mark

NewMark creates a new Mark node.

func (*Mark) Dump added in v0.6.0

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

Dump dumps the node for debugging.

func (*Mark) Kind added in v0.6.0

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

Kind returns the kind of this node.

type MarkExtension added in v0.6.0

type MarkExtension struct{}

MarkExtension is a goldmark extension for mark (highlight) syntax.

func (*MarkExtension) Extend added in v0.6.0

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

Extend adds the mark parser and renderer to goldmark.

type MentionAuthor added in v0.5.0

type MentionAuthor struct {
	Name  string `json:"name,omitempty"`
	Photo string `json:"photo,omitempty"`
	URL   string `json:"url,omitempty"`
}

MentionAuthor represents the author of a webmention.

type MentionContent added in v0.5.0

type MentionContent struct {
	Text string `json:"text,omitempty"`
	HTML string `json:"html,omitempty"`
}

MentionContent represents the content of a webmention.

type MentionSource added in v0.5.0

type MentionSource int

MentionSource represents the detected source platform of a webmention.

const (
	// SourceWeb is a standard web webmention
	SourceWeb MentionSource = iota
	// SourceBridgyBluesky is a Bluesky mention via Bridgy
	SourceBridgyBluesky
	// SourceBridgyTwitter is a Twitter mention via Bridgy
	SourceBridgyTwitter
	// SourceBridgyMastodon is a Mastodon mention via Bridgy
	SourceBridgyMastodon
	// SourceBridgyGitHub is a GitHub mention via Bridgy
	SourceBridgyGitHub
	// SourceBridgyFlickr is a Flickr mention via Bridgy
	SourceBridgyFlickr
	// SourceCustomBridge is a mention from a custom bridge
	SourceCustomBridge
)

func (MentionSource) String added in v0.5.0

func (s MentionSource) String() string

String returns the string representation of MentionSource.

type MentionsPlugin added in v0.5.0

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

MentionsPlugin transforms @handle syntax into HTML links by resolving handles against blogroll entries.

func NewMentionsPlugin added in v0.5.0

func NewMentionsPlugin() *MentionsPlugin

NewMentionsPlugin creates a new MentionsPlugin.

func (*MentionsPlugin) Configure added in v0.5.0

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

Configure reads configuration options for the plugin.

func (*MentionsPlugin) Name added in v0.5.0

func (p *MentionsPlugin) Name() string

Name returns the unique name of the plugin.

func (*MentionsPlugin) Priority added in v0.5.0

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

Priority returns the plugin's priority for a given stage. Runs after blogroll has cached feed data in Collect stage.

func (*MentionsPlugin) Transform added in v0.5.0

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

Transform processes @mentions in all post content.

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 OGMetadata added in v0.5.0

type OGMetadata struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Image       string `json:"image"`
	SiteName    string `json:"site_name"`
	Type        string `json:"type"`
	FetchedAt   int64  `json:"fetched_at"`
}

OGMetadata holds Open Graph metadata for external embeds.

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

	// Verbose enables verbose output during installation.
	Verbose bool
	// 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. It follows redirect chains (e.g., repo renames) until it finds the final URL with the version tag.

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. On incremental builds with few changes, Pagefind is skipped for speed.

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 supports intelligent light/dark palette mapping: - palette = "everforest" will auto-detect everforest-light and everforest-dark - palette_light and palette_dark can override the auto-detected variants

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 PaletteManifestEntry added in v0.6.0

type PaletteManifestEntry struct {
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
	Variant     string `json:"variant"`
	BaseName    string `json:"baseName"`
}

PaletteManifestEntry represents a palette entry in the manifest.

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 PostStats added in v0.5.0

type PostStats struct {
	// WordCount is the number of words in the post
	WordCount int `json:"word_count"`
	// CharCount is the number of characters (excluding whitespace)
	CharCount int `json:"char_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"`
	// CodeLines is the number of lines of code in code blocks
	CodeLines int `json:"code_lines"`
	// CodeBlocks is the number of code blocks in the post
	CodeBlocks int `json:"code_blocks"`
}

PostStats contains calculated statistics for a single post.

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 {
	// contains filtered or unexported fields
}

PublishFeedsPlugin writes feeds to multiple output formats during the write stage. It also registers synthetic posts in the Configure stage so they can be resolved by wikilinks.

func NewPublishFeedsPlugin

func NewPublishFeedsPlugin() *PublishFeedsPlugin

NewPublishFeedsPlugin creates a new PublishFeedsPlugin.

func (*PublishFeedsPlugin) Configure added in v0.6.0

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

Configure registers synthetic posts for feed pages so they can be resolved by wikilinks. These posts are marked with Skip: true so they don't interfere with normal rendering.

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. Feed generation is parallelized for better performance with many feeds. Uses incremental build cache to skip feeds with unchanged content.

type PublishHTMLPlugin

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

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 ReceivedWebMention added in v0.5.0

type ReceivedWebMention struct {
	// Standard webmention.io fields
	URL        string `json:"url"`
	Source     string `json:"wm-source"`
	Target     string `json:"wm-target"`
	Published  string `json:"published,omitempty"`
	WMProperty string `json:"wm-property"`

	// Author information
	Author MentionAuthor `json:"author,omitempty"`

	// Content information
	Content MentionContent `json:"content,omitempty"`

	// Bridging metadata (enriched by detection)
	SourceSite  MentionSource `json:"source_site,omitempty"`
	Platform    string        `json:"platform,omitempty"`
	Handle      string        `json:"handle,omitempty"`
	OriginalURL string        `json:"original_url,omitempty"`
}

ReceivedWebMention represents an incoming webmention with bridging metadata.

func (*ReceivedWebMention) InteractionType added in v0.5.0

func (m *ReceivedWebMention) InteractionType() string

InteractionType returns the interaction type based on wm-property.

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. Uses build cache to skip re-rendering unchanged content.

Uses two-phase processing for incremental optimization: Phase 1: Quick single-threaded pass to restore cached HTML (no worker overhead) Phase 2: Concurrent processing only for posts that need rendering

type SiteStats added in v0.5.0

type SiteStats struct {
	// TotalPosts is the total number of posts on the site
	TotalPosts int `json:"total_posts"`
	// TotalWords is the sum of word counts across all posts
	TotalWords int `json:"total_words"`
	// TotalChars is the sum of character counts
	TotalChars int `json:"total_chars"`
	// TotalReadingTime is the total reading time in minutes
	TotalReadingTime int `json:"total_reading_time"`
	// TotalReadingTimeText is formatted total reading time
	TotalReadingTimeText string `json:"total_reading_time_text"`
	// AverageWords is the average word count per post
	AverageWords int `json:"average_words"`
	// AverageReadingTime is the average reading time per post
	AverageReadingTime int `json:"average_reading_time"`
	// AverageReadingTimeText is formatted average reading time
	AverageReadingTimeText string `json:"average_reading_time_text"`
	// TotalCodeLines is the total lines of code across the site
	TotalCodeLines int `json:"total_code_lines"`
	// TotalCodeBlocks is the total number of code blocks
	TotalCodeBlocks int `json:"total_code_blocks"`
	// PostsByYear maps year to post count
	PostsByYear map[int]int `json:"posts_by_year"`
	// WordsByYear maps year to total word count
	WordsByYear map[int]int `json:"words_by_year"`
	// PostsByTag maps tag name to post count
	PostsByTag map[string]int `json:"posts_by_tag"`
}

SiteStats contains global statistics across all posts.

func GetSiteStats added in v0.5.0

func GetSiteStats(m *lifecycle.Manager) *SiteStats

GetSiteStats retrieves site-wide statistics from the cache.

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 SlugConflict added in v0.6.0

type SlugConflict struct {
	// Slug is the conflicting slug (empty string means homepage)
	Slug string

	// Sources describes the conflicting content sources
	Sources []string

	// ConflictType indicates the type of conflict
	ConflictType string // "post-post", "post-feed"
}

SlugConflict represents a conflict between content sources that resolve to the same slug.

type SlugConflictError added in v0.6.0

type SlugConflictError struct {
	Message   string
	Conflicts []SlugConflict
}

SlugConflictError is a critical error about slug conflicts. It implements lifecycle.CriticalError to ensure the build fails.

func (*SlugConflictError) Error added in v0.6.0

func (e *SlugConflictError) Error() string

Error implements the error interface.

func (*SlugConflictError) IsCritical added in v0.6.0

func (e *SlugConflictError) IsCritical() bool

IsCritical marks this as a critical error that should halt the build.

type SlugConflictsPlugin added in v0.6.0

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

SlugConflictsPlugin detects slug conflicts between posts and feeds. It runs during the Collect stage after posts are loaded and feeds are configured.

Conflicts detected:

  • Multiple posts resolving to the same slug
  • Post slug matching a feed slug

func NewSlugConflictsPlugin added in v0.6.0

func NewSlugConflictsPlugin() *SlugConflictsPlugin

NewSlugConflictsPlugin creates a new SlugConflictsPlugin.

func (*SlugConflictsPlugin) Collect added in v0.6.0

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

Collect checks for slug conflicts between posts and feeds.

func (*SlugConflictsPlugin) Conflicts added in v0.6.0

func (p *SlugConflictsPlugin) Conflicts() []SlugConflict

Conflicts returns the detected slug conflicts.

func (*SlugConflictsPlugin) Name added in v0.6.0

func (p *SlugConflictsPlugin) Name() string

Name returns the unique name of the plugin.

func (*SlugConflictsPlugin) Priority added in v0.6.0

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

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

func (*SlugConflictsPlugin) SetEnabled added in v0.6.0

func (p *SlugConflictsPlugin) SetEnabled(enabled bool)

SetEnabled enables or disables the plugin.

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 StaticFileConflict added in v0.6.0

type StaticFileConflict struct {
	// GeneratedSource is the source of the generated file (e.g., "pages/robots.md")
	GeneratedSource string

	// GeneratedOutput is the output path of the generated file (e.g., "/robots.txt")
	GeneratedOutput string

	// StaticFile is the path to the conflicting static file (e.g., "static/robots.txt")
	StaticFile string

	// OutputPath is the final output path that both would write to
	OutputPath string
}

StaticFileConflict represents a conflict between a generated file and a static file.

type StaticFileConflictWarning added in v0.6.0

type StaticFileConflictWarning struct {
	Message   string
	Conflicts []StaticFileConflict
}

StaticFileConflictWarning is a warning (not error) about static file conflicts.

func (*StaticFileConflictWarning) Error added in v0.6.0

func (w *StaticFileConflictWarning) Error() string

Error implements the error interface.

func (*StaticFileConflictWarning) IsWarning added in v0.6.0

func (w *StaticFileConflictWarning) IsWarning() bool

IsWarning indicates this is a non-critical warning.

type StaticFileConflictsPlugin added in v0.6.0

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

StaticFileConflictsPlugin detects when static files would clobber generated content. This is a lint rule that warns users when they have both: - A generated file (e.g., robots.md → robots.txt) - A static file (e.g., static/robots.txt)

The static file always wins (copied last), which can cause unexpected behavior like private posts not being added to robots.txt.

func NewStaticFileConflictsPlugin added in v0.6.0

func NewStaticFileConflictsPlugin() *StaticFileConflictsPlugin

NewStaticFileConflictsPlugin creates a new StaticFileConflictsPlugin.

func (*StaticFileConflictsPlugin) Collect added in v0.6.0

Collect checks for conflicts between generated and static files.

func (*StaticFileConflictsPlugin) Conflicts added in v0.6.0

Conflicts returns the detected conflicts.

func (*StaticFileConflictsPlugin) Name added in v0.6.0

Name returns the unique name of the plugin.

func (*StaticFileConflictsPlugin) Priority added in v0.6.0

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

Priority returns the plugin execution priority for the given stage. Run during collect stage after posts are processed but before writing.

func (*StaticFileConflictsPlugin) SetEnabled added in v0.6.0

func (p *StaticFileConflictsPlugin) SetEnabled(enabled bool)

SetEnabled enables or disables the plugin.

func (*StaticFileConflictsPlugin) SetStaticDir added in v0.6.0

func (p *StaticFileConflictsPlugin) SetStaticDir(dir string)

SetStaticDir sets the static directory path.

type StatsHelper added in v0.5.0

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

StatsHelper provides template-friendly access to site statistics. It exposes methods and properties that can be used in Jinja2-style templates for building analytics dashboards and "year in review" style posts.

Template usage examples:

  • {{ stats.total_posts }} - Total number of posts
  • {{ stats.total_words }} - Total word count
  • {{ stats.posts_by_year }} - Map of year to post count
  • {{ stats.kpi("total_posts") }} - Get a specific KPI value
  • {{ stats.for_feed("blog").total_posts }} - Feed-specific stats

func GetStatsHelper added in v0.5.0

func GetStatsHelper(m *lifecycle.Manager) *StatsHelper

GetStatsHelper retrieves the stats helper from the cache.

func NewStatsHelper added in v0.5.0

func NewStatsHelper(m *lifecycle.Manager) *StatsHelper

NewStatsHelper creates a new stats helper for template access.

func (*StatsHelper) AverageReadingTime added in v0.5.0

func (h *StatsHelper) AverageReadingTime() int

AverageReadingTime returns the average reading time per post.

func (*StatsHelper) AverageWords added in v0.5.0

func (h *StatsHelper) AverageWords() int

AverageWords returns the average word count per post.

func (*StatsHelper) ForFeed added in v0.5.0

func (h *StatsHelper) ForFeed(feedName string) *FeedStatsHelper

ForFeed returns a FeedStatsHelper for feed-specific statistics.

func (*StatsHelper) Kpi added in v0.5.0

func (h *StatsHelper) Kpi(name string) interface{}

Kpi returns a specific KPI value by name. Supported KPIs: total_posts, total_words, total_reading_time, average_words, average_reading_time, total_code_lines, total_code_blocks

func (*StatsHelper) PostsByTag added in v0.5.0

func (h *StatsHelper) PostsByTag() map[string]int

PostsByTag returns a map of tag name to post count.

func (*StatsHelper) PostsByYear added in v0.5.0

func (h *StatsHelper) PostsByYear() map[int]int

PostsByYear returns a map of year to post count.

func (*StatsHelper) TotalCodeBlocks added in v0.5.0

func (h *StatsHelper) TotalCodeBlocks() int

TotalCodeBlocks returns the total number of code blocks.

func (*StatsHelper) TotalCodeLines added in v0.5.0

func (h *StatsHelper) TotalCodeLines() int

TotalCodeLines returns the total lines of code.

func (*StatsHelper) TotalPosts added in v0.5.0

func (h *StatsHelper) TotalPosts() int

TotalPosts returns the total number of posts.

func (*StatsHelper) TotalReadingTime added in v0.5.0

func (h *StatsHelper) TotalReadingTime() int

TotalReadingTime returns the total reading time in minutes.

func (*StatsHelper) TotalReadingTimeText added in v0.5.0

func (h *StatsHelper) TotalReadingTimeText() string

TotalReadingTimeText returns the formatted total reading time.

func (*StatsHelper) TotalWords added in v0.5.0

func (h *StatsHelper) TotalWords() int

TotalWords returns the total word count.

func (*StatsHelper) WordsByYear added in v0.5.0

func (h *StatsHelper) WordsByYear() map[int]int

WordsByYear returns a map of year to total word count.

type StatsPlugin added in v0.5.0

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

StatsPlugin calculates comprehensive content statistics for posts and feeds. It provides word count, reading time, character count, and code block metrics for individual posts, and aggregates these statistics at the feed level.

func NewStatsPlugin added in v0.5.0

func NewStatsPlugin() *StatsPlugin

NewStatsPlugin creates a new StatsPlugin with default settings.

func (*StatsPlugin) Collect added in v0.5.0

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

Collect aggregates statistics at the feed level.

func (*StatsPlugin) Configure added in v0.5.0

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

Configure reads configuration options for the plugin.

func (*StatsPlugin) Name added in v0.5.0

func (p *StatsPlugin) Name() string

Name returns the unique name of the plugin.

func (*StatsPlugin) Priority added in v0.5.0

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

Priority returns the plugin priority for the given stage. Stats should run early in transform (after content is loaded) and late in collect (after feeds are populated).

func (*StatsPlugin) Transform added in v0.5.0

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

Transform calculates statistics for each post.

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. Skips posts that don't need rebuilding (incremental builds).

Uses two-phase processing for incremental optimization: Phase 1: Quick single-threaded pass to restore cached HTML (no worker overhead) Phase 2: Concurrent processing only for posts that need rendering

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 WebMention added in v0.5.0

type WebMention struct {
	// Source is the URL of the page containing the link (your page)
	Source string `json:"source"`

	// Target is the URL being linked to (external page)
	Target string `json:"target"`

	// Endpoint is the discovered webmention endpoint
	Endpoint string `json:"endpoint,omitempty"`

	// Sent indicates whether the webmention was successfully sent
	Sent bool `json:"sent"`

	// SentAt is when the webmention was sent
	SentAt *time.Time `json:"sent_at,omitempty"`

	// Error contains any error message from sending
	Error string `json:"error,omitempty"`

	// StatusCode is the HTTP status code from the endpoint
	StatusCode int `json:"status_code,omitempty"`
}

WebMention represents a webmention to be sent.

type WebMentionsPlugin added in v0.5.0

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

WebMentionsPlugin sends outgoing webmentions for external links in posts. It runs in the Collect stage after posts have been rendered and links collected.

func NewWebMentionsPlugin added in v0.5.0

func NewWebMentionsPlugin() *WebMentionsPlugin

NewWebMentionsPlugin creates a new WebMentionsPlugin.

func (*WebMentionsPlugin) Collect added in v0.5.0

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

Collect discovers and sends webmentions for external links.

func (*WebMentionsPlugin) Configure added in v0.5.0

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

Configure reads configuration options for the plugin.

func (*WebMentionsPlugin) Mentions added in v0.5.0

func (p *WebMentionsPlugin) Mentions() []*WebMention

Mentions returns the discovered webmentions.

func (*WebMentionsPlugin) Name added in v0.5.0

func (p *WebMentionsPlugin) Name() string

Name returns the unique name of the plugin.

func (*WebMentionsPlugin) Priority added in v0.5.0

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

Priority returns the plugin's priority for a given stage.

type WebmentionIOResponse added in v0.6.0

type WebmentionIOResponse struct {
	Type     string               `json:"type"`
	Name     string               `json:"name"`
	Children []ReceivedWebMention `json:"children"`
}

WebmentionIOResponse represents the response from webmention.io API.

type WebmentionLeaderboard added in v0.6.0

type WebmentionLeaderboard struct {
	TopLiked      []LeaderboardEntry `json:"top_liked"`
	TopReposted   []LeaderboardEntry `json:"top_reposted"`
	TopReplied    []LeaderboardEntry `json:"top_replied"`
	TopTotal      []LeaderboardEntry `json:"top_total"`
	TotalLikes    int                `json:"total_likes"`
	TotalReposts  int                `json:"total_reposts"`
	TotalReplies  int                `json:"total_replies"`
	TotalMentions int                `json:"total_mentions"`
}

WebmentionLeaderboard holds the sorted leaderboard lists.

type WebmentionsFetchPlugin added in v0.6.0

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

WebmentionsFetchPlugin fetches incoming webmentions from webmention.io.

func NewWebmentionsFetchPlugin added in v0.6.0

func NewWebmentionsFetchPlugin() *WebmentionsFetchPlugin

NewWebmentionsFetchPlugin creates a new WebmentionsFetchPlugin.

func (*WebmentionsFetchPlugin) Configure added in v0.6.0

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

Configure reads configuration options for the plugin.

func (*WebmentionsFetchPlugin) FetchMentions added in v0.6.0

func (p *WebmentionsFetchPlugin) FetchMentions() error

FetchMentions fetches all webmentions from webmention.io for the configured domain.

func (*WebmentionsFetchPlugin) GetMentions added in v0.6.0

func (p *WebmentionsFetchPlugin) GetMentions() []ReceivedWebMention

GetMentions returns all fetched mentions.

func (*WebmentionsFetchPlugin) GetMentionsForURL added in v0.6.0

func (p *WebmentionsFetchPlugin) GetMentionsForURL(targetURL string) []ReceivedWebMention

GetMentionsForURL returns mentions for a specific URL.

func (*WebmentionsFetchPlugin) GroupMentionsByURL added in v0.6.0

func (p *WebmentionsFetchPlugin) GroupMentionsByURL() map[string][]ReceivedWebMention

GroupMentionsByURL groups mentions by their target URL.

func (*WebmentionsFetchPlugin) Name added in v0.6.0

func (p *WebmentionsFetchPlugin) Name() string

Name returns the unique name of the plugin.

func (*WebmentionsFetchPlugin) Priority added in v0.6.0

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

Priority returns the execution priority for this plugin. For Transform stage, run before other plugins that might cache post maps (like jinja_md which runs at PriorityEarly).

func (*WebmentionsFetchPlugin) Transform added in v0.6.0

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

Transform loads cached webmentions and attaches them to posts.

type WebmentionsLeaderboardPlugin added in v0.6.0

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

WebmentionsLeaderboardPlugin calculates top posts by webmention engagement.

func NewWebmentionsLeaderboardPlugin added in v0.6.0

func NewWebmentionsLeaderboardPlugin() *WebmentionsLeaderboardPlugin

NewWebmentionsLeaderboardPlugin creates a new WebmentionsLeaderboardPlugin.

func (*WebmentionsLeaderboardPlugin) Name added in v0.6.0

Name returns the unique name of the plugin.

func (*WebmentionsLeaderboardPlugin) Priority added in v0.6.0

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

Priority returns the execution priority for this plugin. Run after webmentions_fetch (-200) but before jinja_md (-100).

func (*WebmentionsLeaderboardPlugin) Transform added in v0.6.0

Transform calculates the webmention leaderboard and stores it in config.

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