docs: add annotated-code-block functionality to RST examples#384
Open
jsstevenson wants to merge 2 commits intov1from
Open
docs: add annotated-code-block functionality to RST examples#384jsstevenson wants to merge 2 commits intov1from
jsstevenson wants to merge 2 commits intov1from
Conversation
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.
I find the "examples" pages pretty hard to read. Each annotation is one long line, and you have to scroll well outside of the viewport to read an invididual note. I guess you could just go click the link to read the source YAML directly, but you lose the benefits of syntax highlighting (and you're still reading single, long lines -- text wrap was invented for a reason!)
There's a material-mkdocs plugin that adds little annotation tooltips which make this information more digestible, but there's no such equivalent for Sphinx as far as I can tell. So, I had ChatGPT make a very simple one.
Disclosure: This was basically vibe-coded (which was an adventure in itself) and then edited for cleanliness afterwards.
Basically, for a code block that you want tooltipped, you use an
annotated-code-blockinstead, and it converts all trailing comments into tooltips. See an example here.There are some limitations, which I've noted in the extension module, but for these specific pages I think it works pretty well.
ALSO
docs/source/conf.pyfor readability