Skip to content

Expandable Code Blocks #4964

Closed
Closed
@azbpa

Description

@azbpa

Context

No response

Description

Add option to make code blocks expandable so that only a few lines are shown at first place. A button below the code block will give the option to expand it entirely.

Related links

Use Cases

  • Authors perspective: Long code blocks are sometimes required in references, how-to guides, examples, etc. However, they will break the reading flow of the page which can defeat the purpose of it. On the other hand, hiding code blocks with collapsible admonitions is the other extreme, which removes the visual stylistic device of having code bocks between paragraphs.
  • User perspective: Large code blocks can lead to get lost/overwhelmed if new to a topic. Being able to read a page first, from top to bottom, helps to get a basic understanding before looking at details. Expandable code blocks encourage to do so and signalize that there is an important piece of code, but it can be skipped safely until it might be required later.

Visuals

image
Source: https://docs.aws.amazon.com/securityhub/latest/userguide/prepare-upcoming-features.html#appendix-sample-findings

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    change requestIssue requests a new feature or improvementupstreamIssue must be taken upstream

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions