-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: dynamic docs content structure #82
Conversation
Allows us to selectively use SSR for accessing headers, etc., see https://docs.astro.build/en/guides/server-side-rendering/#on-demand-rendering-features
This reverts commit 4ad46d3.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
cc @bendechrai |
Added a custom TOC component approach. |
Concept looks good. Why do we have to have the At https://arcjet-docs-3jr1p35n6-arcjet.vercel.app/docs/rate-limiting/quick-start I see multiple ordered list items in the TOC: |
- more robust - adds flexibility to specify different framework sets - catch difference between displayed vs user-selected framework
@davidmytton added plugins for expressive code for collapsing sections and showing line numbers, I've also added the Aj code syntax theme. You can test like so on a
|
Yes, I don't have a light variant with expressive code atm, but everything in place and just needs some time to design/fill in the light theme vars. Regardless of whether the code stays dark in light mode it will still need brightness/contrast adjustments.
Yep, will fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@morekid all the docs are migrated. Can you give it a final review and then it's ready to merge!
@davidmytton looks all good, fixed a few cosmetic issues + the Next.js icon rendering. |
This is the exploration for consolidating the page structure and adding the flexibility to show content based on framework.
Find the working example at
/docs/rate-limiting/quick-start
.Things to note:
/docs
uses the page layout at/src/pages/docs/[...slug].astro
, which loads a custom sidebar. Besides multiple sidebars, this also adds the flexibility of further layout customization later on.All titles need to be explicitly typed in the root page if we want them to be in the automatic page TOC on the right. This is why I'm adding them as<slots />
in a few cases. However this will always make them available for the TOC of any framework, which is also not desirable(see the multiple4. ...
links in the page. Haven't found a workaround for this yet, but can investigate more. The fallback is that we take it into account when writing the page content: framework dependent titles won't appear in the TOC.It's feasible to explore a totally custom page TOC, replacing the one that Starlight ships with.to address the above. This is a proof of concept I can refine, but it's 99% there andI like that we can build the index as we like in the frontmatter for each page.It's still probably a good idea to add the titles as slots as it is currently so that we can always use markdown and the.id
attrs are automatically generated/* > /docs/*
.<Tabs />
built insyncKey
prop.This still doesn't handle linkable URLs based on framework, which in this approach should be done with params.There's of course a considerable amount of manual work to port everything over the new approach.
Screen.Recording.2024-09-19.at.15.49.57.mov