Skip to content

fix(web): markdown should pre-set slot#2516

Merged
Sherry-hue merged 1 commit intolynx-family:mainfrom
Sherry-hue:fix/markdown-slot
Apr 23, 2026
Merged

fix(web): markdown should pre-set slot#2516
Sherry-hue merged 1 commit intolynx-family:mainfrom
Sherry-hue:fix/markdown-slot

Conversation

@Sherry-hue
Copy link
Copy Markdown
Collaborator

@Sherry-hue Sherry-hue commented Apr 23, 2026

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed inline view injection in x-markdown: when content changes, the component no longer queries light DOM children. Inline view elements now use slot-based projection and require a slot attribute to be set upfront.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 23, 2026

🦋 Changeset detected

Latest commit: 8c2bdfd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@lynx-js/web-elements Patch
upgrade-rspeedy Patch
@lynx-js/web-core Patch
@lynx-js/web-rsbuild-server-middleware Patch
@lynx-js/template-webpack-plugin Patch
@lynx-js/react-rsbuild-plugin Patch
create-rspeedy Patch
@lynx-js/web-worker-rpc Patch
@lynx-js/react-alias-rsbuild-plugin Patch
@lynx-js/rspeedy Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

📝 Walkthrough

Walkthrough

This pull request refactors the x-markdown inline-view injection mechanism in @lynx-js/web-elements. The #injectInlineViews method now uses a slot-based approach instead of querying light DOM children. Views intended for inline projection must now have slot="{id}" attributes set explicitly.

Changes

Cohort / File(s) Summary
Changeset Documentation
.changeset/rich-teams-melt.md
Patch entry documenting the fix to @lynx-js/web-elements inline-view injection behavior.
Core Implementation
packages/web-platform/web-elements/src/elements/XMarkdown/XMarkdownAttributes.ts
Modified #injectInlineViews method to unconditionally replace inline-view <img> tags with span.md-inline-view containing named slots, removing prior DOM querying and element transfer logic.
Test Fixtures
packages/web-platform/web-elements/tests/fixtures/x-markdown/inlineview.html, inlineview-class.html
Updated fixture markup to include explicit slot attribute assignments on <x-view> elements to match the new slot-based projection pattern.
Test Specification
packages/web-platform/web-elements/tests/x-markdown.spec.ts
Test updated to validate slot projection behavior via assignedElements() instead of CSS verticalAlign property inspection.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • PupilTong
  • HuJean

Poem

🐰 hops with glee
No DOM queries hopping through the night,
Slots align the views so bright,
Markdown's heart beats true and tight,
With names assigned, projections right! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: modifying markdown inline view injection to require pre-set slot attributes instead of querying DOM elements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ents/src/elements/XMarkdown/XMarkdownAttributes.ts 33.33% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/rich-teams-melt.md:
- Line 5: The changeset text documents the wrong slot name: the implementation
generates slots named "md-inline-view-{id}" and fixtures use
slot="md-inline-view-badge" / slot="md-inline-view-content-view", but the
changeset says to set slot="{id}"; update the changeset wording to instruct
consumers to pre-set slot="md-inline-view-{id}" (e.g.,
slot="md-inline-view-badge") so their element projects into inlineview://{id};
reference the generated slot name "md-inline-view-{id}" and the inlineview URI
pattern "inlineview://{id}" in the corrected sentence.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c15c38fd-2485-4242-a5f5-2c06cb16acde

📥 Commits

Reviewing files that changed from the base of the PR and between 13655ac and 8c2bdfd.

📒 Files selected for processing (5)
  • .changeset/rich-teams-melt.md
  • packages/web-platform/web-elements/src/elements/XMarkdown/XMarkdownAttributes.ts
  • packages/web-platform/web-elements/tests/fixtures/x-markdown/inlineview-class.html
  • packages/web-platform/web-elements/tests/fixtures/x-markdown/inlineview.html
  • packages/web-platform/web-elements/tests/x-markdown.spec.ts

Comment thread .changeset/rich-teams-melt.md
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 23, 2026

Merging this PR will improve performance by 17.15%

⚡ 1 improved benchmark
✅ 80 untouched benchmarks
⏩ 26 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
transform 1000 view elements 46.8 ms 40 ms +17.15%

Comparing Sherry-hue:fix/markdown-slot (8c2bdfd) with main (13655ac)

Open in CodSpeed

Footnotes

  1. 26 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 23, 2026

React External

#678 Bundle Size — 679.93KiB (0%).

8c2bdfd(current) vs 13655ac main#674(baseline)

Bundle metrics  no changes
                 Current
#678
     Baseline
#674
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 3 3
No change  Modules 17 17
No change  Duplicate Modules 5 5
No change  Duplicate Code 8.59% 8.59%
No change  Packages 0 0
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#678
     Baseline
#674
No change  Other 679.93KiB 679.93KiB

Bundle analysis reportBranch Sherry-hue:fix/markdown-slotProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 23, 2026

Web Explorer

#9132 Bundle Size — 899.95KiB (-0.02%).

8c2bdfd(current) vs 13655ac main#9128(baseline)

Bundle metrics  Change 2 changes
                 Current
#9132
     Baseline
#9128
No change  Initial JS 44.46KiB 44.46KiB
No change  Initial CSS 2.22KiB 2.22KiB
Change  Cache Invalidation 16.18% 0%
No change  Chunks 9 9
No change  Assets 11 11
No change  Modules 229 229
No change  Duplicate Modules 11 11
Change  Duplicate Code 27.28%(-0.04%) 27.29%
No change  Packages 10 10
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
#9132
     Baseline
#9128
Improvement  JS 495.81KiB (-0.03%) 495.97KiB
No change  Other 401.92KiB 401.92KiB
No change  CSS 2.22KiB 2.22KiB

Bundle analysis reportBranch Sherry-hue:fix/markdown-slotProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 23, 2026

React MTF Example

#692 Bundle Size — 196.39KiB (0%).

8c2bdfd(current) vs 13655ac main#688(baseline)

Bundle metrics  no changes
                 Current
#692
     Baseline
#688
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 3 3
No change  Modules 173 173
No change  Duplicate Modules 66 66
No change  Duplicate Code 44.07% 44.07%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#692
     Baseline
#688
No change  IMG 111.23KiB 111.23KiB
No change  Other 85.15KiB 85.15KiB

Bundle analysis reportBranch Sherry-hue:fix/markdown-slotProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Apr 23, 2026

React Example

#7560 Bundle Size — 225.23KiB (0%).

8c2bdfd(current) vs 13655ac main#7556(baseline)

Bundle metrics  no changes
                 Current
#7560
     Baseline
#7556
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 179 179
No change  Duplicate Modules 69 69
No change  Duplicate Code 44.57% 44.57%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#7560
     Baseline
#7556
No change  IMG 145.76KiB 145.76KiB
No change  Other 79.47KiB 79.47KiB

Bundle analysis reportBranch Sherry-hue:fix/markdown-slotProject dashboard


Generated by RelativeCIDocumentationReport issue

@Sherry-hue Sherry-hue enabled auto-merge (squash) April 23, 2026 09:47
@Sherry-hue Sherry-hue merged commit 9454dc4 into lynx-family:main Apr 23, 2026
49 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants