# container

URL: /patitas/api/directives/builtins/container/
Section: builtins
Description: Container directive for generic wrapper divs.

Provides a generic wrapper div with custom CSS classes.
Similar to Sphinx/MyST container directive.

Use cases:
- Wrapping content with semantic styling
- Creating styled blocks without affecting heading hierarchy
- Grouping related content with a common class

Example:
:::{container} api-section
:class: highlighted

Content here
:::

Thread Safety:
Stateless handler. Safe for concurrent use across threads.

---

> For a complete page index, fetch /patitas/llms.txt.

Open LLM text
(/patitas/api/directives/builtins/container/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Fdirectives%2Fbuiltins%2Fcontainer%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Fdirectives%2Fbuiltins%2Fcontainer%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Fdirectives%2Fbuiltins%2Fcontainer%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Fdirectives%2Fbuiltins%2Fcontainer%2Findex.txt)

Module

#
`directives.builtins.container`

Container directive for generic wrapper divs.

Provides a generic wrapper div with custom CSS classes.
Similar to Sphinx/MyST container directive.

Use cases:

- Wrapping content with semantic styling

- Creating styled blocks without affecting heading hierarchy

- Grouping related content with a common class

Example:

Content here

Thread Safety:

Stateless handler. Safe for concurrent use across threads.

2Classes

## Classes

`ContainerOptions`

0

▼

Options for container directive.

The :class: option adds additional CSS classes beyond
those speci…

Bases:

`StyledOptions (/patitas/api/directives/options/#StyledOptions)`

Options for container directive.

The :class: option adds additional CSS classes beyond
those specified in the title.

`ContainerDirective`

7

▼

Handler for container directive.

Renders a generic wrapper div with custom CSS classes.
The title …

Handler for container directive.

Renders a generic wrapper div with custom CSS classes.
The title line is treated as class names.

Thread Safety:

```
Stateless handler. Safe for concurrent use.
```

#### Attributes

Name
Type
Description

`names`

`ClassVar[tuple[str, ...]]`

—

`token_type`

`ClassVar[str]`

—

`contract`

`ClassVar[DirectiveContract (/patitas/api/directives/contracts/#DirectiveContract) | None]`

—

`options_class`

`ClassVar[type[ContainerOptions (/patitas/api/directives/builtins/container/#ContainerOptions)]]`

—

`preserves_raw_content`

`ClassVar[bool]`

—

#### Methods

`parse`

6

`Directive (/patitas/api/nodes/#Directive)[ContainerOptio…`

▼

Build container AST node.

The title is treated as class name(s). Additional cl…

`def parse(self, name: str, title: str | None, options: ContainerOptions, content: str, children: Sequence[Block], location: SourceLocation) -> Directive[ContainerOptions]`

Build container AST node.

The title is treated as class name(s). Additional classes
from :class: option are merged.

##### Parameters

Name
Type
Description

`name`
`—`

`title`
`—`

`options`
`—`

`content`
`—`

`children`
`—`

`location`
`—`

##### Returns

`Directive (/patitas/api/nodes/#Directive)[ContainerOptions (/patitas/api/directives/builtins/container/#ContainerOptions)]`

`render`

3

▼

Render container to HTML.

Produces a div with the specified classes.

`def render(self, node: Directive[ContainerOptions], rendered_children: str, sb: StringBuilder) -> None`

##### Parameters

Name
Type
Description

`node`
`—`

`rendered_children`
`—`

`sb`
`—`
