# mixin URL: /api/parsing/blocks/list/mixin/ Section: list -------------------------------------------------------------------------------- mixin - 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 BlocksList ᗢ 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 parsing.blocks.list.mixin Main list parsing mixin. Provides the ListParsingMixin class that orchestrates list parsing using the modular helper functions. 1Class Classes ListParsingMixin 11 ▼ Mixin for list parsing. Handles nested lists, task lists, continuation paragraphs, and loose/tight… Mixin for list parsing. Handles nested lists, task lists, continuation paragraphs, and loose/tight detection. Required Host Attributes: _source: str _tokens: list[Token] _pos: int _current: Token | None _containers: ContainerStack (Phase 2 shadow stack) Required Host Methods: _at_end() -> bool _advance() -> Token | None _parse_inline(text, location) -> tuple[Inline, ...] _parse_block() -> Block | None _get_line_at(offset) -> str _strip_columns(text, count) -> str Attributes Name Type Description _source str — _tokens list — _pos int — _current Token | None — _containers ContainerStack — Methods Internal Methods 6 ▼ _parse_list 1 List ▼ Parse list (unordered or ordered) with nested list support. **Handles:** - Nes… def _parse_list(self, parent_indent: int = -1) -> List Parse list (unordered or ordered) with nested list support. Handles: Nested lists via indentation tracking Task lists with [ ] and [x] markers Multi-line list items (continuation paragraphs) Loose lists (blank lines between items) Parameters Name Type Description parent_indent — Indent level of parent list (-1 for top-level) Default: -1 Returns List _parse_list_item 7 ListItem ▼ Parse a single list item. Phase 3.2: Uses stack-based loose detection. Loosene… def _parse_list_item(self, marker_token: Token, start_indent: int, content_indent: int, ordered: bool, bullet_char: str, ordered_marker_char: str, marker_stripped: str) -> ListItem Parse a single list item. Phase 3.2: Uses stack-based loose detection. Looseness is marked on the current frame via mark_loose() and propagates to the parent on pop(). Parameters Name Type Description marker_token — start_indent — content_indent — ordered — bullet_char — ordered_marker_char — marker_stripped — Returns ListItem ListItem node _calculate_actual_content_indent 2 int ▼ Calculate actual content indent from first content line. CommonMark: The conte… def _calculate_actual_content_indent(self, tok: Token, marker_stripped: str) -> int Calculate actual content indent from first content line. CommonMark: The content indent is the column position where the first non-space character appears after the marker. For continuation lines, content must be indented to at least this column. For example, in "1. a", the marker "1." ends at column 2, followed by a space, so content starts at column 3. Content indent = 3. Parameters Name Type Description tok — marker_stripped — Returns int _handle_indented_code_in_item 4 str | tuple[list[str], l… ▼ Handle INDENTED_CODE token within a list item. Phase 4: Uses container stack a… def _handle_indented_code_in_item(self, tok: Token, marker_token: Token, content_lines: list[str], item_children: list[Block]) -> str | tuple[list[str], list[Block]] Handle INDENTED_CODE token within a list item. Phase 4: Uses container stack as source of truth for indent context. The stack's content_indent is updated when actual_content_indent is determined, so current().content_indent reflects the correct value. Parameters Name Type Description tok — The INDENTED_CODE token marker_token — The list item's marker token (for location info) content_lines — Current content lines being accumulated item_children — Current block children of the item Returns str | tuple[list[str], list[Block]] "break" - break out of item loop "continue" - continue to next iteration (content_lines, item_children) - updated state _get_marker_indent 1 int ▼ Extract indent level from list marker value. Marker values are prefixed with s… def _get_marker_indent(self, marker_value: str) -> int Extract indent level from list marker value. Marker values are prefixed with spaces by the lexer to encode indent. Parameters Name Type Description marker_value — Returns int _parse_nested_list_from_indented_code 3 List | None ▼ Parse a nested list from an INDENTED_CODE token containing a list marker. def _parse_nested_list_from_indented_code(self, token: Token, original_indent: int, parent_content_indent: int) -> List | None Parameters Name Type Description token — original_indent — parent_content_indent — Returns List | None ← Previous marker Next → nested 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: 1135 - Reading Time: 6 minutes