docref

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package docref is the canonical string form of a documentation reference (ADR-0164 §SD5): the one identifier a search hit carries so any surface — a results row, a query result cell, a launch request — can navigate to the section it names. Rows written to the facts plane outlive whichever process wrote them, which is why the format is frozen here, in one leaf package with no dependencies, rather than derived ad hoc per producer.

Three schemes, one per corpus:

help://<app-id>::<doc>#<slug>   a help-book section (help.RefT)
adr://<num>#<slug>              an ADR section, num zero-padded to 4
chdoc://<name>                  a system.documentation entry

`::` separates the app id from the doc path because app ids are Go import paths and contain `/` — a plain slash would make `help://a/b/c#s` unparseable. The `#<slug>` fragment is optional everywhere it appears; absent means the document (or entry) itself.

Index

Constants

This section is empty.

Variables

View Source
var PackageProps = packageprops.Props{
	WASMWASI:         packageprops.WASMCompiles,
	WASMJS:           packageprops.WASMCompiles,
	WASMFreestanding: packageprops.WASMCompiles,
}

PackageProps records this package's curated properties (ADR-0080). Seeded by `boxer code analysis golang wasmsurvey props generate`; curate by hand. The same group's `props verify` reconciles it.

Functions

func FormatAdr

func FormatAdr(num int, section string) (ref string)

FormatAdr renders an ADR section ref. The number is zero-padded to four digits, matching the corpus filenames.

func FormatChdoc

func FormatChdoc(name string) (ref string)

FormatChdoc renders a system.documentation entry ref.

func FormatHelp

func FormatHelp(appId string, doc string, section string) (ref string)

FormatHelp renders a help-book section ref. Empty section refers to the document itself.

Types

type Ref

type Ref struct {
	Scheme  SchemeE
	AppId   string // SchemeHelp
	Doc     string // SchemeHelp
	Num     int    // SchemeAdr
	Name    string // SchemeChdoc
	Section string // SchemeHelp, SchemeAdr: heading slug, "" = whole doc
}

Ref is a parsed documentation reference. Only the fields of the active Scheme are populated.

func Parse

func Parse(s string) (ref Ref, err error)

Parse reads a canonical ref string. Strict: an unknown scheme, a help ref without the `::` separator, or a non-numeric ADR number is an error, not a guess — refs live in persisted rows, and a lenient parser here would let a malformed producer go unnoticed until its rows stop navigating.

func (Ref) String

func (inst Ref) String() (s string)

String re-renders the ref in its canonical form. The zero Ref renders empty.

type SchemeE

type SchemeE uint8

SchemeE tags which corpus a parsed ref addresses.

const (
	// SchemeInvalid is the zero value; Parse never returns it without
	// an error.
	SchemeInvalid SchemeE = iota
	// SchemeHelp — a help-book section: AppId, Doc, Section.
	SchemeHelp
	// SchemeAdr — an ADR section: Num, Section.
	SchemeAdr
	// SchemeChdoc — a system.documentation entry: Name.
	SchemeChdoc
)

Jump to

Keyboard shortcuts

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