16
$\begingroup$

The spoiler line is great for hiding text:

If you edit this post, you can see the ways I tried to use the spoiler formatting which produced the fails.

But it can be difficult to use sometimes.

! Maybe I want to have multiple chunks hidden in a row

! Well nope, does not work like that

You have to include non-blocked text between two things in spoiler hiders

That non-block text above made me exist!!!

Well that's a simple fix right?

! Just put all the text in one block. Put a return at the end of a line and indent the next paragraph with some spaces. Ahhh, if only it worked that way, then that's what we would do.

But it doesn't, so we have to talk

like

this

.

Does anyone know why the spoilers behave this way, and is there anything we can do to make them function as blocks?

Edit: Based upon Koa's answer and ABCdexter's question, I started testing what things work in a spoiler.

Bold
Italic
$\frac{a}{b}$

$\endgroup$
  • 3
    $\begingroup$ and we need better formatting in spoilers, like bullet point $\endgroup$ – Fabich Jun 4 '16 at 0:50
  • $\begingroup$ Yesterday, I was using the stackexchange android app and faced a lot of trouble using the spoilers. Apparently, the bold and italics also don't work in the spoiler, correct me if i'm wrong. $\endgroup$ – ABcDexter Jun 4 '16 at 11:43
  • 1
    $\begingroup$ @ABcDexter I was able to put bold and italics in. Look at edit. $\endgroup$ – Tony Ruth Jun 5 '16 at 19:12
  • 2
    $\begingroup$ You might want to see my answer here for more info on using spoilers. $\endgroup$ – GentlePurpleRain Jun 7 '16 at 16:30
  • $\begingroup$ One comment. Is there any way to get spoiler in the top margin of the answer box page (similiar to link / quote / code / image icons)? That would be way helpful. $\endgroup$ – zipzit Jun 8 '16 at 22:20
  • $\begingroup$ @zipzit yes, this would be a great addition. I see that it is possible for me to select a block of text and click bold and that it inserts *s in the right places. It should also be possible to create a button where you select a block of text and click spoiler. It would add ">!" to the beginning of every line and " "(two spaces) to the end of every line. $\endgroup$ – Tony Ruth Jun 9 '16 at 18:15
  • $\begingroup$ @TonyRuth Yes, exactly. Right now you have to remember to choose Quotation when you highlight the text, and then add the ! to each line. That's not intuitive at all. A click would be SO much easier. $\endgroup$ – zipzit Jun 9 '16 at 19:45
  • $\begingroup$ @zipzit It would be a feature request, but since spoilers are rarely used on most SE sites (except: Puzzling and Movies & TV) I imagine it would see little push. $\endgroup$ – Jonathan Allan Jun 14 '16 at 2:23
15
$\begingroup$

Spoilers totally work with multiple lines:

Just
have
two

spaces
after
each
line

Also, you need to add a new >! at the start of every line.

>! This shows up
>! as a multi line spoiler.
>! Like breaks
>! Are a double empty space
>!
>! Like that.

This shows up
as a multi line spoiler.
Like breaks
Are a double empty space

Like that.

If you need two spoilers with no text in between
>! Do

<! >
>!this

Do

this

For code blocks in spoilers
>! Do something<pre><code>like ...
>!this</code></pre>

Do something

like       ...
this

Aligned equations must be on one line though
>! Like so\begin{align}f(x)&=0&\text{if }&x\neq 0\\&=1&&x=0\\\end{align}

Like so\begin{align}f(x)&=0&\text{if }&x\neq 0\\&=1&&x=0\\\end{align}

$\endgroup$
  • 3
    $\begingroup$ He's not referring to multi-lines, though, Koa. He's looking at multi-line spoilers with a linebreak in between. For some, odd, reason, this doesn't work and disables spoilers, entirely. For example, a line break after "up" will break yours. $\endgroup$ – Khale_Kitha Jun 4 '16 at 7:14
  • $\begingroup$ @Khale_Kitha I updated it to show how to enter line breaks. Sure, not having to do it this way would be nice, but it's not the end of the world. $\endgroup$ – KoA Jun 4 '16 at 7:42
  • $\begingroup$ This is definitely useful thanks. $\endgroup$ – Tony Ruth Jun 5 '16 at 5:11
  • 3
    $\begingroup$ Note that you can also separate two spoiler blocks without putting text in between them by adding an empty HTML comment between the two blocks: <!-- -->. This results in a small amount of whitespace between the two spoiler blocks. $\endgroup$ – GentlePurpleRain Jun 6 '16 at 15:00
  • 1
    $\begingroup$ @GentlePurpleRain Could be useful to add this as "Tipp" to this post $\endgroup$ – BmyGuest Jun 7 '16 at 6:53
  • $\begingroup$ @BmyGuest I made a new answer. $\endgroup$ – GentlePurpleRain Jun 7 '16 at 16:43
  • $\begingroup$ Maybe I'm being mean, but isn't double-tapping a common knowledge across SE? $\endgroup$ – InitializeSahib Jun 12 '16 at 0:44
  • $\begingroup$ @SahibPrime Spoilers are used way more on Puzzling than anywhere else, and are more often used for entire paragraphs including various formatting. In most other places, they are used for a single plain text word or phrase, so a lot of this stuff is moot. $\endgroup$ – GentlePurpleRain Jun 14 '16 at 16:51
  • $\begingroup$ @GentlePurpleRain Oh, I see. Thank you! $\endgroup$ – InitializeSahib Jun 14 '16 at 17:05
  • $\begingroup$ Can this please be added to meta.puzzling.stackexchange.com/editing-help? As a new user to this site I had great difficulty getting my spoiler tags to work as I wanted them to and the help page suggested by the editor wasn't helpful. $\endgroup$ – niemiro Jun 16 '16 at 10:48
2
$\begingroup$

Separate lines with \n>! like this:

>!Line 1  
>!Line 2  
>!Line 3
Note that these are:

>!Line 1   <------- TWO SPACES
>!Line 2   <------- TWO SPACES
>!Line 3       <---------  NO SPACES

Line 1
Line 2
Line 3

$\endgroup$
1
$\begingroup$

If you want to have multi-line spoilers

 

with a linebreak in between them,

 

you can use a blank line, a line containing just &nbsp;, and another blank line

$\endgroup$
  • $\begingroup$ Well, nope. Too bad this is not "Multi-iine Spoilers". This is just single-line spoilers separated by \n\n \n\n. $\endgroup$ – EKons Jun 7 '16 at 17:02

You must log in to answer this question.

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