theme

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package theme defines the ThemePlugin capability interface for huan's theme plugin system. Themes are plugins that provide templates, template functions, and static assets for site rendering.

All types are aliased from pkg/plugin so .so plugins share the same type identity.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager 管理主题插件的生命周期和状态。

func NewManager

func NewManager(registry *plugin.Registry) *Manager

NewManager 创建主题管理器。

func (*Manager) Activate

func (m *Manager) Activate(name string) error

Activate 激活指定名称的主题插件。

func (*Manager) Active

func (m *Manager) Active() ThemePlugin

Active 返回当前激活的主题。

func (*Manager) ActiveName

func (m *Manager) ActiveName() string

ActiveName 返回当前激活主题的名称。

func (*Manager) Deactivate

func (m *Manager) Deactivate()

Deactivate 停用当前激活的主题。

func (*Manager) ListAvailable

func (m *Manager) ListAvailable() []ThemePlugin

ListAvailable 列出所有注册了 ThemePlugin 能力的插件。

type ShortcodeProvider

type ShortcodeProvider = pkgplugin.ShortcodeProvider

type TemplateEntry

type TemplateEntry struct {
	Path    string
	Content string
}

TemplateEntry is a helper type for accessing template data from a map.

func DecodeTemplates

func DecodeTemplates(entries []map[string]string) []TemplateEntry

DecodeTemplates parses template entries returned by ThemePlugin.Templates().

type ThemeHooks

type ThemeHooks = pkgplugin.ThemeHooks

type ThemeInfo

type ThemeInfo struct {
	Name        string
	Version     string
	Author      string
	Description string
	Screenshot  string
	Tags        []string
	MinHuanVer  string
}

ThemeInfo is a helper type for accessing theme metadata from a map. The ThemePlugin.Info() method returns map[string]any for cross-module compatibility. Use DecodeInfo() to parse it.

func DecodeInfo

func DecodeInfo(m map[string]any) ThemeInfo

DecodeInfo parses a map returned by ThemePlugin.Info() into ThemeInfo.

type ThemePlugin

type ThemePlugin = pkgplugin.ThemePlugin

All types are aliased from pkg/plugin so .so plugins share the same type identity.

Jump to

Keyboard shortcuts

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