# icons

URL: /patitas/api/roles/builtins/icons/
Section: builtins
Description: Icon role handler.

Provides inline SVG icon support via \{icon}`name` syntax.
The icon resolver can be configured per-instance for registry isolation.

---

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

Open LLM text
(/patitas/api/roles/builtins/icons/index.txt)

Share with AI

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

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

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

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

Module

#
`roles.builtins.icons`

Icon role handler.

Provides inline SVG icon support via {icon}`name`syntax.
The icon resolver can be configured per-instance for registry isolation.

1Class

## Classes

`IconRole`

5

▼

Role for inline SVG icons.

Icon rendering requires a resolver function that maps icon names to SVG…

Role for inline SVG icons.

Icon rendering requires a resolver function that maps icon names to SVG.
Without a resolver, this role renders placeholder text.

Usage (with resolver configured):
{icon}`github`→
{icon}`check`→

Usage (without resolver):
{icon}`github`→ [icon:github]

Thread Safety:

```
Instance-level resolver ensures registry isolation.
Safe for concurrent use when resolver is thread-safe.
```

#### Attributes

Name
Type
Description

`names`

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

—

`token_type`

`ClassVar[str]`

—

#### Methods

`parse`

3

`Role (/patitas/api/nodes/#Role)`

▼

Build the icon role AST node.

`def parse(self, name: str, content: str, location: SourceLocation) -> Role`

##### Parameters

Name
Type
Description

`name`
`—`

The role name ("icon")

`content`
`—`

Icon name (e.g., "github", "check")

`location`
`—`

Source location for error reporting

##### Returns

`Role (/patitas/api/nodes/#Role)`

A Role node for the AST

`render`

2

▼

Render icon role to HTML.

`def render(self, node: Role, sb: StringBuilder) -> None`

##### Parameters

Name
Type
Description

`node`
`—`

The Role AST node to render

`sb`
`—`

StringBuilder to append output to

Internal Methods
1

▼

`__init__`

1

▼

Initialize IconRole with optional resolver.

`def __init__(self, resolver: Callable[[str], str | None] | None = None) -> None`

##### Parameters

Name
Type
Description

`resolver`
`—`

Function that takes icon name and returns SVG string or None. If None, icons render as placeholder text.

Default:`None`
