htmlsite

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package htmlsite generates multi-page HTML documentation sites from graph data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountEdgeTypes

func CountEdgeTypes(edges []*graph.Edge) map[string]int

CountEdgeTypes returns a map of edge type -> count.

func CountNodeTypes

func CountNodeTypes(nodes []*graph.Node) map[string]int

CountNodeTypes returns a map of node type -> count.

func FilterGraphByPath

func FilterGraphByPath(nodes []*graph.Node, edges []*graph.Edge, localPath string) ([]*graph.Node, []*graph.Edge)

FilterGraphByPath returns nodes and edges that belong to a specific local path. It filters nodes based on the source_file attribute prefix.

func GetSystemNodes

func GetSystemNodes(nodes []*graph.Node, edges []*graph.Edge) ([]*graph.Node, []*graph.Edge)

GetSystemNodes returns all system-level nodes (system, service, repository types).

func HasSystemNode

func HasSystemNode(nodes []*graph.Node) bool

HasSystemNode checks if the graph contains a system node (indicating multi-service mode).

Types

type CommunityInfo

type CommunityInfo struct {
	ID        int
	NodeCount int
	EdgeCount int
}

CommunityInfo contains metadata about a community for display.

type Generator

type Generator struct {
	// Title is the site title.
	Title string

	// Description is an optional site description.
	Description string

	// DarkMode enables dark theme.
	DarkMode bool

	// IncludeCommunities enables community page generation.
	IncludeCommunities bool

	// ExcludeIaC filters out Helm, Terraform, and other IaC nodes.
	ExcludeIaC bool
}

Generator creates multi-page HTML documentation sites.

func NewGenerator

func NewGenerator() *Generator

NewGenerator creates a Generator with default settings.

func (*Generator) Generate

func (g *Generator) Generate(nodes []*graph.Node, edges []*graph.Edge, manifest *source.Manifest) (*SiteContent, error)

Generate creates the multi-page HTML site.

type IndexData

type IndexData struct {
	Title          string
	Description    string
	DarkMode       bool
	CSS            string
	TotalNodes     int
	TotalEdges     int
	SourceCount    int
	HasServices    bool
	HasCommunities bool
	Services       []ServiceInfo
	Communities    []CommunityInfo
	GraphJSON      template.JS
}

IndexData is the template data for the index page.

type ServiceData

type ServiceData struct {
	SiteTitle      string
	DarkMode       bool
	CSS            string
	HasCommunities bool
	Service        ServiceInfo
	NodeTypeCounts map[string]int
	EdgeTypeCounts map[string]int
	GraphJSON      template.JS
}

ServiceData is the template data for service pages.

type ServiceInfo

type ServiceInfo struct {
	Name        string
	Slug        string
	Description string
	RepoURL     string
	LocalPath   string
	NodeCount   int
	EdgeCount   int
}

ServiceInfo contains metadata about a service for display.

type ServiceMapping

type ServiceMapping struct {
	Name      string
	Slug      string
	RepoURL   string
	LocalPath string
}

ServiceMapping maps a service to its repository and local path.

func BuildServiceMappings

func BuildServiceMappings(nodes []*graph.Node, edges []*graph.Edge, manifest *source.Manifest) []ServiceMapping

BuildServiceMappings extracts service-to-repo mappings from graph data. It finds svc:X nodes and their links_to repo:URL edges, then matches repo URLs to manifest source paths.

type SiteContent

type SiteContent struct {
	Index       []byte            // index.html content
	Services    map[string][]byte // service slug -> HTML content
	Communities map[int][]byte    // community ID -> HTML content
}

SiteContent holds all generated pages.

type Templates

type Templates struct {
	Index   *template.Template
	Service *template.Template
	CSS     string
}

Templates holds the parsed HTML templates.

func LoadTemplates

func LoadTemplates() (*Templates, error)

LoadTemplates loads and parses all embedded templates.

Jump to

Keyboard shortcuts

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