fix(comark): absorb markdown under incomplete HTML openers - #390
Open
farnabaz wants to merge 7 commits into
Open
fix(comark): absorb markdown under incomplete HTML openers#390farnabaz wants to merge 7 commits into
farnabaz wants to merge 7 commits into
Conversation
Leave single-line incomplete open tags (e.g. `<ai-thinking>\n**bold**`) as opener-only html_block tokens so the following markdown can be absorbed as children, matching the blank-line incomplete case.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
comark
@comark/angular
@comark/ansi
@comark/html
@comark/nuxt
@comark/react
@comark/svelte
@comark/vue
commit: |
Contributor
📦 Bundle size snapshot is out of dateThe published size of one or more packages changed, so the inline snapshot in Please review the diff below. If the change is expected, accept the new snapshot:
Only maintainers with write access can trigger the update. You can also comment Bundle size diff FAIL test/bundle.test.ts > package bundle size > published size of each package
Error: Snapshot `package bundle size > published size of each package 1` mismatched
- Expected
+ Received
@@ -4,7 +4,7 @@
"@comark/html": "18.9k (58 files)",
"@comark/nuxt": "11.8k (58 files)",
"@comark/react": "43.6k (74 files)",
"@comark/svelte": "43.9k (82 files)",
"@comark/vue": "60.5k (78 files)",
- "comark": "424k (156 files)",
+ "comark": "433k (156 files)",
}
❯ test/bundle.test.ts:61:20
59| }
60|
61| expect(report).toMatchInlineSnapshot(`
| ^
62| {
63| "@comark/angular": "60.6k (70 files)",
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ |
A `$` at end of line (or with only trailing whitespace) is not an incomplete inline-math opener, so auto-close leaves it alone instead of appending `$`.
Incomplete HTML openers with a later matching closer now absorb intervening tokens (including nested same-tag blocks) as children, so cases like details-in-details build a proper tree instead of sibling empties.
Markdown stringify no longer glues `</summary>Nested content`. HTML wrappers with a lone markdown paragraph among HTML siblings still auto-unwrap that paragraph; multi-block bodies keep their `<p>` structure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Incomplete block HTML open tags (e.g. streaming
<ai-thinking>…with no closer) now wrap following markdown as children with$: { html: 1, block: 0 }, including the single-newline case where CommonMark would otherwise swallow the body into one rawhtml_block.Why
During AI/streaming output, custom tags often arrive without a closing tag yet. The previous CommonMark-faithful path left the opener empty and the body as siblings, so renderers could not keep the unfinished element around its content. Blank-line-terminated incomplete openers were fixed first; the blank-line-less case still needed the block rule to stop at the opener line so the token processor can absorb the rest.