Skip to content

fix: docs UX from rune review — tables, 404, root redirect, sidebar scroll, panel pre-paint - #16

Merged
oreofeolurin merged 8 commits into
mainfrom
fix/ai-tables-404-root
Jun 12, 2026
Merged

fix: docs UX from rune review — tables, 404, root redirect, sidebar scroll, panel pre-paint#16
oreofeolurin merged 8 commits into
mainfrom
fix/ai-tables-404-root

Conversation

@oreofeolurin

Copy link
Copy Markdown
Contributor

Three fixes from the rune dogfood review.

1. Ask AI rendered markdown tables as raw | pipe | text |

mdBlocks() had no table support, so a GFM table came through as literal pipes with <br> line breaks. It now detects a header row followed by a --- separator and emits a real <table> — inline bold/code works inside cells, and any text around the table stays a paragraph. Styled under .ac-out in both docs + API reference (bordered, scrollable).

2. 404 page was left-aligned, not centered

.ml-notfound is a flex column but inherited align-items: start from the .docs-shell grid rule, which shrank its children to content width and left-aligned them. Set align-items: stretch so .nf fills the width and its own align-items: center actually centers the content.

3. / 404'd on docs-only sites with no root page

The catch-all returned notFound() for / when there's no docs/index.mdx, so the brand/logo link dead-ended. It now redirects / → the first nav entry (only for the empty slug; every other missing path still 404s). Guarded so it never loops, and static-export sites serving public/index.html at / are unaffected.

Verified live (rune docs)

  • GET /307/start/what-is-rune; GET /nope404 (preserved)
  • 404 page now centered (screenshot)
  • Table rendering unit-tested: table emitted, headers parsed, inline bold/code in cells, surrounding text preserved
  • tsc clean; production build green (78 pages)

Note: I couldn't capture a live table screenshot — the deepseek-v4-flash model hung ~80s on the comparison query (heavy reasoning + large grounding context). The rendering path is the same one the unit test exercises.

1. Ask AI rendered GFM tables as raw pipe-delimited text. mdBlocks() now
   detects a header + `---` separator run inside a block and emits a real
   <table> (inline bold/code in cells, surrounding text preserved); styled
   under .ac-out in docs + API reference.

2. The 404 page was left-aligned, not centered: .ml-notfound (a flex column)
   inherited align-items:start from the .docs-shell grid rule, shrinking its
   children. Set align-items:stretch so .nf fills the width and centers.

3. Root '/' 404'd on docs-only sites with no index page. The catch-all now
   redirects '/' to the first nav entry (only for the empty slug; every other
   missing path still 404s). Static-export sites serving public/index.html at
   '/' are unaffected.

Verified live on the rune docs: / -> 307 -> /start/what-is-rune, 404 centered
(screenshot), genuine paths still 404; table rendering unit-tested; build green
(78 pages).
The '404' uses var(--display) (Schibsted Grotesk) but the heading used
var(--serif) (Instrument Serif). Switch .nf-h to the display font (weight 600,
matching letter-spacing) so the two read as one lockup.
Two navigation-UX fixes from the rune review:

1. Sidebar scroll — after navigating to a page whose nav link is below the
   fold, the sidebar rendered scrolled to the top with the active link hidden.
   DocsSidebar now scrolls *only the sidebar* (never the window) to bring the
   active link into view, deferred to a rAF so it measures after layout settles.

2. AI panel push — on reload with the panel open, the content/code/tables
   shrank with a visible 0.26s animation because the body.aichat-open class was
   added post-hydration. A pre-paint <html data-ai-open> attribute (set by the
   layout inline script from localStorage) now applies the padding with no
   transition, so the content renders already-shrunk; React hands off to
   body.aichat-open in one tick with no value change, so nothing animates.
   Applies to both the docs shell and the API reference takeover.
@oreofeolurin oreofeolurin changed the title fix: AI markdown tables, 404 centering, root redirect fix: docs UX from rune review — tables, 404, root redirect, sidebar scroll, panel pre-paint Jun 12, 2026
…el open

The real cause: the docs shell lives in page.tsx, so it REMOUNTS on every
client navigation. On remount AskDock reset to open=false, which stripped
body.aichat-open (content expanded to full width), and the old code then
re-read localStorage and re-opened — re-applying the push WITH the always-on
.26s transition. That expand→animate-shrink on every page change was the
flicker.

Fix:
- Restore the open state in a layout effect (before paint) and add
  body.aichat-open there directly, so a remount/navigation re-opens the panel
  with no full-width flash. Falls back to useEffect under SSR.
- Gate BOTH the width (padding-right) and panel (transform) transitions behind
  body.ac-animating, which only an explicit user open/close adds (and removes
  ~340ms later). Reloads and navigation now apply the push instantly — they
  physically cannot animate — while user toggles still animate smoothly.
- Drop the unmount cleanup that removed body.aichat-open; it thrashed the push
  across the remount.
- Persist the open flag only on real changes (prevOpen ref) so a remount or
  StrictMode replay can't clobber the saved state with a stale value.
- Keep the pre-paint <html data-ai-open> for the first paint of a full load.

Verified at 1680px: reload-open renders pre-shrunk (no anim); SPA navigation
keeps the panel open with the content column fixed at 794px (no reflow); user
close/open still animates. Build green (78 pages).
The 'this page' chip looked like a clickable pill but is a read-only indicator
of the answer's grounding scope (set by how the panel was opened). Reworked it
into a caption — a 'Grounded in <scope>' line with the book icon, muted prefix,
emphasized scope value, transparent background, no border, default cursor, and
a title tooltip — so it reads as status, not an action. Docs + API reference.
The label implied answers were scoped to the current page, but retrieval draws
on the full docs context, so it was misleading. Removed the indicator (and its
now-unused Book glyph + .ac-ctx styles). The underlying context/sectionHint is
kept — it still biases grounding when the panel is opened from a section or
endpoint — it's just no longer surfaced in the UI.
The Ask AI panel is fixed at top:0, but its header was 54px while the site nav
is 61px (a 60px row + 1px border), so the header's bottom divider floated 7px
above the nav's. Bumped .ac-head to 61px (60px content + 1px border, border-box)
in both the docs and API-reference panels so the two dividers form one
continuous line. Verified live: divider gap 54px->61px, now 0.
Drop the border-bottom on .ac-head (docs + API reference) so the Assistant
header is borderless and blends into the panel, rather than carrying its own
divider line. Height stays 61px so the title still aligns vertically with the
site nav.
@oreofeolurin
oreofeolurin merged commit 13b21f6 into main Jun 12, 2026
1 check passed
@oreofeolurin
oreofeolurin deleted the fix/ai-tables-404-root branch June 12, 2026 13:52
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