Skip to main content

Module render

Module render 

Source
Expand description

Human-readable and Markdown renderers for commands.

This module exposes three rendering functions and one disambiguation helper:

  • render_help — produces a multi-section plain-text help page (NAME, SUMMARY, DESCRIPTION, USAGE, ARGUMENTS, FLAGS, SUBCOMMANDS, EXAMPLES, BEST PRACTICES, ANTI-PATTERNS). Sections that have no content are omitted.

  • render_subcommand_list — produces a compact two-column listing of canonical summary lines, suitable for a top-level --help display.

  • render_markdown — produces a GitHub-flavored Markdown page with ## headings, argument/flag tables, and fenced code blocks for examples.

  • render_ambiguity — formats a human-readable message when a command token is ambiguous.

  • render_docs — produces a full Markdown reference document for all commands in a crate::query::Registry, with a table of contents and per-command sections separated by ---.

  • render_skill_file — produces a structured Markdown skill file for a single command, encoding best practices, anti-patterns, and examples in a format suitable for loading into an AI agent context (e.g. .claude/commands/).

  • render_skill_files — calls render_skill_file on every command in a crate::query::Registry (depth-first) and concatenates the results separated by ---.

  • render_skill_file_with_frontmatter — produces an agent-consumable Markdown skill file with YAML frontmatter for a single command.

  • render_skill_files_with_frontmatter — renders all skill files in a registry, each optionally prepended with YAML frontmatter.

None of the functions print to stdout/stderr directly; all return a String that the caller can write wherever appropriate.

Structs§

DefaultRenderer
The default renderer. Delegates to the module-level free functions.
SkillFrontmatter
Optional YAML frontmatter to prepend to a skill file.

Enums§

Shell
A supported shell for completion script generation.

Traits§

Renderer
A pluggable renderer for command help, Markdown docs, and disambiguation messages.

Functions§

render_ambiguity
Render a human-readable disambiguation message.
render_completion
Generate a shell completion script for a registry of commands.
render_docs
Render a full Markdown reference document for all commands in a registry.
render_help
Render a human-readable help page for a command.
render_json_schema
Generate a JSON Schema (draft-07) describing the inputs for a command.
render_markdown
Render a Markdown documentation page for a command.
render_resolve_error
Render any crate::ResolveError as a human-readable string.
render_skill_file
Render a structured Markdown skill file for a single command.
render_skill_file_with_frontmatter
Render a skill file with YAML frontmatter prepended.
render_skill_files
Render skill files for every command in a registry.
render_skill_files_with_frontmatter
Render all skill files in the registry, each optionally with its own frontmatter.
render_subcommand_list
Render a compact listing of multiple commands (e.g. for a top-level help).