helpdoc

package
v1.75.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package helpdoc formats the text that lisp:help and the help package print.

It is the single definition of that format. Core lisp:help (package lisp) and the help package's registry functions (lisp/lisplib/libhelp) both write through it, and neither can import the other's rendering: libhelp imports lisp, so lisp cannot import libhelp. Everything here therefore works on text the caller has already rendered, and nothing here imports lisp.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanDocRaw

func CleanDocRaw(doc string) string

CleanDocRaw dedents a docstring without word-wrapping. JSON consumers get clean text they can format themselves.

func CleanDocstring

func CleanDocstring(doc string) string

CleanDocstring dedents doc, wraps it at 72 columns and indents it two spaces, the layout help prints.

func DedentDoc

func DedentDoc(s string) string

DedentDoc removes common leading whitespace from all non-empty lines. It handles Go raw string literals where the first line may have less indentation than continuation lines (which inherit the source code's tab indentation). Tabs are normalized to spaces before processing.

func WriteFun

func WriteFun(w io.Writer, opts FunctionDoc) error

WriteFun writes the entry for a function: its kind and rendered signature on one line, then its docstring, or symbolDoc when the function carries no docstring of its own.

func WriteVal

func WriteVal(w io.Writer, opts ValueDoc) error

WriteVal writes the entry for a variable: its type name, its display name and its rendered value on one line, then its cleaned doc, if any.

Types

type FunctionDoc added in v1.75.1

type FunctionDoc struct {
	// FunType is the function kind.
	FunType string
	// Signature is the rendered function signature.
	Signature string
	// Docstring contains the function documentation.
	Docstring string
	// SymbolDoc contains binding documentation.
	SymbolDoc string
}

FunctionDoc holds a function's signature and documentation.

type ValueDoc added in v1.75.1

type ValueDoc struct {
	// TypeName is the value type name.
	TypeName string
	// Name is the display name.
	Name string
	// Rendered is the rendered value.
	Rendered string
	// Doc contains the symbol documentation.
	Doc string
}

ValueDoc holds a value's name, representation and documentation.

Jump to

Keyboard shortcuts

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