What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

Following the Do we want the “spoiler” feature turned off? thread on meta.tex.sx, it's clear that the spoiler markup has a wrinkle or two that I didn't at first appreciate. For information's sake, the spoiler feature is contentious because it collides with the syntax for Latex errors.

Is there a precise description of when a blockquote will be treated as a spoiler?

Two related threads containing some information on the syntax:

  1. Implement the <spoiler> tag
  2. Add markdown support for hidden-until-you-click text (aka spoilers)
share|improve this question
    
This is by no means an answer but I was playing with it in the formatting sandbox and found that if you insert a blank line anywhere within the block quoted text, the spoilers are completely disabled for that block. Could be used as a temporary workaround until the feature is refined or is otherwise changed. –  Jeff Mercado Dec 21 '10 at 8:58
    
@Jeff - that is intended behavior. If a blockquote contains a line that doesn't start with a ! its not a spoiler. –  Kevin Montrose Dec 21 '10 at 9:06
    
Likewise, you can throw in some non-rendered content on an extra > line that will be ignored, and it'll prevent the spoiler-fication (since it's just a blockquote then). –  Tim Stone Dec 21 '10 at 9:06

1 Answer 1

up vote 23 down vote accepted

The way spoiler works is as follows.

If each line in a blockquote (built via >) begins with a ! it will be treated as a spoiler.

So,

>! This is a spoiler

This is a spoiler

>! But this is  
> not a spoiler

! But this is
not a spoiler

>! A multi-line spoiler  
>! has ! multiple times

A multi-line spoiler
has ! multiple times

>! Alignment  
> ! has no effect  
 >  ! on spoilers  

Alignment
has no effect
on spoilers

Due to wrinkle in how blockquotes are generated, leading white space is pretty pointless.

> ! <- still a spoiler

<- still a spoiler

The actual code expects very specific html (this a "post markdown" process). In particular, omitting the inner <p> will dodge "spoiler-ification".

The only way to guarantee a blockquote becomes a spoiler is to use the explicit >! syntax.


Prior to implementing this, I did actually check for posts that would be affected by this syntax (on SO its under one-tenth of a percent*). Even on TeX, (where ! is rather likely to come up as a first character) it is exceedingly rare (lower than SO levels). People seem very biased towards using code tags.

I'm not saying there aren't any, but any new syntax is going to catch somebody.

*Admittedly, I'm regex-ing wildly through lots of data, there is some room for error. Pretty sure I'm erroring on the side of over counting affected posts, though.

share|improve this answer
    
Do the !s have to be vertically aligned? –  Charles Stewart Dec 21 '10 at 8:59
    
@Charles - no, they just need to be the first non-whitespace character after the >. –  Kevin Montrose Dec 21 '10 at 9:01
    
I tried to add an image in the spoiler, but the image is always shown. Only text is hidden. I added this: ` >! Spoiler ![Image description][3] Hello`. The text "Spoiler" and "Hello" was only shown on mouseover, but the image in the middle was shown always. –  awe Sep 11 '12 at 8:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .