Open sethmlarson opened 4 years ago
What do you think about using something like https://djungelorm.github.io/sphinx-tabs/#code-tabs?
When you choose a different language, all other snippets in the page automatically show that language.
This specific extension does not degrade gracefully: without JS we only see the first tab instead of seeing all of them. I guess that's fixable. But at least that's a solution that already works today.
Should this slider be extended to Sync, Trio, Asyncio, Curio?
I guess ultimately including all frameworks we support is nice because I prefer code snippets that can be run as-is. It shouldn't be too hard as everything should be generated anyway. But it's not mandatory either, just a nice touch.
Maybe the tabbed approach can be used for the asynclib-specific examples and the global Sync / Async can apply to the API ref
Some discussions around how we can provide both examples and an API reference for Hip when there are namespaces with very similar but obviously have basically two separate audiences.
A great idea from @njsmith was to do something similar to a lot of projects that support multiple programming languages (Python, Java, Ruby, etc) and have a "Sync / Async" toggle on documentation navigation. Would change all code examples and autodoc refs from
ahip
tohip
, have/excludeasync/await
etc.This would be especially useful for the reference as it will be mostly symmetrical thanks to unasync.
Some thoughts and ideas that came up:
/ref/async/...
to/ref/sync/...
)trio.run()
ortrio.open_nursery()
for showing off how to do multiple concurrent requests.