sphinx-togglebutton icon indicating copy to clipboard operation
sphinx-togglebutton copied to clipboard

Native support for code-blocks

Open azmeuk opened this issue 1 year ago • 0 comments

Context

Sometimes I have to show large samples of code as documentation examples. As they clutter the page I tend to hide them behind a toggle button. Currently I nest code blocks in toggle containers:

    .. toggle::

        .. literalinclude :: ../samples/rfc7643-8.7.1-schema-group.json
           :language: json
           :caption: schema-group.json

Proposal

This produces a click to hide/click to show message that I found cumbersome. I would love if code-block and litteral-include blocks with a :caption: parameter could be handled in the same fashion than admonitions.

Users would click on the code sample caption, and that would show/hide the code.

What do you think?

Tasks and updates

No response

azmeuk avatar Jun 20 '24 10:06 azmeuk