logoalt Hacker News

raybbtoday at 3:01 AM2 repliesview on HN

Do they work well for when you want to preview text? Like show the first 100 characters of a paragraph and then click to expand?


Replies

zahlmantoday at 3:38 AM

Yes. For example, on Codidact (https://codidact.com), limited HTML access is offered along with Markdown when making posts, and the details and summary tags in particular are whitelisted. I've made extensive use of this in some of my content, for example https://software.codidact.com/posts/289251/289252#answer-289... . If you have NoScript you can easily verify that the expanding sections work perfectly well without JavaScript. They can even be nested, as they are here; and the summary text can contain some other forms of markup without issue. (When crafting the post, however, I had to do some tricky things with whitespace to avoid confusing the Markdown parser.)

veqqtoday at 3:24 AM

Of course. That's the summary part