Skip to content

perf: cache editor layout geometry and restore synchronous critical CSS#137

Merged
ThisIs-Developer merged 1 commit into
mainfrom
perf-layout-reflow-optimizations
May 31, 2026
Merged

perf: cache editor layout geometry and restore synchronous critical CSS#137
ThisIs-Developer merged 1 commit into
mainfrom
perf-layout-reflow-optimizations

Conversation

@ThisIs-Developer

Copy link
Copy Markdown
Owner

This Pull Request introduces elite performance and accessibility optimizations to completely eliminate layout thrashing, forced reflows, and unstyled layout shifts.

Key Changes:

  • Global Editor Geometry & Scroll Position Caching: Isolated and cached all layout values (cachedPaddingLeft, cachedPaddingRight, cachedLineHeight, etc.) in global variables, eliminating all DOM queries inside the updateLineNumbers() typing loop.
  • Inlined Default Markdown Template: Moved the default preview markdown content from /sample.md into an inlined element inside index.html. This completely eliminates the startup network fetch request, FOUC, and initial layout shifts.
  • Restored Synchronous Critical CSS: Reverted critical stylesheets (Bootstrap and GitHub Markdown) to load synchronously in the , preventing the unstyled paint state and massive Cumulative Layout Shift (CLS) layout shifts.
  • Explicit Image Dimensions: Added explicit width and height attributes to the Markdown Viewer logo inside the default markdown preview to eliminate layout shifts.

Copilot AI review requested due to automatic review settings May 31, 2026 15:51
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying markdown-viewer with  Cloudflare Pages  Cloudflare Pages

Latest commit: abf9f21
Status: ✅  Deploy successful!
Preview URL: https://68524f02.markdown-viewer.pages.dev
Branch Preview URL: https://perf-layout-reflow-optimizat.markdown-viewer.pages.dev

View logs

@vercel

vercel Bot commented May 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
markdown-viwer Ready Ready Preview, Comment May 31, 2026 3:51pm

@ThisIs-Developer ThisIs-Developer merged commit ae39c84 into main May 31, 2026
6 of 7 checks passed
@ThisIs-Developer ThisIs-Developer deleted the perf-layout-reflow-optimizations branch May 31, 2026 15:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

2 participants