So one of the things I’ve come into the habit of doing is turning all of my tiddlers with headers into details disclosures so that the text beneath them can be nested.
It got me wondering, could this be achieved useing wikitext, and if so, existing wikitext?
after a bit of time just working on other things and revisiting the idea, I considered if it might be possible to modify the hard linebreak wikitext to turn into disclosure elements, or collapsible elements if we wanna make custom stuff that isn’t tied to the disclosure html element, and thought, “well you need to wrap where text will be, so have some way to determine where it stops, and you need something to act as the summary text.” and came up with!
"""
Normal linebreak wikitext section!
"""
"""
! collapsible linebreak section!
Normal linebreak wikitext section!
"""
where the text under the previous header would be inside of the disclosure, and if there were a new header, it would create a new one, or, if the header is a sub header, nest underneath it, i.e.
"""
! header 1
Normal linebreak wikitext section
!! subheader 1
disclosure is nested under the other
"""
which would render out as:
<details>
<summary><h1>header 1</h1></summary>
<p>Normal linebreak</p>
<details>
<summary><h2>header 2</h2></summary>
<p>disclosure is nested under the other</p>
</details>
</details>
and, just because of how header elements are styled, you would need anm accompanying stylesheet with something like:
details > summary {
h1, h2, h3, h4, h5, h6 {
display: inline;
}
}
But, I know next to nothing about JavaScript, so I have no idea if this is even possible, let alone what needs to be added to the hardlinebreaks.js tiddler.
So I thought it would be best to ask first, would this even work? (if yes, then down the rabbit hole I go IG lol)