Skip to content
This repository has been archived by the owner on May 31, 2023. It is now read-only.

next setup #1

Merged
merged 30 commits into from Jan 5, 2022
Merged

next setup #1

merged 30 commits into from Jan 5, 2022

Conversation

freeman-lab
Copy link
Member

@freeman-lab freeman-lab commented Nov 25, 2021

This PR adds a basic next setup to the docs site with routing, etc. The routes /summary and /generated/<class> render contents from the fjson files generated by Sphinx, all of which I've nested under the "API" category in the sidenav. The routes /index /overview and /introduction just render markdown files under the "Getting Started" category. It's working well! And feels like a pattern many doc sites could follow.

Striking out my notes below as they described an earlier version of the approach.

A couple notes

  • /api is a special reserved page for next and there is not yet an option to disable that (see here), but I like the simple url, so, I've named the route api-reference and added a rewrite to render that at /api. It works, but annoying that we'll have to do that in every docs site. If support for disabling that route ever emerges, we can switch to that and avoid the rewrite.

  • I'm currently rendering the body from the fjson files via <div dangerouslySetInnerHTML={{ __html: body }} />. Not ideal, but it works. My immediate next step is to find a way to extract that into a form that uses our theme (similar to MDX). Also on my list is adding a basic section nav. Will continue doing those things on this PR until it gets merged.

@freeman-lab
Copy link
Member Author

freeman-lab commented Nov 28, 2021

Did a full pass on styling, not because I want to finalize our styles, but to convince ourselves the setup here was workable. At least for this simple test case, the code is a little gnarly, but I'm pretty pleased with what's possible, and to me this is actually looking quite good.

I think at this point this PR is ready for review and merging!

CleanShot 2021-11-28 at 00 07 54

@freeman-lab freeman-lab marked this pull request as ready for review November 28, 2021 05:11
Comment on lines +2 to +10
'Getting Started': ['Introduction', 'Overview'],
API: [
'Summary',
{
label: 'HelloWorldClass',
href: './generated/hello_project.HelloWorldClass',
},
{ label: 'hello_world', href: './generated/hello_project.hello_world' },
],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be possible to automatically populate the api members here yeah? I see a lot of value in being able to customize the sidebar but perhaps the default behavior could be the same list members that appear in the api.fjson file

@vercel
Copy link

vercel bot commented Nov 30, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/carbonplan/test-docs-project/5oh2paPKEUkAxC2ck5v1L2274U8T
✅ Preview: https://test-docs-project-git-freeman-lab-setup-next-carbonplan.vercel.app

@jhamman jhamman merged commit 9a9267b into main Jan 5, 2022
@jhamman jhamman deleted the freeman-lab/setup-next branch January 5, 2022 23:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants