Default Commands

Module path
sphinx_doclang.commands

Overview

DocLang includes a very small set of built‑in commands that form the core of the language. These commands are intentionally minimal: they provide only the essential building blocks required for formatting titles, creating sections, generating delimiters and inspecting internal DocLang state during development.

The default commands are not meant to cover every documentation pattern. Most projects define their own commands because documentation needs differ widely between users, domains and codebases. DocLang treats commands as project‑level features, not global standards, which means that custom commands can freely override or replace the defaults without restriction.

This page documents the commands that DocLang provides out of the box. They are intended primarily as examples of how commands behave, how arguments are parsed and how output is generated. Debug and introspection commands are also included to help developers understand the current object context and verify template values during command development.

For real‑world documentation, users are expected to extend DocLang with their own commands tailored to their project’s structure, style and requirements.


Reference

cmd_delimiter(*args, decorator: str = '~', **kwargs) str

Generates a small decorative delimiter line.

The decorator character is just a preference repeated four times to form the output.

Usage:
  • § delimiter

  • § delimiter : decorator = *

cmd_title(name: str, *args, style: str = 'Az', decorator: str = '=', **kwargs) str

Generates a formatted title with an underline.

The style option controls how the title text is transformed:
  • AZ or upper ➜ UPPERCASE

  • az or lower ➜ lowercase

  • Az or capitalize ➜ Capitalized

  • Az Az or camel ➜ Camel Case (capitalize each word)

The underline is created by repeating the decorator character to match the length of the final title.

Usage:
  • § title : My Title

  • § title : my title, style = upper, decorator = -

cmd_section(title: str, *args, style: str = 'Az', decorator: str = '-', **kwargs) list[str]
Creates a section block consisting of:
  • a delimiter line

  • an empty line

  • a formatted title

The style and decorator options are passed directly to the title command.

Usage:
  • § section : My Section

  • § section : utilities, style = upper, decorator = ~

cmd_debug_object(*args, **kwargs) list[str]

Displays debugging information for the current DocLang object.

Usage:
  • § debug object

cmd_self_name(*args, **kwargs) str

Returns the name of the current object.

By default, the short name (without module path) is returned.

If any argument is provided, the full dotted name is returned instead. The actual value or number of arguments does not matter. Providing an argument simply acts as a flag to request the full name.

Usage:
  • § self name

  • § self name : _

cmd_self_type(*args, **kwargs) str

Returns the type of the current object.

The value corresponds to the internal type field stored in the DocLang template context, for example:
  • class

  • function

  • method

  • module

Usage:
  • § self type

cmd_self_doc(*args, **kwargs) str

Returns the full documentation string of the current object.

The content corresponds to the original docstring written by the developer, cleaned only for indentation and formatting consistency.

Usage:
  • § self doc

cmd_self_obj(*args, **kwargs) str

Returns the string representation of the current object.

The surrounding angle brackets are removed to provide a cleaner output.

Usage:
  • § self obj