16
>! This is a spoiler.
>! A multi-line spoiler.
>! It works, as a spoiler, but it is not properly formatted as a multi-line spoiler.

This is a spoiler. A multi-line spoiler. It works, as a spoiler, but it is not properly formatted as a multi-line spoiler.


>! Let's try again.

>! Maybe this will work.

>! No, it doesn't!

! Let's try again.

! Maybe this will work.

! No, it doesn't!


>!This is a workaround.
>!<p>Sadly, it requires typing lots of p tags, although the first and last lines do not require them.</p>
>!Is there a better way?

This is a workaround.

Sadly, it requires typing lots of p tags, although the first and last lines do not require them.

Is there a better way?

2
  • 4
    You can use <br> tags instead or paragraphs
    – Cai
    Commented Sep 27, 2016 at 13:48
  • For me, "Is there a better way?" in the last spoiler shows up even before revealing spoilers. Does that happen for others?
    – LSpice
    Commented Feb 9, 2023 at 2:37

4 Answers 4

7

There is a much, much simpler way of this.

>! First line... <br> Second line... <br> Third line... <br> I think you understand this now `

First line...
Second line...
Third line...
I think you understand this now

<br> is used for creating a newline basically within a single line. In this case, the <br> brings all the text after it into the next line and covers the text since it is technically in the line with the spoiler tag. Consecutive <br> will create more and more lines. This tag is commonly used to formatting text is a specific way like a puzzle:

Do you
now know
how to make
multi-lined spoilers
without a line
between each line of text?

1
  • Fail. Doesn't work with numbered lists!
    – CommaToast
    Commented Apr 21, 2023 at 5:21
20

You can do it in a better way:

  • add two spaces in the end of the line for line-break
  • add >! with two spaces in the new line for the line break with in spoiler.

Sample content as:

>! This is a spoiler.  
>!  
>! A multi-line spoiler.  
>!  
>! It works, as a spoiler, but it is not properly formatted as a multi-line spoiler.

This is a spoiler.

A multi-line spoiler.

It works, as a spoiler, but it is not properly formatted as a multi-line spoiler.

0
4

<p> tags don't need closing tags in HTML5 if they're followed by other <p> tags, so you can shorten things a bit:

>!1<p>2<p>3<p>4<p>5

1

2

3

4

5

rather than

>!1<p>2</p><p>3</p><p>4</p>5

1

2

3

4

5

As this involves less typing than even <br> tags, and introduces real paragraphs to boot, this is probably the best you're going to get.

2

If the multi-line spoiler contains a code block (for example to format a data table), a hack to make a multiline spoiler work:

>!<code>line 1</code>    
>!<code>line 2</code>    
>!<code>line 3</code>

Produces

line 1
line 2
line 3

Note: The four ASCII spaces after every line but the last are required.

You must log in to answer this question.

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