Skip to content

feat: Add API to parse one block at the time - #247

Merged
Ilia Permiashkin (p3rmiashkin) merged 4 commits into
masterfrom
ilia.permiashking/block-parse
Oct 14, 2026
Merged

Ilia Permiashkin (p3rmiashkin) merged 4 commits into
masterfrom
ilia.permiashking/block-parse

Conversation

@p3rmiashkin

Copy link
Copy Markdown
Contributor

No description provided.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T15:49:01.004606Z ceb0270 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.


/**
* Parses one top-level block of [text] from [startOffset] with `parseInlines = false`.
* The parse stops at the next line start where no block is open. [startOffset] must be such a line start too.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must

What will happen otherwise?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then guarantee

The children of the result are the same as the children of a full parse in that range.

won't hold

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's probably worth expressing in the doc. Or there could be an assertion

@donnerpeter

Copy link
Copy Markdown
Member

Is there any logic reuse between block boundaries and streaming parser safe separators?

@p3rmiashkin

Ilia Permiashkin (p3rmiashkin) commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Is there any logic reuse between block boundaries and streaming parser safe separators?

StreamingMarkdownFile uses MarkdownParser#parseStreaming => MarkdownParser#doParse with startOffset = 0 and stopAtNextBlock = false. From what I see StreamingMarkdownFile already parses only unstableText with baseOffset = stableTextLength. Maybe parseStreaming can take advantage of new fields somehow, but from what I understand chunk and unstableText can be any piece of text, while parseBlock parses exactly one block from one safe point to the next one

@p3rmiashkin
Ilia Permiashkin (p3rmiashkin) merged commit 7cc8727 into master Oct 14, 2026
6 checks passed
@p3rmiashkin
Ilia Permiashkin (p3rmiashkin) deleted the ilia.permiashking/block-parse branch October 14, 2026 15:48
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.

2 participants