Module

rendering.plugins.directives.rubric

Rubric directive for Mistune.

Provides styled text that looks like a heading but isn't part of the document hierarchy or table of contents. Perfect for API documentation section labels like "Parameters:", "Returns:", "Raises:", etc.

Architecture:

Migrated to BengalDirective base class as part of directive system v2.

Classes

RubricOptions dataclass
Options for rubric directive.
0

Options for rubric directive.

Inherits from DirectiveOptions

Attributes

Name Type Description
css_class str

Additional CSS classes

_field_aliases ClassVar[dict[str, str]]
RubricDirective
Rubric directive for pseudo-headings. Syntax: :::{rubric} Parameters :class: rubric-parame…
2

Rubric directive for pseudo-headings.

Syntax:

:::{rubric} Parameters
:class: rubric-parameters
:::

Creates styled text that looks like a heading but doesn't appear in TOC. The rubric renders immediately with no content inside - any content is ignored.

Use cases:

  • API documentation section labels (Parameters, Returns, Raises)
  • Section dividers that shouldn't be in navigation
  • Styled labels without heading semantics
Inherits from BengalDirective

Attributes

Name Type Description
NAMES ClassVar[list[str]]
TOKEN_TYPE ClassVar[str]
OPTIONS_CLASS ClassVar[type[DirectiveOptions]]
DIRECTIVE_NAMES ClassVar[list[str]]

Methods 2

parse_directive
Build rubric token from parsed components. Rubrics are label-only - children a…
5 DirectiveToken
def parse_directive(self, title: str, options: RubricOptions, content: str, children: list[Any], state: Any) -> DirectiveToken

Build rubric token from parsed components.

Rubrics are label-only - children are always empty.

Parameters 5
title str
options RubricOptions
content str
children list[Any]
state Any
Returns

DirectiveToken

render
Render rubric to HTML. Renders as a styled div with role="heading" for accessi…
2 str
def render(self, renderer: Any, text: str, **attrs: Any) -> str

Render rubric to HTML.

Renders as a styled div with role="heading" for accessibility. Uses aria-level="5" to not interfere with document outline.

Parameters 2
renderer Any
text str
Returns

str

Functions

render_rubric
Legacy render function for backward compatibility.
2 str
def render_rubric(renderer: Any, text: str, **attrs: Any) -> str

Legacy render function for backward compatibility.

Parameters 2

Name Type Default Description
renderer Any
text str

Returns

str