help

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: EUPL-1.2 Imports: 7 Imported by: 0

Documentation

Overview

Package help provides display-agnostic help content management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateID

func GenerateID(title string) string

GenerateID creates a URL-safe ID from a title. "Getting Started" -> "getting-started"

Types

type Catalog

type Catalog struct {
	// contains filtered or unexported fields
}

Catalog manages help topics.

func DefaultCatalog

func DefaultCatalog() *Catalog

DefaultCatalog returns a catalog with built-in topics.

func (*Catalog) Add

func (c *Catalog) Add(t *Topic)

Add adds a topic to the catalog.

func (*Catalog) Get

func (c *Catalog) Get(id string) (*Topic, error)

Get returns a topic by ID.

func (*Catalog) List

func (c *Catalog) List() []*Topic

List returns all topics.

func (*Catalog) Search

func (c *Catalog) Search(query string) []*SearchResult

Search searches for topics.

type Frontmatter

type Frontmatter struct {
	Title   string   `yaml:"title"`
	Tags    []string `yaml:"tags"`
	Related []string `yaml:"related"`
	Order   int      `yaml:"order"`
}

Frontmatter represents YAML frontmatter metadata.

func ExtractFrontmatter

func ExtractFrontmatter(content string) (*Frontmatter, string)

ExtractFrontmatter extracts YAML frontmatter from markdown content. Returns the parsed frontmatter and the remaining content.

type SearchResult

type SearchResult struct {
	Topic   *Topic
	Section *Section // nil if topic-level match
	Score   float64
	Snippet string // Context around match
}

SearchResult represents a search match.

type Section

type Section struct {
	ID      string `json:"id"`
	Title   string `json:"title"`
	Level   int    `json:"level"`
	Line    int    `json:"line"`    // Start line in content (1-indexed)
	Content string `json:"content"` // Content under heading
}

Section represents a heading within a topic.

func ExtractSections

func ExtractSections(content string) []Section

ExtractSections parses markdown and returns sections.

type Topic

type Topic struct {
	ID       string    `json:"id"`
	Title    string    `json:"title"`
	Path     string    `json:"path"`
	Content  string    `json:"content"`
	Sections []Section `json:"sections"`
	Tags     []string  `json:"tags"`
	Related  []string  `json:"related"`
	Order    int       `json:"order"` // For sorting
}

Topic represents a help topic/page.

func ParseTopic

func ParseTopic(path string, content []byte) (*Topic, error)

ParseTopic parses a markdown file into a Topic.

Jump to

Keyboard shortcuts

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