Improve HTML previews for syntax-highlighted code blocks#461
Improve HTML previews for syntax-highlighted code blocks#461aidenybai wants to merge 15 commits into
Conversation
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
There was a problem hiding this comment.
1 issue found across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
There was a problem hiding this comment.
1 issue found across 5 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| hasTrustedSource: false, | ||
| }; | ||
| }; | ||
|
|
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e648c55. Configure here.
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
|
You're iterating quickly on this pull request. To help protect your rate limits, cubic has paused automatic reviews on new pushes for now—when you're ready for another review, comment |
| if (directText && element.children.length === 0) return directText; | ||
|
|
||
| const parts: string[] = []; | ||
| for (const childNode of element.childNodes) { |
There was a problem hiding this comment.
Commit 39e0b55 drastically reduced descendant text collection from 28 semantic tags to just 3 tags (a, code, pre), breaking text extraction for elements like h1-h6, button, label, p, span, and other semantic elements
# Conflicts: # packages/react-grab/src/core/context.ts # packages/react-grab/src/core/copy.ts
Folding in #461 changed formatStackContext to return a typed trace context ({ text, shouldAppendSelectorHint }); assert against .text.
|
Closing as superseded. This work has already landed on
The branch's merge-base with |

Summary
a,pre, andcode)getStackContexttrace-only; selector hints are appended only by higher-level element reference/context formattershrefandsrcwhen generating selector hintsVerification
Summary by cubic
Improved HTML previews now include real text for Shiki-style
pre/codeblocks and nested link labels, keep containers compact, and add selector hints for low-signal traces.Bug Fixes
a,pre,code; collapse whitespace; handle mixed inline content; truncate; skip hidden/decorative roots. Show child summaries only when no preview text.href/src; cap at 160 chars. Fix link preview formatting. Add E2E for code blocks, nested link labels, hidden roots, and mixed inline content.Refactors
shouldAppendSelectorHintflag and append hints outside stack formatting. AddgetElementReferenceContextand use it in the copy flow for bracketed refs.getPreviewTextContentand minimize policy changes by limiting descendant-text extraction toa,pre, andcode.Written for commit 39e0b55. Summary will update on new commits.