Skip to content

Native support for code-blocks #60

@azmeuk

Description

@azmeuk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions