-
Notifications
You must be signed in to change notification settings - Fork 26
fix(docs): replace code element with div to fix invalid HTML nesting #6166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The code element was wrapping div and table elements, which is invalid HTML since code is phrasing content and can only contain other phrasing content. This caused browsers to auto-close the code element during HTML parsing, leading to a DOM structure different from what React expected. During hydration, this mismatch caused the table elements to briefly lose their display styles, collapsing code blocks into a single line on desktop. Co-Authored-By: Colton Berry <coltonsberry@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
🌱 Smoke Test PreviewRun at: 2026-01-09 03:01:53 UTC Testing branch changes with smoke test content:
🕷️ Smoke Test Crawler ResultsPages crawled: 56 ❌ Pages with Errors📊 Full error breakdown
See full details in the workflow logs. |
Fixes code blocks collapsing into a single line on desktop during page load.
Short description of the changes made
Replaced
<code>elements with<div>elements inFernSyntaxHighlighterTokens.tsxandFernSyntaxHighlighterTokensVirtualized.tsx. The<code>element was wrapping<div>and<table>elements, which is invalid HTML.What was the motivation & context behind this PR?
Users were seeing code blocks collapse into a single line on desktop during page load, with line numbers appearing inline with code content (e.g.,
1{2 "message": {3 "type"...).The root cause is invalid HTML nesting:
<code>is phrasing content and can only contain other phrasing content, but it was wrapping<div>and<table>(flow content). Browsers auto-close the<code>element during HTML parsing to "fix" this, creating a DOM structure different from what React expects. This hydration mismatch caused table elements to briefly lose their display styles.The
<pre>element already provides the semantic meaning of preformatted text, so removing the<code>wrapper is acceptable.How has this PR been tested?
.code-blockclass (notcode.code-blockelement selector)Human review checklist
code.code-blockspecifically<code>elementLink to Devin run: https://app.devin.ai/sessions/8458f6ca712f47788f7e038841776689
Requested by: Colton Berry (@coltondotio)