Documentation
¶
Overview ¶
Package theme holds the built-in html/template set (layout, page, dirlist, tree) and static assets (CSS, enhancement JS, vendored mermaid.js), all embedded via go:embed. Customization is three-tiered: CSS variables, appended CSS, template override. Template names are public API — add sparingly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Crumb ¶
Crumb is one breadcrumb item. Href is already relative to the current page; Current marks the terminal crumb so templates can render it without a link.
type DirEntry ¶
type DirEntry struct {
Name string
Path string
Href string
Kind string
Size int64
LastCommit *source.Commit
IsDir bool
}
DirEntry is one child row rendered by the "dirlist" template. Href is already relative to the current directory page.
type PageData ¶
type PageData struct {
Title, SiteTitle string
RelRoot string
Breadcrumbs []Crumb
Tree *TreeNode
Kind string
KindLabel string
Body template.HTML
TOC []render.TOCItem
MirrorHref string
SourceHref string
FileSize int64
RepoPath string
TOCPanel string
UI map[string]string
LastCommit *source.Commit
HasMermaid, NoIndex bool
SearchEnabled bool
HeadExtra template.HTML
DirEntries []DirEntry
// Lang 为 <html lang> 属性值(site.language),空则省略该属性。
Lang string
}
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer owns the parsed template set and static theme resources.
func (*Renderer) WriteAssets ¶
type TreeNode ¶
type TreeNode struct {
Name string
Path string
Href string
Kind string
IsDir bool
Current bool
Expanded bool
// SearchEnabled controls the tree-top search entry on the root node.
SearchEnabled bool
Children []*TreeNode
}
TreeNode is the file-tree shape consumed by the "tree" template. Href is already relative to the current page. Directories use Expanded for the current-path ancestors and Current when the directory page itself is active.