Click me
- Foo
- Bar
- Baz
- Qux
function logSomething(something) {
console.log('Something', something);
}
<details>
<summary>Click me</summary>
### Heading
1. Foo
2. Bar
* Baz
* Qux
### Some Javascript
```js
function logSomething(something) {
console.log('Something', something);
}
```
</details>
To have a collapsible section expanded by default, simply include the 'open' attribute within the <details>
tag:
Hello
World!<details open>
<summary>Hello</summary>
World!
</details>
You can modify the appearance of the clickable text by adding styling inside the <summary>
tags:
Wow, so fancy
WOW, SO BOLD<details>
<summary><i>Wow, so fancy</i></summary>
<b>WOW, SO BOLD</b>
</details>
NB: When including headings within collapsible sections, remember to add a new line after the <summary>
tag.
Section A
Section A.B
Section A.B.C
Section A.B.C.D
Done!<details>
<summary>Section A</summary>
<details>
<summary>Section A.B</summary>
<details>
<summary>Section A.B.C</summary>
<details>
<summary>Section A.B.C.D</summary>
Done!
</details>
</details>
</details>
</details>
- If certain markdown or styling, such as
# My Title
, fails to render in the collapsible section, try adding a line break after the</summary>
tag. - If your section fails to render, it might be malformed. Consider copying the functional examples provided here and building from there!
There is kinda no point. It's not markdown anymore, it's "just" pure - yet valid - HTML
Here is something I came up with that works. An indented list with collapsable sections.
Each section can have it's own re-indented, list, with collapsable items, + regular MD content
The tricky part is how GH-flavored-md react to spaces and such. You have to indent your whole section in a specific way, and your closing
</details>
tag must be indented as if it was part of the bodyFor it to work, I suggest you keep the spaces and newlines intact
Section 1 with a link
subsection 2 with a link
another subsection
a. with another list
b. and some other stuff
d. and,
more,
classic,
md
e. no need of html
last sub-section
blablabla
a random not collapsable section
and another collapsable section
...
section 2
some parent content
and another list
section 2.1
and some content
section 2.2
and some content
section 2.3
and some no collapsed content
the code: