Documentation
¶
Overview ¶
Package views provides HTML template rendering for the documentation portal.
Package views provides HTML template rendering for the documentation portal.
Index ¶
- type DocNode
- type Renderer
- func (v *Renderer) RenderDoc(w io.Writer, doc core.Document, html []byte, headings []core.Heading, ...) error
- func (v *Renderer) RenderHome(w io.Writer, repos []core.RepoInfo, partial bool) error
- func (v *Renderer) RenderNotFound(w io.Writer) error
- func (v *Renderer) RenderRepoIndex(w io.Writer, repo string, docs []core.DocumentMeta, partial bool) error
- func (v *Renderer) RenderSearch(w io.Writer, query string, results *core.SearchResults, partial bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DocNode ¶
type DocNode struct {
Doc *core.DocumentMeta
Name string
Children []DocNode
}
DocNode represents either a document or a folder in the directory tree. When Doc is non-nil, this is a leaf document node and Children is empty. When Doc is nil, this is a folder node and Children holds the subtree.
func BuildDocTree ¶
func BuildDocTree(docs []core.DocumentMeta) []DocNode
BuildDocTree converts a flat list of DocumentMeta into a directory tree. Root-level documents (no "/" in path) appear first, sorted alphabetically by path. Subdirectory groups appear after, sorted alphabetically by folder name. Supports arbitrary nesting depth via recursion. The original DocumentMeta values (including full paths) are never mutated.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer renders HTML views for the documentation portal.
func (*Renderer) RenderDoc ¶
func (v *Renderer) RenderDoc(w io.Writer, doc core.Document, html []byte, headings []core.Heading, navDocs []core.DocumentMeta, partial bool) error
RenderDoc renders a document page with sidebar navigation and table of contents. For OpenAPI documents, it renders the Scalar API Reference template instead of the markdown prose template.
func (*Renderer) RenderHome ¶
RenderHome renders the home page with repository listing.
func (*Renderer) RenderNotFound ¶
RenderNotFound renders the 404 not found page.
func (*Renderer) RenderRepoIndex ¶
func (v *Renderer) RenderRepoIndex(w io.Writer, repo string, docs []core.DocumentMeta, partial bool) error
RenderRepoIndex renders the repository index page with documents grouped by directory tree.
func (*Renderer) RenderSearch ¶
func (v *Renderer) RenderSearch(w io.Writer, query string, results *core.SearchResults, partial bool) error
RenderSearch renders the search page with results.