Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hiding long sections partially #6289

Open
4 tasks done
ojacques opened this issue Nov 4, 2023 · 3 comments
Open
4 tasks done

Hiding long sections partially #6289

ojacques opened this issue Nov 4, 2023 · 3 comments
Labels
change request Issue requests a new feature or improvement

Comments

@ojacques
Copy link
Contributor

ojacques commented Nov 4, 2023

Context

This request is a follow to a GitHub discussion.

Description

I write documentation and tutorials which may have long sections, between two options. For example:

You could do it this way:

- long set of instructions

Or this other way:

- Another long set of instructions

I would like the ability to show a preview of long sections of texts and fold/unfold to see the full text.

Related links

Use Cases

On a long documentation page, not all sections are relevant to the reader, or sections which contain explanations and long code blocks. I would like readers to judge whether they need to see and read those sections, or continue reading the rest of the documentation.
I expect this to improve readability of long pages.

Visuals

An example on how this is done on this AWS documentation site:

image

As you can see, some sections are partially hidden, until the reader presses "Show more", which unfolds the section.

image

One can then click "Show less" to fold the section back.

Before submitting

@alexvoss
Copy link
Collaborator

alexvoss commented Nov 4, 2023

An immediate solution would be to use a custom admonition that is collapsible. With some tweaking, this could be made to look similar to what Amazon do - if, say, you do not like the border around the admonition. If you use the block syntax that the Pymdown Extensions provide then you don't have to worry about indentation as much.

@facelessuser
Copy link
Contributor

More specifically, you could try and adapt what I've done here: #4964 (comment). The example was specifically targeting code blocks, but it could be adapted for any content.

@squidfunk
Copy link
Owner

Thanks for suggesting! We'll evaluate this as a potential change request in the future. If you want to go ahead and check if you can find any potential approaches how this can be elegantly solved, feel free to share them here!

@squidfunk squidfunk added the change request Issue requests a new feature or improvement label Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change request Issue requests a new feature or improvement
Projects
None yet
Development

No branches or pull requests

4 participants