fix(docs): the rate limits card was invisible in the On this page index - #95
Merged
Merged
Conversation
The docs layout builds 'On this page' client-side by scraping rendered h2/h3 inside .docs-content (Docs.astro). The rate limits card stack embedded from models.mdx rendered no heading at all, so /docs/models' TOC never mentioned the section even though the limits are published there. RateLimits.astro now opens with a real h2 carrying data-toc-text (the ModelCard pattern), with its text routed through rateLimitsLabels so each locale keeps its own wording: 'Rate limits' / 'Límites de peticiones'. The i18n suite covers both the label translation and the heading contract the TOC scraper depends on.
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.
nan.builders/docs/models publishes the raised rate limits, but the 'On this page' index never mentioned the section: the docs layout builds that TOC client-side by scraping rendered h2/h3 inside .docs-content (Docs.astro), and the rate limits card stack embedded from models.mdx rendered no heading at all.
What changed
RateLimits.astroopens with a real<h2>carryingdata-toc-text— the same patternModelCard.astroalready uses so badges stay out of the TOC.rateLimitsLabels()so each locale keeps its own wording: 'Rate limits' / 'Límites de peticiones' (user-picked label).rateLimitsI18n.test.tsnow covers the label translation in both directions and pins the heading contract the TOC scraper depends on (<h2 id="rate-limits" data-toc-text={T.sectionHeading}>).Test plan
npm test: 66 files / 1303 tests passednpm run buildexit 0; the ES label is present in the built server chunkDeploy notes
No VERSION file in this repo; merging to main triggers the Cloudflare Pages deploy via deploy.yml. After deploy, check that /docs/models and /es/docs/models list the section under 'On this page'.