Allow qmd sections / subsections to be enclosed in <details> tags in HTML documents. #5523
-
We can use the html
It would be a nice feature if you could specify a section to be rendered as a
This could be useful for tangential or interlude sections of documents which are not part of the main contents of the document, but may be folded away and accessed via a toggle. By doing this at a section level, it would mean that any markdown and code blocks within that section would be folded away as one logical group. Is there any way of achieving this with the current version or is this something that would have to be implemented if desired? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I don't think that's a good idea. This being said, there is nothing to add in Quarto, everything is already there, i.e., Bootstrap (see https://getbootstrap.com/docs/5.2/components/collapse/). See Quarto document code.---
title: "Quarto Playground"
format: html
---
This is a playground for Quarto.
## Section 1
lore ipsum dolor sit amet 1
## Section 2 <a class="btn btn-primary" data-bs-toggle="collapse" href="#multiCollapseExample1" role="button" aria-expanded="false" aria-controls="multiCollapseExample1">Show</a>
::: {#multiCollapseExample1 .collapse .multi-collapse}
### Subsection 1
lore ipsum dolor sit amet 2
:::
## Section 3
lore ipsum dolor sit amet 3
Screen.Recording.2023-05-13.at.14.17.14.mov |
Beta Was this translation helpful? Give feedback.
-
The desire to have it as an optional section within the main content rather than an appendix was only motivated as a UX design choice for that particular section. But what you've demonstrated solves the problem, so thank you! |
Beta Was this translation helpful? Give feedback.
I don't think that's a good idea.
If the section is not really part of the main document, why not put it in an appendix and make a reference to it?
Or use conditional content to hide/show section depending on condition or profile.
This being said, there is nothing to add in Quarto, everything is already there, i.e., Bootstrap (see https://getbootstrap.com/docs/5.2/components/collapse/).
See Quarto document code.