Skip to content

fix: code block alignment in Simplicity & Migration sections#407

Merged
BYK merged 1 commit into
mainfrom
fix-code-block-alignment
May 19, 2026
Merged

fix: code block alignment in Simplicity & Migration sections#407
BYK merged 1 commit into
mainfrom
fix-code-block-alignment

Conversation

@BYK
Copy link
Copy Markdown
Owner

@BYK BYK commented May 19, 2026

Problem

The code examples in the Simplicity and Migration bento cards on the landing page had alignment issues, particularly visible on mobile.

Root cause

The <code> elements contained multi-line HTML where the first line was indented with the tag but subsequent lines started at column 0. Since mobile CSS applied white-space: pre-wrap, the literal newlines and inconsistent whitespace in the HTML source rendered as visible misalignment.

Additionally, word-break: break-all on mobile could split code tokens mid-character.

Changes

HTML (docs/index.html):

  • Flattened <code> content in both Simplicity and Migration blocks onto single lines, eliminating extraneous whitespace between <br> and <span> tags
  • Encoded bare & as &amp; for HTML validity

CSS (mobile media query):

  • Replaced word-break: break-all + white-space: pre-wrap with overflow-x: auto on .code-block and white-space: pre on .code-block code
  • This prevents code tokens from breaking mid-word while allowing horizontal scroll on very narrow screens if needed

Verification

Open docs/index.html in a browser and check both desktop and mobile (375px) views — code blocks should have uniform left-aligned lines with no mid-word breaks.

Flatten HTML whitespace inside <code> elements to eliminate alignment
discrepancies caused by mixed indentation in the source. Replace
mobile CSS word-break: break-all with overflow-x: auto and
white-space: pre for proper code rendering on narrow screens.
Encode bare & as &amp; for HTML validity.
@BYK BYK force-pushed the fix-code-block-alignment branch from dac0441 to 6eb61a5 Compare May 19, 2026 21:38
@BYK BYK enabled auto-merge (squash) May 19, 2026 21:38
@BYK BYK merged commit 751d0e7 into main May 19, 2026
7 checks passed
@BYK BYK deleted the fix-code-block-alignment branch May 19, 2026 21:39
This was referenced May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant