Skip to content

rustdoc: Add option to hide imports from rendered examples #109121

Open
@lcmgh

Description

@lcmgh

Problem

Adding imports to code examples are necessary to make them compile however it makes code examples more hard to read. That's why many developers choose to hide them from the generated output. This leads to the problem that when copying code examples users have to manually choose the correct imports which can be error-prone.

Proposed Solution

Add an UI option to each Rust code block that allows to dynamically hide and show the imports.

Notes

This may raise the question if we also want an option to show/hide all hidden code fragments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions