userdocs

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package userdocs reads and searches the user docs the programs carry (spec_067_cli_parity CLP-21, CLP-22, CLP-23): pages split into sections at their headings, found by words, each with its address on the site.

Index

Constants

View Source
const Site = "https://retail-cortex.github.io/blitz/"

Site is where the docs are published.

Variables

This section is empty.

Functions

func Excerpt

func Excerpt(hits []Hit, max int) string

Excerpt is hits as the agent reads them: each section's page, heading, address and text, at most max runes in all.

Types

type Hit

type Hit struct {
	Page    *Page
	Section Section
	Score   float64
}

Hit is a section found for a search.

func (Hit) Snippet

func (h Hit) Snippet(n int) string

Snippet is the section's first paragraph, plain and at most n runes.

func (Hit) URL

func (h Hit) URL() string

URL is the hit's address on the site, at its heading.

type Index

type Index struct {
	Pages []*Page
	// contains filtered or unexported fields
}

Index is the docs, read and ready to search.

func Docs

func Docs() *Index

Docs is the index of the docs the program carries, read once.

func Load

func Load(fsys fs.FS) *Index

Load reads every .md file in fsys into an index.

func (*Index) Find

func (ix *Index) Find(topic string) (*Page, bool)

Find is the page a topic names: its path (guide/mcp, mcp), or its title, in any case; false when none does.

func (*Index) Search

func (ix *Index) Search(query string, n int) []Hit

Search finds the n sections that best match query (BM25, with words in the page's title or the heading counting more); none when no word of it is in the docs.

type Page

type Page struct {
	// Path is its file under content/ without .md: guide/mcp, _index.
	Path  string
	Title string
	// Body is its Markdown, without the front matter.
	Body     string
	Sections []Section
}

Page is one page of the docs.

func (Page) URL

func (p Page) URL() string

URL is the page's address on the site.

type Section

type Section struct {
	Heading string
	// Anchor is the heading's id on the site ("" for the page's start).
	Anchor string
	Text   string
}

Section is a page's text under one heading (the page's start has none).

Jump to

Keyboard shortcuts

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