Skip to content

fix(docs): frontmatter disclosure, sidenav directory tree, themed syntax highlighting - #430

Merged
cameronsjo merged 5 commits into
mainfrom
fix/docs-frontmatter-and-tree
Sep 1, 2026
Merged

fix(docs): frontmatter disclosure, sidenav directory tree, themed syntax highlighting#430
cameronsjo merged 5 commits into
mainfrom
fix/docs-frontmatter-and-tree

Conversation

@cameronsjo

Copy link
Copy Markdown
Owner

Three rendering defects in forgectl docs serve, all surfaced by looking at the reader on real docs:

  • Frontmatter mangling — goldmark read the opening --- as a thematic break and folded the YAML into a broken heading. The frontmatter extension now consumes it at parse; the parsed pairs render as a collapsed "Front matter · N keys" disclosure (kv grid) above the body. The block is built after sanitization from html.EscapeString'd fragments only, so the bluemonday allowlist stays untouched. A well-formedness gate protects docs that merely open with a thematic break — the extension's greedy opener otherwise swallowed the whole body (found by review, pinned by test).
  • Flat sidenav — 800+ docs rendered as one flat scroll while the vendored tree behavior sat unused. Each root now renders as a nested tree--static (native details/summary, no JS needed): per-directory counts, path to the current doc pre-expanded, filter box hides empty branches and auto-expands matches.
  • Monokai code blocks — the served chroma stylesheet was a generated monokai sheet with a hardcoded palette. Replaced with a hand-authored mapping onto the design system's syntax roles; code blocks now follow the light/dark theme.

Reviewed pre-PR: two independent code reviews (findings folded, incl. the body-swallowing gate), an independent Opus security review (verdict clean — the post-sanitizer prepend was empirically probed with hostile YAML: anchors, block scalars, angle-bracketed keys; zero OSV advisories on the two new deps), scoped lint clean, go build ./... && go test ./... green.

BEGIN_COMMIT_OVERRIDE
fix(docs): the reader now renders YAML/TOML frontmatter as a collapsed metadata disclosure instead of leaking it into the body as a broken heading; each indexed root renders as a collapsible directory tree (counts, current-path pre-expanded, filter-aware) instead of a flat list; and syntax highlighting follows the light/dark theme instead of a fixed monokai palette
END_COMMIT_OVERRIDE

Session-Name: deft-sonata
Session-Id: 7fc5913c-2346-479f-a249-9d871812e47d
Model: claude-fable-5
Harness: claude-code 2.1.252
Machine: cf6e768835c7

cameronsjo and others added 5 commits August 31, 2026 19:36
goldmark was reading the opening --- as a thematic break and folding the
YAML into a mangled heading. The frontmatter extension now consumes it at
parse; the parsed pairs render as a collapsed disclosure (kv grid) above
the body, built post-sanitizer with every fragment HTML-escaped.

Session-Name: deft-sonata
Session-Id: 7fc5913c-2346-479f-a249-9d871812e47d
Model: claude-fable-5
Harness: claude-code 2.1.252
Machine: cf6e768835c7
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…denav

887 docs rendered as one flat scroll. Per-root groups now emit nested
tree--static markup (details per directory, leaf counts, path to the
current doc pre-expanded); the filter box hides empty branches and
auto-expands matches, restoring rest state on clear. Recent stays flat.

Session-Name: deft-sonata
Session-Id: 7fc5913c-2346-479f-a249-9d871812e47d
Model: claude-fable-5
Harness: claude-code 2.1.252
Machine: cf6e768835c7
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The served chroma stylesheet was generated monokai — a hardcoded palette
slab that ignored the page theme entirely. Chroma already emits class-based
output, so the stylesheet swaps to a hand-authored mapping onto the
design-system syntax roles and follows light/dark for free.

Session-Name: deft-sonata
Session-Id: 7fc5913c-2346-479f-a249-9d871812e47d
Model: claude-fable-5
Harness: claude-code 2.1.252
Machine: cf6e768835c7
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review findings folded: a greedy frontmatter opener swallowed any doc
merely opening with a thematic break (gated via hasWellFormedFrontmatter
plus a plain parser); non-mapping frontmatter no longer vanishes; the
static tree gets twisty rotation and count styling; the badge counts
rendered pairs; scoped lint fixes in the new tests.

Session-Name: deft-sonata
Session-Id: 7fc5913c-2346-479f-a249-9d871812e47d
Model: claude-fable-5
Harness: claude-code 2.1.252
Machine: cf6e768835c7
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Session-Name: deft-sonata
Session-Id: 7fc5913c-2346-479f-a249-9d871812e47d
Model: claude-fable-5
Harness: claude-code 2.1.252
Machine: cf6e768835c7
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/docs-frontmatter-and-tree

Comment @coderabbitai help to get the list of available commands.

@cameronsjo
cameronsjo merged commit 46ad601 into main Sep 1, 2026
4 checks passed
@cameronsjo
cameronsjo deleted the fix/docs-frontmatter-and-tree branch September 1, 2026 00:58
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