views

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package views provides HTML template rendering for the documentation portal.

Package views provides HTML template rendering for the documentation portal.

Index

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 New

func New() *Renderer

New creates a new view Renderer with all templates parsed.

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

func (v *Renderer) RenderHome(w io.Writer, repos []core.RepoInfo, partial bool) error

RenderHome renders the home page with repository listing.

func (*Renderer) RenderNotFound

func (v *Renderer) RenderNotFound(w io.Writer) error

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.

Jump to

Keyboard shortcuts

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