Skip to main content

Module topics

Module topics 

Source
Expand description

Help topic registry (DESIGN.md §5.11).

Hand-written, free-form help docs (the :help <topic> surface, distinct from the introspection-driven :describe-* views) live here. The built-in set is generated from docs/user/**/*.md by build.rs and embedded deflate-compressed, so :help works offline with no filesystem layout assumption beyond the binary itself, without the binary paying raw markdown volume.

The registry is intentionally indirection-friendly:

  • HelpTopicBody::Compressed is what every builtin uses — inflated on first open and cached, so a session that never opens :help never decompresses anything.
  • HelpTopicBody::Static embeds compile-time markdown directly.
  • HelpTopicBody::Owned holds runtime markdown — what a plugin’s pages land as, having crossed the WASM boundary as a String.
  • HelpTopicBody::Dynamic takes a closure that produces text on demand – this is the seam for LSP-driven topics (:help symbol::Foo) and in-process introspection that can’t be captured at compile time.

Runtime-writable (CR.1). The host holds this as a HelpTopicRegistryHandle — copy-on-write RCU behind an ArcSwap, the same idiom the command / picker / compilation-parser registries use. Reads are wait-free snapshots taken once per :help invocation; writes happen only on plugin load and unload. That is what lets a plugin ship a :help page: its markdown is baked into its own component and registered through the help WIT seam (CR.3). See docs/dev/architecture/contributable-registries.md.

Topics also carry an optional list of substring patterns that match command names; :describe-command walks these to emit a See also: [topic](help:topic) cross-link when a primitive covered by a topic is described.

Structs§

HelpTopic
One free-form help topic.
HelpTopicRegistry
Catalogue of every registered topic, keyed by name. Plugins and future LSP integrations register through register.
HelpTopicsGenerator
gen:help-topics. Returns one RawCandidate per registered help topic so :help <Tab> enumerates available topics. The payload is CandidateData::Plain – topic name alone is enough for the v1 popup; future polish can introduce a richer HelpTopic variant if summaries need to flow through the matcher / annotator pipeline.

Enums§

HelpTopicBody
Where a topic’s body comes from.

Functions§

builtin_topics
The built-in topic set, generated at build time by build.rs from every docs/user/**/*.md (recursively, skipping tutor/). Each doc’s --- YAML frontmatter supplies summary + related (see the build script); bodies are embedded as string literals so the binary stays self-contained — no runtime filesystem dependency. Adding a doc requires no change here: drop the .md into docs/user/ and it registers automatically. CR.1: returns the registry by value. The caller wraps it in a HelpTopicRegistryHandle via HelpTopicRegistry::into_handle — the builtin set is the initial contents of a runtime-writable registry now, not the whole of it.

Type Aliases§

HelpTopicRegistryHandle
The runtime-mutable handle, registered as a boot service under this exact alias (the ServiceRegistry Arc/TypeId convention).