Better rendering of hide-details-summary in emails

I noticed that the summary part in [details=Summary]This text will be hidden[/details] is rendered as ordinary text in emails with nothing hinting at the hidden details.

This is what it looks online:

And this is what it looks like in the email

I think it would be great to somehow convey to email recipients that what they are seeing is only the summary of a larger chunk of text.

To start with, it would be good if the black triangle that is shown before the summary online would also be included in the email. In addition, it might even be good to add a link after the summary saying “Click here to see details online” which would open the post online with that particular detail segment expanded (if that is possible at all).


I noticed the same issue. Note that in the plain text mail view, the text is collapsed.

I would suggest to refile this topic to #bug.


I tried to reproduce this today on meta, and I don’t see that. In the plaintext view, I get the complete markdown source code:

[details=This is cool]
Or is it?

And in the HTML view I get just the title part:

<div style="padding-top:5px;"><p>
This is cool</p></div>

Maybe I didn’t express cleary enough what I meant.

Authors of posts containing the hide details feature assume that the reader will understand due to the interface design, that more information is available and can be unfolded. Often, the authors choose therefore to not point out that fact explicitly in the their text.

Unfortunately, a folded hide details element does not look different than a paragraph in a text mail, which may confuse the reader and doesn’t meet the expectations of the post author, that assumes that readers can easily unfold the hidden details.


Well, I’m fully in agreement that the HTML version is sub-optimal. I started looking for the cause of that but haven’t isolated it yet. I got as far as finding in user_notifications_helper.rb :

  def format_for_email(post, use_excerpt)
    html = use_excerpt ? post.excerpt : post.cooked
    PrettyText.format_for_email(html, post).html_safe

And examined post.excerpt to see details aren’t being squashed there. So it’s probably PrettyText.format_for_email, but I haven’t gotten toreading-that-code/testing/proving that.


Turns out it is so simple. That’s exactly what the details plugin is trying to do with details in email: hide all the content.

If you want to put a little triangle before the summary title of a details, it’s this line:

And a replacement like this would do it:

          details.replace("&#x25b6; " + summary)

(U+25B6 being the triangle used for a closed details line.)


Sure, feel free to submit a PR on that!

I have no doubt it would be accepted, but I’m not sure that’s enough. Even @tophee in the first post considered the triangle the bare minimum.

What happens to the poor mailing-list-mode reader? Content is forever hidden if they prefer the HTML?

I surmise this stuff is filtered from email, because email agents don’t have the smarts to handle these. Is there an alternative presentation that makes sense?


What exactly do you mean by “this stuff”? If you mean the triangle, I guess it should be displayed properly if it’s not an image but a character.

The next better version would be to also add some text after the summary indicating that there is more, like:

40 Minutes: 5 presentations (visit topic for more details)

Yet another improvement would be to make that text a link to the topic.

Given the discourse philosophy, I’d actually say this would be enough for ordinary users. For users with mailinglist mode on, I’d suggest that the full details are included in a smaller font size.


A div that gets shown / hidden by clicking on another div.

This I like, but I’m unsure how to tell from the plugin if it is a regular email or a mailing list email.

Which leaves:

Anyone have other suggestions?


Just bumped into this. not a huge deal, I think we’ll just advise people using the [details] block about this as a known issue unless someone has a better idea.


@nbianca can you add to your list to add a link “(click for more details)” next to the summary in emails instead of just removing the content of the [details] tag?


Sure, here it is: