[pmwiki-users] RFC: ToggleNext or Details+Summary

Petko Yotov 5ko at 5ko.fr
Wed Jan 29 04:52:55 PST 2020

I asked Dominique to send this to the list for a proper debate.

I made a mistake by enabling this ToggleNext feature without discussion, 
but it is probably not too late to revert it (before people start 
building on it) and do it better.

Currently there is the "details+summary" nestable block markup:

   (:details123 summary="a summary":)...(:details123end:)

It produces a <details> block that works in modern browsers except 

It doesn't allow a multi-line summary with a complex markup or even 
quotes in the summary, but per PmWiki Philosophy "2. Don't try to 
replace HTML" this looks like the most common need for such markup. We 
can also enable the following:


Instead of, or in addition to the ToggleNext implementation, we can add 
a JavaScript polyfill and a reasonable CSS so that the <detail> elements 
work with both current and older browsers.

Dominique, I wasn't thinking about changing ToggleNext to produce a 
details+summary block.

I wrote ToggleNext because I needed the open/close feature for a project 
FAQ and it was simpler to implement cross-browser than <details>, and 
also I could control the styles so when the page is printed, all hidden 
sections are open. The last requirement is more complex with <details> 
but maybe can be done.

It is also possible to keep both ToggleNext and a cross-browser working 
<details> but this may sound like a feature creep. Also, I feel that the 
(:details:) markup in a wiki page, while more characters to type than %p 
toggle%, leaves the page source text more readable.

BTW, ToggleNext is disabled by default in the core but can be enabled in 
an easy way, like the other new features added recently (table of 
contents, code highlighting...).

Anyways, I'd like to read more thoughts about this.


On 29/01/2020 13:07, Dominique Faure wrote:
> Hi,
> Before all, I want to thank Petko sparing no effort to provide us with
> an ever more efficient wiki including interesting features with each
> release.
> The last release (v2.2.125) was embedding the ToggleNext[1] recipe and
> I wanted to share some thoughts on this particular feature:
> The ToggleNext recipe is mostly a upgraded rewrite of what was offered
> by the previously released as beta Untoggle[2] recipe, ie. a clever
> use of css and javascript to offer visual toggling of sibling document
> divs.
> For several years, the W3C was defining the <details>...</details>
> html block element[3] which should enable the same features in recent
> browsers natively[4], and it has already been handled (at least
> partially) in our favorite wiki engine[5].
> My concern here is two-fold:
> In order to keep being future-proof as usual with PmWiki, the
> ToggleNext recipe should be relying on the <details> and <summary>
> elements for the html rendering, even if this implies providing some
> kind of element+behavior simulation for older browser (aka a
> polyfill), such as those easily available on github[6][7].
> For now we are in lack of a proper wiki markup definition to handle
> the <details> and <summary> elements as a sole structural block
> possibly nestable (btw, there're similar potential issues with the
> <fieldset> and <legend> couple and one of the <label> + <input> form).
> Perhaps, we need a slightly more elaborate (:div:) handling which
> would allow to specify if a (:summaryNN:) block markup could render as
> the summary element of the following first encountered (:detailsNN:)
> block such as:
> (:summary:)
> Nested content
> (:details:)
> The de-facto container
> (:detailsend:)
> giving:
> <details>
>   <summary>
>   Nested content
>   </summary>
> The de-facto container
> </details>
> Regards,
> Dominique
> References:
> [1] https://www.pmwiki.org/wiki/Cookbook/ToggleNext
> [2] https://www.pmwiki.org/wiki/Cookbook/UnToggle
> [3] 
> https://html.spec.whatwg.org/multipage/interactive-elements.html#the-details-element
> [4] https://caniuse.com/#feat=details
> [5] https://www.pmwiki.org/wiki/PmWiki/BlockMarkup#semantic
> [6] https://gist.github.com/remy/370590
> [7] 
> https://github.com/javan/details-element-polyfill/blob/master/dist/details-element-polyfill.js
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users

More information about the pmwiki-users mailing list