So, I’ve made this details widget that pairs well with tables and lists,
(well- one’s that are set to use 14px font-size and 22px line-height..)
When I use it though, I can’t place one inside another any deeper than two levels.
for instance:
<<jmh-details 'open'
'Summary Level 1'
'''
<<jmh-details "open"
"Summary Level 2"
"""
Placing another inside would cause them to break.
"""
>>
'''
>>
Is there a way to fix this, or is it just the trade off of the convenience of widgets?
I’ve attached the related files for those who want to see how I have it set up. I still have more to improve on, for instance, I need to change the values to use the font-size set in the tiddler, as having font that isn’t 14px causes the <details> to not connect to tables.
So, my goal is to have the ability to use my macro to create togglable sections, using the details tag with some CSS, to either nest them as deep as I wish, or to have them one after the other in a seemless, table-like design.
Something like below is my end goal, I’m not sure what a recursive macro is, but I’d be happy to learn!
<<jmh-details 'open'
'summary 1'
'''
Text Here!
'''
>><!--
sidenote, if there is a way I can connect these without having to have the double angle brackets touching would be nice, but not necessary.
--><<jmh-details 'open'
'summary 2'
'''
<<jmh-details 'open'
'summary 2a'
'''
<<jmh-details 'open'
'summary 2aa'
'''
Text Here!
'''
>>
'''
>><<jmh-details 'open'
'summary 2b'
'''
Text Here!
'''
>>
'''
>>
Also, here is the fix for the wonky font-size and line-height issue, You should be able to drop this into an empty tiddlywiki and press alt+d to paste in the macro.
Hm, well- I chose to do it using a macro just for less text on the page to make it easier to see, but it might just be easier to use it in bare html instead like you suggest.
Yes! I have a keyboard shortcut to paste it in from the editor toolbar, the key combo is alt+d!
Now my only struggle is getting it to apply padding to the paragraphs inside of it, and not to the details tag themselves. hmm…
I’m not entirely sure what you mean by this, could you reword it?
I was aware of it, and decided against it, as I just wanted vanilla details, just styled to look as though they were the headers of tables, so that I could collapse tables and preserve storyriver space.
In the end, to save myself the trouble I’ve decided to use vanilla HTML elements, and paste them in using a keyboard shortcut. It’ll be a bit of a hassle if for instance I make a change to how I set up one of the details elements (ie, adding a class to a previously classless tag) but that shouldn’t be that bad if I plan ahead.
An editor toolbar button that wraps your text with the details html would help.
I am thinking about the challenge a little more.
Keep in mind you can use a stylesheet to target the html details tag without setting a style or class, but for safety give it a little specificity.
perhaps you wrap the whole thing in a <div class="nested-details">then your CSS applies only to <details> that are the children of the nested-details class. (I know this will work but it will take time for me to do it, @TiddlyTitch could tell us.
Exactly as I said, if you do not have a blank line after any html including <hr> but in this case <details><summary>summary</summary> before you have text/or wikitext, the display will get “corrupted” as it displays in inline mode not block mode (multiline mode), and will fail to render the wikitext.
See in my examples there is a blank line before “wikitext”.
Sorry, I thought you were asking whether or not I needed it, yes I’m aware of the requirements for it to work correctly! I admit sometimes I do mistype things and cause it to mess up
This is actually what I am currently doing. I’m having a little bit of trouble with selecting p elements that do not contain details elements, but I can elaborate on that when I return.
EDIT: Thank you @pmario for updating the discussion title, I didn’t think to do that