docs

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package docs serves goblog's builder documentation — how to write and publish plugins and themes — from markdown embedded in the binary, so a site always documents the version it runs.

Index

Constants

View Source
const PageType = "docs"

PageType is the page type this plugin owns.

Variables

This section is empty.

Functions

This section is empty.

Types

type Heading

type Heading struct {
	Level int
	ID    string
	Text  string
}

Heading is one H2/H3 of a rendered page, for its table of contents.

func Render

func Render(src []byte) (template.HTML, []Heading, error)

Render converts one page to HTML and lists its H2/H3 headings in order.

type Plugin

type Plugin struct {
	gplugin.BasePlugin
	// contains filtered or unexported fields
}

Plugin serves the builder documentation at /docs.

func New

func New() *Plugin

New renders every page. A page that fails to render is a build defect, not a runtime condition, so it panics — the package tests catch it first.

func (*Plugin) DisplayName

func (p *Plugin) DisplayName() string

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) OnInit

func (p *Plugin) OnInit(db *gorm.DB) error

OnInit ensures the page row exists (the registry normally creates it first; this is the fallback). A foreign page or a post type on the "docs" slug is left alone with a log line, as the directory plugin does, so Init continues.

func (*Plugin) Pages

func (p *Plugin) Pages() []gplugin.PageDefinition

func (*Plugin) RenderPage

func (p *Plugin) RenderPage(ctx *gplugin.HookContext, pageType string) (string, gin.H)

RenderPage serves the index ("") and one page per slug; anything else is declined so blog answers 404.

func (*Plugin) Search

func (p *Plugin) Search(ctx *gplugin.HookContext, query string) []gplugin.SearchResult

Search answers the site search (plugin.Searcher) with every page whose title or text contains the query — title matches first, then text matches, each in sidebar order — linking under the docs page's current slug.

func (*Plugin) Settings

func (p *Plugin) Settings() []gplugin.SettingDefinition

func (*Plugin) Sitemap

func (p *Plugin) Sitemap(ctx *gplugin.HookContext) []gplugin.SitemapURL

Sitemap lists every docs page but the index (plugin.Sitemapper) under the docs page's current slug; blog lists the page itself.

func (*Plugin) Version

func (p *Plugin) Version() string

Jump to

Keyboard shortcuts

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