Open
Conversation
Co-authored-by: Copilot <copilot@github.com>
Bundle size
PerformanceTotal duration: 16.58 ms +0.36 ms(+2.2%) | Renders: 4 (+0) | Paint: 72.72 ms +2.80 ms(+4.0%)
Deploy previewCheck out the code infra dashboard for more information about this PR. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves nested code-emphasis rendering in docs-infra by (1) correctly detecting highlight nesting for cases involving @highlight-text and single-line @highlight, and (2) adjusting demo/docs CSS so adjacent regular/strong highlights visually merge cleanly.
Changes:
- Update nested-highlight detection to rely on
containingRangeDepth(instead ofexisting.lineHighlight) and treat single-line@highlightas depth-1. - Treat multiline ranges that collapse to a single content line as
data-hl-position="single"so they render as standalone highlights. - Add CSS rules (and stacking context) to visually merge regular highlight backgrounds with adjacent strong-highlight blocks.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/docs-infra/src/pipeline/enhanceCodeEmphasis/enhanceCodeEmphasis.ts | Fixes nesting/position logic for mixed @highlight, @highlight-start/end, and @highlight-text cases. |
| packages/docs-infra/src/pipeline/enhanceCodeEmphasis/enhanceCodeEmphasis.test.ts | Adds regressions covering nested highlight + @highlight-text interactions and single-line-in-multiline nesting. |
| docs/app/docs-infra/pipeline/enhance-code-emphasis/page.mdx | Updates documented CSS to merge backgrounds between adjacent regular and strong highlight lines. |
| docs/app/docs-infra/pipeline/enhance-code-emphasis/demos/IndentContent.module.css | Applies the same visual merging/stacking rules to the indent demo. |
| docs/app/docs-infra/pipeline/enhance-code-emphasis/demos/CollapsibleDemoContent.module.css | Applies the same visual merging/stacking rules to the collapsible demo variant. |
| docs/app/docs-infra/pipeline/enhance-code-emphasis/demos/CollapsibleContent.module.css | Applies the same visual merging/stacking rules to the collapsible content demo. |
| docs/app/docs-infra/components/code-highlighter/demos/DemoContent.module.css | Applies the same visual merging/stacking rules to code-highlighter demo styling. |
| docs/app/docs-infra/components/code-highlighter/demos/CodeContent.module.css | Applies the same visual merging/stacking rules to code-highlighter demo styling. |
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
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.
Enhance the handling of nested code emphasis to ensure proper visual representation and merging of highlighted lines. Adjustments include modifications to CSS for better background merging and updates to the logic for detecting nesting in highlight ranges.
Preview Deployment
Downstream PR
Before
After