fix(js): preserve <shiny-aside> in Markdown list items - #305
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves shinychat’s Markdown pipeline so rich <shiny-aside> blocks that are opened from within Markdown list items remain structurally attached to the correct list item. It does this by normalizing the indentation of complete asides discovered in list-item contexts and then re-parsing the full Markdown document so that reference definitions/footnotes and list structure are preserved.
Changes:
- Added a remark plugin that detects complete
<shiny-aside>...</shiny-aside>regions opened from list items and rewrites their continuation indentation so the aside body stays inside the list item. - Integrated the new normalization plugin into the main
markdownProcessorpipeline (beforeremark-rehype). - Expanded tests to cover list-adjacent rich asides (including nested lists, blockquotes, reference definitions, footnotes, and URL sanitization) and streaming finalization behavior; updated distributed asset version stamps.
Reviewed changes
Copilot reviewed 6 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg-r/inst/lib/shiny/GIT_VERSION | Updates packaged web-asset version stamp for the R distribution. |
| pkg-py/src/shinychat/www/GIT_VERSION | Updates packaged web-asset version stamp for the Python distribution. |
| js/tests/markdown/plugins/rewriteAsideTemplate.test.ts | Adds Markdown parsing assertions for list-item asides, nesting, refs/footnotes, and literal-aside-in-code scenarios. |
| js/tests/chat/AsideGroup.test.tsx | Adds a streaming/non-streaming render test ensuring adjacent list-item asides finalize correctly without corrupting list structure. |
| js/src/markdown/processors.ts | Wires the new remark normalization step into the main markdown processor. |
| js/src/markdown/plugins/normalizeAsideMarkdown.ts | Implements the list-item aside indentation normalization + document reparse transformer. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
<shiny-aside> in Markdown list items
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.
Follow up to #278
Why this matters
Rich
<shiny-aside>content can follow claims in Markdown lists without changing list structure, corrupting the aside body, or losing document-scoped Markdown behavior.Previously, the Markdown parser could place an aside opener inside a list item while placing its block body and closing tag outside the list. The resulting raw HTML span caused adjacent list items to nest incorrectly.
What changed
Complete asides opened from list items are normalized to the list item's required continuation indentation before the complete document is parsed again. Keeping the final Markdown in one document parse preserves reference definitions, footnotes, nested-list structure, and relative code indentation without replacing micromark's list tokenizer.
The change also preserves:
The rebuilt JavaScript assets are included for the Python and R packages.
Verification
npm run lintnpm run buildjs/dist, Python, and R package assets