# special_blocks URL: /api/parser/blocks/special_blocks/ Section: blocks -------------------------------------------------------------------------------- special_blocks - Kida window.BENGAL_THEME_DEFAULTS = { appearance: 'light', palette: 'brown-bengal' }; window.Bengal = window.Bengal || {}; window.Bengal.enhanceBaseUrl = '/kida/assets/js/enhancements'; window.Bengal.watchDom = true; window.Bengal.debug = false; window.Bengal.enhanceUrls = { 'toc': '/kida/assets/js/enhancements/toc.632a9783.js', 'docs-nav': '/kida/assets/js/enhancements/docs-nav.57e4b129.js', 'tabs': '/kida/assets/js/enhancements/tabs.aac9e817.js', 'lightbox': '/kida/assets/js/enhancements/lightbox.1ca22aa1.js', 'interactive': '/kida/assets/js/enhancements/interactive.fc077855.js', 'mobile-nav': '/kida/assets/js/enhancements/mobile-nav.d991657f.js', 'action-bar': '/kida/assets/js/enhancements/action-bar.d62417f4.js', 'copy-link': '/kida/assets/js/enhancements/copy-link.7d9a5c29.js', 'data-table': '/kida/assets/js/enhancements/data-table.1f5bc1eb.js', 'lazy-loaders': '/kida/assets/js/enhancements/lazy-loaders.a5c38245.js', 'holo': '/kida/assets/js/enhancements/holo.ee13c841.js', 'link-previews': '/kida/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 )彡 DocumentationInfoAboutArrow ClockwiseGet StartedCodeSyntaxTerminalUsageNoteTutorialsStarburstExtendingBookmarkReferenceTroubleshootingReleasesDevGitHubKida 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 Info About Arrow Clockwise Get Started Code Syntax Terminal Usage Note Tutorials Starburst Extending Bookmark Reference Troubleshooting Releases Dev Caret Down GitHub Kida API Reference Palette Appearance Chevron Down Mode Monitor System Sun Light Moon Dark Palette Snow Lynx Brown Bengal Silver Bengal Charcoal Bengal Blue Bengal Kida API Reference Caret Right Analysis analyzer cache config dependencies landmarks metadata purity roles Caret Right Compiler Caret Right Statements basic control_flow functions special_blocks template_structure variables _protocols coalescing core expressions utils Caret Right Environment core exceptions filters loaders protocols registry tests Caret Right Parser Caret Right Blocks control_flow core functions special_blocks template_structure variables _protocols core errors expressions statements tokens Caret Right Utils html lru_cache workers _types bytecode_cache kida lexer nodes template tstring ParserBlocks ᗢ 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 parser.blocks.special_blocks Special block parsing for Kida parser. Provides mixin for parsing special blocks (with, raw, capture, cache, filter_block). Uses inline TYPE_CHECKING declarations for host attributes. See: plan/rfc-mixin-protocol-typing.md 1Class Classes SpecialBlockParsingMixin 10 ▼ Mixin for parsing special blocks. Host attributes and cross-mixin dependencies are declared via in… Mixin for parsing special blocks. Host attributes and cross-mixin dependencies are declared via inline TYPE_CHECKING blocks. Inherits block stack management from BlockStackMixin. Methods Internal Methods 10 ▼ _parse_with 0 Node ▼ Parse {% with %} in two forms: 1. Conditional: {% with expr %} or {% with expr… def _parse_with(self) -> Node Parse {% with %} in two forms: Conditional: {% with expr %} or {% with expr as name %} Binds expr to 'it' or 'name' Skips body if expr is falsy (nil-resilient) Assignment: {% with name = expr, ... %} Creates variable bindings Always renders body Detection: If first token after 'with' is a NAME followed by '=', it's assignment style. Otherwise it's conditional (expression followed by 'as' or '%' }). Returns Node _is_assignment_style_with 0 bool ▼ Detect assignment-style: {% with name = expr %}. Returns True if current token… def _is_assignment_style_with(self) -> bool Detect assignment-style: {% with name = expr %}. Returns True if current token is NAME and next token is ASSIGN. Returns bool _parse_assignment_with 1 With ▼ Parse assignment-style: {% with x = expr, y = expr2 %}...{% end %}. Always ren… def _parse_assignment_with(self, start: Token) -> With Parse assignment-style: {% with x = expr, y = expr2 %}...{% end %}. Always renders body with the specified variable bindings. Parameters Name Type Description start — Returns With _parse_conditional_with 1 WithConditional ▼ Parse conditional: {% with expr %} or {% with expr as name %}...{% end %}. Ren… def _parse_conditional_with(self, start: Token) -> WithConditional Parse conditional: {% with expr %} or {% with expr as name %}...{% end %}. Renders body only if expr is truthy. Binds expr to 'name' or 'it'. Supports multiple expressions and bindings: {% with a, b as x, y %}. Also supports {% else %} or {% empty %} for falsy cases. Parameters Name Type Description start — Returns WithConditional _parse_raw 0 Raw ▼ Parse {% raw %}...{% endraw %. Raw block that prevents template processing of … def _parse_raw(self) -> Raw Parse {% raw %}...{% endraw %. Raw block that prevents template processing of its content. Returns Raw _parse_capture 0 Capture ▼ Parse {% capture name %}...{% end %} or {% endcapture %. Capture rendered cont… def _parse_capture(self) -> Capture Parse {% capture name %}...{% end %} or {% endcapture %. Capture rendered content into a variable. Returns Capture _parse_cache 0 Cache ▼ Parse {% cache key %}...{% end %} or {% endcache %. Fragment caching with opti… def _parse_cache(self) -> Cache Parse {% cache key %}...{% end %} or {% endcache %. Fragment caching with optional TTL. Returns Cache _parse_filter_block 0 FilterBlock ▼ Parse {% filter name %}...{% end %} or {% endfilter %. Apply a filter to an en… def _parse_filter_block(self) -> FilterBlock Parse {% filter name %}...{% end %} or {% endfilter %. Apply a filter to an entire block of content. Returns FilterBlock _parse_spaceless 0 Spaceless ▼ Parse {% spaceless %}...{% end %} or {% endspaceless %}. Removes whitespace be… def _parse_spaceless(self) -> Spaceless Parse {% spaceless %}...{% end %} or {% endspaceless %}. Removes whitespace between HTML tags. Part of RFC: kida-modern-syntax-features. Returns Spaceless _parse_embed 0 Embed ▼ Parse {% embed 'template.html' %}...{% end %} or {% endembed %}. Embed is like… def _parse_embed(self) -> Embed Parse {% embed 'template.html' %}...{% end %} or {% endembed %}. Embed is like include but allows block overrides. Part of RFC: kida-modern-syntax-features. Returns Embed ← Previous functions Next → template_structure List © 2026 Kida 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: '/kida/assets/js/tabulator.min.js', dataTable: '/kida/assets/js/data-table.js', mermaidToolbar: '/kida/assets/js/mermaid-toolbar.9de5abba.js', mermaidTheme: '/kida/assets/js/mermaid-theme.344822c5.js', graphMinimap: '/kida/assets/js/graph-minimap.ff04e939.js', graphContextual: '/kida/assets/js/graph-contextual.355458ba.js' }; window.BENGAL_ICONS = { close: '/kida/assets/icons/close.911d4fe1.svg', enlarge: '/kida/assets/icons/enlarge.652035e5.svg', copy: '/kida/assets/icons/copy.3d56e945.svg', 'download-svg': '/kida/assets/icons/download.04f07e1b.svg', 'download-png': '/kida/assets/icons/image.c34dfd40.svg', 'zoom-in': '/kida/assets/icons/zoom-in.237b4a83.svg', 'zoom-out': '/kida/assets/icons/zoom-out.38857c77.svg', reset: '/kida/assets/icons/reset.d26dba29.svg' }; Arrow Up -------------------------------------------------------------------------------- Metadata: - Word Count: 1108 - Reading Time: 6 minutes