Skip to content

[Feature] scan indented blocks (blockquotes and lists) - #7

Merged
mwittie merged 20 commits into
mainfrom
feature/scan-indented-blocks
Apr 30, 2026
Merged

[Feature] scan indented blocks (blockquotes and lists)#7
mwittie merged 20 commits into
mainfrom
feature/scan-indented-blocks

Conversation

@mwittie

@mwittie mwittie commented Apr 30, 2026

Copy link
Copy Markdown
Owner

Describe your changes

Extends the block scanning logic to handle indented blocks — specifically nested blockquotes and list items. The parser now tracks the indent context (e.g. > , - ) as it traverses the tree-sitter AST, strips those prefixes from block content, and attaches the computed indent string to each Block.

Key changes:

  • Block gains an indent field (the nesting prefix, e.g. > > ) and a continuation field (whether the block starts on the same line as the preceding one).
  • MakeBlocksFromMarkdown is restructured into a blockCollector that recurses into block_quote and list_item nodes, correctly stripping and forwarding indent prefixes.
  • Inline HTML comments are split out of text blocks in a post-processing pass.
  • Unclosed fenced code blocks and HTML comments are now detected and returned as errors.
  • Block kind constants are renamed to snake_case (text, fenced_code, html_comment).
  • Block.Content() now returns string instead of []byte.

Notes for reviewers

Checklist before requesting a review

If any of these checks are missing, please provide an explanation.

  • I have updated README files, if applicable.
  • This PR is small, otherwise explain why.
    • This PR is large because it restructures the core block scanning logic; splitting it further would leave the implementation in an inconsistent intermediate state.

@mwittie mwittie changed the title Feature: scan indented blocks (blockquotes and lists) [Feature] scan indented blocks (blockquotes and lists) Apr 30, 2026
@mwittie
mwittie merged commit c07c37c into main Apr 30, 2026
1 check passed
@mwittie
mwittie deleted the feature/scan-indented-blocks branch April 30, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant