# nodes URL: /api/nodes/ Section: api -------------------------------------------------------------------------------- nodes - Patitas window.BENGAL_THEME_DEFAULTS = { appearance: 'light', palette: 'brown-bengal' }; window.Bengal = window.Bengal || {}; window.Bengal.enhanceBaseUrl = '/patitas/assets/js/enhancements'; window.Bengal.watchDom = true; window.Bengal.debug = false; window.Bengal.enhanceUrls = { 'toc': '/patitas/assets/js/enhancements/toc.632a9783.js', 'docs-nav': '/patitas/assets/js/enhancements/docs-nav.57e4b129.js', 'tabs': '/patitas/assets/js/enhancements/tabs.aac9e817.js', 'lightbox': '/patitas/assets/js/enhancements/lightbox.1ca22aa1.js', 'interactive': '/patitas/assets/js/enhancements/interactive.fc077855.js', 'mobile-nav': '/patitas/assets/js/enhancements/mobile-nav.d991657f.js', 'action-bar': '/patitas/assets/js/enhancements/action-bar.d62417f4.js', 'copy-link': '/patitas/assets/js/enhancements/copy-link.7d9a5c29.js', 'data-table': '/patitas/assets/js/enhancements/data-table.1f5bc1eb.js', 'lazy-loaders': '/patitas/assets/js/enhancements/lazy-loaders.a5c38245.js', 'holo': '/patitas/assets/js/enhancements/holo.ee13c841.js', 'link-previews': '/patitas/assets/js/enhancements/link-previews.8d906535.js' }; (function () { try { var defaults = window.BENGAL_THEME_DEFAULTS || { appearance: 'system', palette: '' }; var defaultAppearance = defaults.appearance; if (defaultAppearance === 'system') { defaultAppearance = (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) ? 'dark' : 'light'; } var storedTheme = localStorage.getItem('bengal-theme'); var storedPalette = localStorage.getItem('bengal-palette'); var theme = storedTheme ? (storedTheme === 'system' ? defaultAppearance : storedTheme) : defaultAppearance; var palette = storedPalette ?? defaults.palette; document.documentElement.setAttribute('data-theme', theme); if (palette) { document.documentElement.setAttribute('data-palette', palette); } } catch (e) { document.documentElement.setAttribute('data-theme', 'light'); } })(); { "prerender": [ { "where": { "and": [ { "href_matches": "/docs/*" }, { "not": { "selector_matches": "[data-external], [target=_blank], .external" } } ] }, "eagerness": "conservative" } ], "prefetch": [ { "where": { "and": [ { "href_matches": "/*" }, { "not": { "selector_matches": "[data-external], [target=_blank], .external" } } ] }, "eagerness": "conservative" } ] } Skip to main content Magnifying Glass ESC Recent Clear Magnifying Glass No results for "" Start typing to search... ↑↓ Navigate ↵ Open ESC Close Powered by Lunr ฅᨐฅ DocumentationArrow ClockwiseGet StartedCodeSyntaxDirectivesStarburstExtendingBookmarkReferenceInfoAboutTroubleshootingReleasesDevGitHubPatitas API Reference Magnifying Glass Search ⌘K Palette Appearance Chevron Down Mode Monitor System Sun Light Moon Dark Palette Snow Lynx Brown Bengal Silver Bengal Charcoal Bengal Blue Bengal List ฅᨐฅ Magnifying Glass Search X Close Documentation Caret Down Arrow Clockwise Get Started Code Syntax Directives Starburst Extending Bookmark Reference Info About Troubleshooting Releases Dev Caret Down GitHub Patitas API Reference Palette Appearance Chevron Down Mode Monitor System Sun Light Moon Dark Palette Snow Lynx Brown Bengal Silver Bengal Charcoal Bengal Blue Bengal Patitas API Reference Caret Right Directives Caret Right Builtins admonition container dropdown tabs contracts decorator options protocol registry Caret Right Lexer Caret Right Classifiers directive fence footnote heading html link_ref list quote thematic Caret Right Scanners block directive fence html core modes Caret Right Parsing Caret Right Blocks Caret Right List blank_line indent item_blocks marker mixin nested trace types core directive footnote table Caret Right Inline core emphasis links match_registry special tokens charsets containers token_nav Caret Right Plugins autolinks footnotes math strikethrough table task_lists Caret Right Renderers html Caret Right Roles Caret Right Builtins formatting icons math reference protocol registry Caret Right Utils hashing logger text errors highlighting icons location nodes parser patitas protocols stringbuilder tokens Patitas API Reference ᗢ Caret Down Link Copy URL External Open LLM text Copy Copy LLM text Share with AI Ask Claude Ask ChatGPT Ask Gemini Ask Copilot Module nodes Typed AST nodes for Patitas. All AST nodes are frozen dataclasses with slots for: Type safety: IDE autocomplete, catch errors at dev time Immutability: Safe sharing across threads (Python 3.14t ready) Memory efficiency: slots reduces memory footprint Pattern matching: Python 3.10+ match statements work naturally Node Hierarchy: Node (base) ├── Block (block-level elements) │ ├── Document │ ├── Heading │ ├── Paragraph │ ├── FencedCode │ ├── IndentedCode │ ├── BlockQuote │ ├── List │ ├── ListItem │ ├── ThematicBreak │ ├── HtmlBlock │ └── Directive └── Inline (inline elements) ├── Text ├── Emphasis ├── Strong ├── Link ├── Image ├── CodeSpan ├── LineBreak ├── HtmlInline └── Role Thread Safety: All nodes are frozen (immutable) and safe to share across threads. 30Classes Classes Node 1 ▼ Base class for all AST nodes. All nodes track their source location for error messages and debuggi… Base class for all AST nodes. All nodes track their source location for error messages and debugging. Attributes Name Type Description location SourceLocation — Text 1 ▼ Plain text content. The most common inline node, representing literal text. Plain text content. The most common inline node, representing literal text. Attributes Name Type Description content str — Emphasis 1 ▼ Emphasized (italic) text. Markdown: *text* or _text_ HTML: <em>text</em> Emphasized (italic) text. Markdown: text or text HTML: text Attributes Name Type Description children tuple[Inline, ...] — Strong 1 ▼ Strong (bold) text. Markdown: **text** or __text__ HTML: <strong>text</strong> Strong (bold) text. Markdown: text or text HTML: text Attributes Name Type Description children tuple[Inline, ...] — Link 3 ▼ Hyperlink. Markdown: [text](url "title") or [text][ref] HTML: <a href="url" title="title">text</a> Hyperlink. Markdown: text or [text][ref] HTML: text Attributes Name Type Description url str — title str | None — children tuple[Inline, ...] — Image 3 ▼ Image. Markdown: ![alt](url "title") HTML: <img src="url" alt="alt" title="title"> Image. Markdown: HTML: Attributes Name Type Description url str — alt str — title str | None — CodeSpan 1 ▼ Inline code. Markdown: `code` HTML: <code>code</code> Inline code. Markdown: code HTML: code Attributes Name Type Description code str — LineBreak 0 ▼ Hard line break. Markdown: ``\`` at end of line or two trailing spaces HTML: <br /> Hard line break. Markdown: \ at end of line or two trailing spaces HTML: SoftBreak 0 ▼ Soft line break (single newline in paragraph). Typically rendered as a space or newline depending … Soft line break (single newline in paragraph). Typically rendered as a space or newline depending on renderer settings. HtmlInline 1 ▼ Inline raw HTML. Markdown: <span>text</span> HTML: passed through unchanged Inline raw HTML. Markdown: text HTML: passed through unchanged Attributes Name Type Description html str — Role 3 ▼ Inline role (MyST syntax). Markdown: {role}`content` Example: {ref}`target`, {kbd}`Ctrl+C` Inline role (MyST syntax). Markdown: content Example: target, Ctrl+C Attributes Name Type Description name str — content str — target str | None — Strikethrough 1 ▼ Strikethrough (deleted) text. Markdown: ~~deleted~~ HTML: <del>deleted</del> Strikethrough (deleted) text. Markdown: deleted HTML: deleted Attributes Name Type Description children tuple[Inline, ...] — Math 1 ▼ Inline math expression. Markdown: $E = mc^2$ HTML: <span class="math">E = mc^2</span> Inline math expression. Markdown: $E = mc^2$ HTML: E = mc^2 Attributes Name Type Description content str — FootnoteRef 1 ▼ Footnote reference. Markdown: [^1] or [^note] HTML: <sup><a href="#fn-1">1</a></sup> Footnote reference. Markdown: [^1] or [^note] HTML: 1 Attributes Name Type Description identifier str — Heading 4 ▼ ATX or setext heading. Markdown: # Heading or Heading ====== HTML: <h1>Heading</h1> S… ATX or setext heading. Markdown: # Heading or Heading ====== HTML: Heading Supports MyST-compatible explicit anchor syntax: ## Title {#custom-id} The {#id} is parsed during lexing and stored in explicit_id. Attributes Name Type Description level Literal[1, 2, 3, 4, 5, 6] — children tuple[Inline, ...] — style Literal['atx', 'setext'] — explicit_id str | None — Paragraph 1 ▼ Paragraph block. Markdown: Text separated by blank lines HTML: <p>text</p> Paragraph block. Markdown: Text separated by blank lines HTML: text Attributes Name Type Description children tuple[Inline, ...] — FencedCode 8 ▼ Fenced code block with zero-copy source reference. BREAKING CHANGE (v0.4.0): Previous: code: s… Fenced code block with zero-copy source reference. BREAKING CHANGE (v0.4.0): Previous: code: str (extracted content) Current: source_start/source_end indices into original source Migration: Old: block.code New: block.get_code(source) For nested contexts (e.g., fenced code inside block quotes), the content_override field stores the actual code content directly since the source offsets would be relative to a sub-parser's source. Attributes Name Type Description source_start int — source_end int — info str | None — marker Literal['`', '~'] — fence_indent int — content_override str | None — Methods get_code 1 str ▼ Extract code content (creates new string). CommonMark: strips up to fence_inde… def get_code(self, source: str) -> str Extract code content (creates new string). CommonMark: strips up to fence_indent spaces from each content line. Parameters Name Type Description source — Returns str code_length 0 int ▼ Length of code content without allocation. def code_length(self) -> int Returns int IndentedCode 1 ▼ Indented code block (4+ spaces). Markdown: ····code HTML: <pre><code>code</code></pre> Indented code block (4+ spaces). Markdown: ····code HTML: code Attributes Name Type Description code str — BlockQuote 1 ▼ Block quote. Markdown: > quoted text HTML: <blockquote>text</blockquote> Block quote. Markdown: > quoted text HTML: text Attributes Name Type Description children tuple[Block, ...] — ListItem 2 ▼ List item. Markdown: - item or 1. item HTML: <li>item</li> List item. Markdown: - item or 1. item HTML: item Attributes Name Type Description children tuple[Block, ...] — checked bool | None — List 4 ▼ Ordered or unordered list. Markdown: - item or 1. item HTML: <ul>/<ol> with <li> children Ordered or unordered list. Markdown: - item or 1. item HTML: / with children Attributes Name Type Description items tuple[ListItem, ...] — ordered bool — start int — tight bool — ThematicBreak 0 ▼ Thematic break (horizontal rule). Markdown: --- or *** or ___ HTML: <hr /> Thematic break (horizontal rule). Markdown: --- or *** or ___ HTML: HtmlBlock 1 ▼ Raw HTML block. Markdown: HTML that starts a block HTML: passed through unchanged Raw HTML block. Markdown: HTML that starts a block HTML: passed through unchanged Attributes Name Type Description html str — Directive 5 ▼ Block directive (MyST syntax). Markdown: :::{name} title :option: value content ::: Gener… Block directive (MyST syntax). Markdown: :::{name} title :option: value content ::: Generic over options type for full type safety. Use Directive[YourOptions] to get typed options access in handlers. PEP 695 Note: Uses Python 3.12+ type parameter syntax: `class Directive[TOptions: DirectiveOptions]` instead of the older `class Directive(Node, Generic[TOptions])` with TypeVar. Attributes Name Type Description name str — title str | None — options TOptions — children tuple[Block, ...] — raw_content str | None — Document 1 ▼ Root document node. Contains all top-level blocks in the document. Root document node. Contains all top-level blocks in the document. Attributes Name Type Description children tuple[Block, ...] — TableCell 3 ▼ Table cell (th or td). Markdown: | cell content | HTML: <td>cell content</td> or <th>cell content<… Table cell (th or td). Markdown: | cell content | HTML: cell content or cell content Attributes Name Type Description children tuple[Inline, ...] — is_header bool — align Literal['left', 'center', 'right'] | None — TableRow 2 ▼ Table row. Markdown: | cell1 | cell2 | HTML: <tr><td>cell1</td><td>cell2</td></tr> Table row. Markdown: | cell1 | cell2 | HTML: cell1cell2 Attributes Name Type Description cells tuple[TableCell, ...] — is_header bool — Table 3 ▼ Table (GFM-style). Markdown: | A | B | |---|---| | 1 | 2 | HTML: <table>...</table> Table (GFM-style). Markdown: | A | B | |---|---| | 1 | 2 | HTML: ... Attributes Name Type Description head tuple[TableRow, ...] — body tuple[TableRow, ...] — alignments tuple[Literal['left', 'center', 'right'] | None, ...] — MathBlock 1 ▼ Block math expression. Markdown: $$ E = mc^2 $$ HTML: <div class="math-block">E = mc^… Block math expression. Markdown: $$ E = mc^2 $$ HTML: E = mc^2 Attributes Name Type Description content str — FootnoteDef 2 ▼ Footnote definition. Markdown: [^1]: Footnote content here. HTML: (rendered in footnotes section) Footnote definition. Markdown: [^1]: Footnote content here. HTML: (rendered in footnotes section) Attributes Name Type Description identifier str — children tuple[Block, ...] — ← Previous location Next → parser List © 2026 Patitas built in ᓚᘏᗢ { "linkPreviews": { "enabled": true, "hoverDelay": 200, "hideDelay": 150, "showSection": true, "showReadingTime": true, "showWordCount": true, "showDate": true, "showTags": true, "maxTags": 3, "includeSelectors": [".prose"], "excludeSelectors": ["nav", ".toc", ".breadcrumb", ".pagination", ".card", "[class*='-card']", ".tab-nav", "[class*='-widget']", ".child-items", ".content-tiles"], "allowedHosts": [], "allowedSchemes": ["https"], "hostFailureThreshold": 3 } } window.BENGAL_LAZY_ASSETS = { tabulator: '/patitas/assets/js/tabulator.min.js', dataTable: '/patitas/assets/js/data-table.js', mermaidToolbar: '/patitas/assets/js/mermaid-toolbar.9de5abba.js', mermaidTheme: '/patitas/assets/js/mermaid-theme.344822c5.js', graphMinimap: '/patitas/assets/js/graph-minimap.ff04e939.js', graphContextual: '/patitas/assets/js/graph-contextual.355458ba.js' }; window.BENGAL_ICONS = { close: '/patitas/assets/icons/close.911d4fe1.svg', enlarge: '/patitas/assets/icons/enlarge.652035e5.svg', copy: '/patitas/assets/icons/copy.3d56e945.svg', 'download-svg': '/patitas/assets/icons/download.04f07e1b.svg', 'download-png': '/patitas/assets/icons/image.c34dfd40.svg', 'zoom-in': '/patitas/assets/icons/zoom-in.237b4a83.svg', 'zoom-out': '/patitas/assets/icons/zoom-out.38857c77.svg', reset: '/patitas/assets/icons/reset.d26dba29.svg' }; Arrow Up -------------------------------------------------------------------------------- Metadata: - Word Count: 1905 - Reading Time: 10 minutes