Repository navigation
Render FAQ answers as collapsibles - #275
Merged
Merged
Conversation
Long FAQ sections made pages hard to scan. A rehype plugin now wraps each ### question under ## FAQ in a <details> at build time, so the markdown stays as plain headings. The <h3> stays inside <summary>, which keeps heading anchors, the TOC and faq-schema.ts working; FAQPage JSON-LD is byte-identical to main on all 229 pages. A client module opens a question when a link or the TOC targets it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FAQ sections on 229 pages (1,397 questions) now render each question as a collapsible, so long FAQs no longer stretch the page. The markdown is unchanged: questions stay as
###headings under## FAQ.src/plugins/rehype-faq-details.ts: a rehype plugin that, at build time, wraps each###question and its answer in<details class="faq-item">, keeping the<h3>inside<summary>. Turned on for docs andsrc/pages.src/clientModules/faq-anchor.ts: when a link or the table of contents points at a question, that question opens.src/css/custom.css: replaces the default Docusaurus alert-box look with a plain list of questions, with dividers and an arrow. The#link inside a question is hidden, because a click there opens or closes the answer instead of following the link.CLAUDE.md: notes that FAQ collapsibles are generated, so nobody writes<details>by hand.SEO
Detailsrenders withlazy={false}.mainon all 229 pages, sofaq-schema.tsis unchanged.Known limitation
Browser find (Ctrl+F) doesn't search inside closed answers. We've accepted this.
Test plan
npm run checkpassesmain: no differences/api/authentication/#what-happens-when-i-revoke-a-keyopens only that question🤖 Generated with Claude Code