render

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 12 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtLine added in v0.3.0

func AtLine(doc *parser.Document, line int)

AtLine answers "what's at line N?" It finds the tightest containing node in the typed AST and prints its kind, location, containing section breadcrumb, and a short preview. Useful when an agent has a line number from elsewhere (a grep hit, a diff, an error) and needs to know what construct lives there.

func ChangedSince added in v0.3.0

func ChangedSince(doc *parser.Document, changed map[int]bool, ref string)

ChangedSince renders the sections and notables that intersect any line in `changed`. It's the CLI answer to "what changed in these docs since ref X?" — each hit shows its breadcrumb and the specific constructs that sit on changed lines.

func ExpandAtLine added in v0.5.0

func ExpandAtLine(doc *parser.Document, line int)

ExpandAtLine dumps the section that contains the given line.

func ExpandSection

func ExpandSection(doc *parser.Document, name string)

ExpandSection prints the original markdown for a named section, including nested headings, with a file:line-range locator agents can jump to.

func FilteredTree

func FilteredTree(doc *parser.Document, filter string)

FilteredTree shows only sections matching the filter

func MultiTree

func MultiTree(docs []*parser.Document, dirName string)

MultiTree renders multiple documents as a combined directory view with aggregated inventory summary at the top and a per-file one-liner that surfaces each file's most signal-dense notables.

func RefsTree

func RefsTree(docs []*parser.Document, dirName string)

RefsTree renders document references (links to other .md files)

func SearchResults added in v0.2.0

func SearchResults(docs []*parser.Document, query string)

SearchResults searches all docs for sections matching the query and renders them best first, each with the lines that matched:

docs/HOOKS.md > Hooks > Why This Matters (93)
  :41  files imported by 3+ others are hub files

so the reader can jump to file:line without expanding the section first.

func SectionNotFound added in v0.6.0

func SectionNotFound(docs []*parser.Document, name string)

SectionNotFound prints the not-found line plus the closest titles, so the next attempt does not have to start with a full tree.

func Tree

func Tree(doc *parser.Document)

Tree renders the full document map

func TypeFilter added in v0.3.0

func TypeFilter(doc *parser.Document, kindName string)

TypeFilter drills down into a single node kind across the whole document. Equivalent to TypeFilterFiltered with no sub-filter.

func TypeFilterDocs added in v0.6.0

func TypeFilterDocs(docs []*parser.Document, kindName, lang, variant string)

TypeFilterDocs is TypeFilterFiltered across a directory: every document that has the construct, skipping the ones that do not, then a total. "Where are the bash examples in these docs" is a directory question.

func TypeFilterFiltered added in v0.3.0

func TypeFilterFiltered(doc *parser.Document, kindName, lang, variant string)

TypeFilterFiltered narrows the --type view further by an optional --lang (for code blocks) or --kind (for callout variants). Unmatched sub-filters are silently ignored when the kind doesn't support them.

Types

type LineHit added in v0.6.0

type LineHit = parser.LineHit

LineHit is one source line that matches a search query.

type SearchResult added in v0.2.0

type SearchResult struct {
	Filename   string
	Path       string // e.g. "endpoints > Ban Member"
	Section    *parser.Section
	TitleMatch bool
	// WholeWord is true when the query matched as a word of its own, not
	// only inside a longer one ("hub" in "github").
	WholeWord bool
	// Hits are the matching lines among the section's own lines (not its
	// subsections'), in order. Count is how many there are; Hits holds at
	// most maxHitsPerSection of them. Both are empty when the section
	// matched only by title or by a typed construct (a code language, a
	// callout kind), or when the document has no line-addressable source.
	Hits  []LineHit
	Count int
}

SearchResult holds a matched section with its file context

func FindSearchResults added in v0.3.1

func FindSearchResults(docs []*parser.Document, query string) []SearchResult

FindSearchResults returns sections matching query using the same title, content, and typed-AST matching as the human renderer, in document order.

func RankSearchResults added in v0.6.0

func RankSearchResults(results []SearchResult) []SearchResult

RankSearchResults orders results by usefulness: sections whose title matches first, then whole-word matches before matches inside a longer word, then by number of matching lines, keeping document order among equals.

Jump to

Keyboard shortcuts

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