31

A simple spoiler at the top of the question works, but the bug is that spoilers don't work further down the page.

I wanted to create a spoiler at the end of an answer, so I added the text in a spoiler block (based on the information in What is >! in formatting?:

>! One way to fix the problem — not necessarily the best, by any stretch of my
>! imagination, but one which works — is to fix the the LHS of the `lhs << (15 - i)`
>! shift so that it is either 0 or 1 that is shifted.  For example:

>! `((ptr[j] & (1 << (7 - i % 8))) ? 1 : 0) << (15 - i)`

And the spoiler here is the same, not indented:

! One way to fix the problem — not necessarily the best, by any stretch of my ! imagination, but one which works — is to fix the the LHS of the lhs << (15 - i) ! shift so that it is either 0 or 1 that is shifted. For example:

! ((ptr[j] & (1 << (7 - i % 8))) ? 1 : 0) << (15 - i)

And, as you can see, the spoiler doesn't work. That seems to be a bug.


Solution

Thanks Madara Uchiha. The solution is to ensure that even blank lines in the spoiler are prefixed with >!.

One way to fix the problem — not necessarily the best, by any stretch of my imagination, but one which works — is to fix the the LHS of the lhs << (15 - i) shift so that it is either 0 or 1 that is shifted. For example: ((ptr[j] & (1 << (7 - i % 8))) ? 1 : 0) << (15 - i)

>! One way to fix the problem — not necessarily the best, by any stretch of my
>! imagination, but one which works — is to fix the the LHS of the `lhs << (15 - i)`
>! shift so that it is either 0 or 1 that is shifted.  For example:
>!
>! `((ptr[j] & (1 << (7 - i % 8))) ? 1 : 0) << (15 - i)`

Residual bugs that still need fixing

The bug, then, is that the behaviour of spoiler text is not spelled out clearly in the documentation, nor in answers to other questions about spoilers that I've seen. Also, the normal convention that 5 spaces after a leading > goes into code mode does not seem to work with spoilers. That too should be mentioned (or, better, fixed). Spoilers aren't just 'ordinary quoted blocks starting with >! instead of just >'; there are many differences, at least when you count them on the 'zero, one, many' scale.

Put succinctly, spoilers are still inadequately documented.

It would be helpful if the advanced help in the Markdown help is complete enough to explain such pitfalls (or is it pratt-falls?).

Also:

And I see that it is not deemed to be a bug but a support issue. Hmmmm…

8
  • 1
    Well... works as designed == not a bug.
    – Oded StaffMod
    Commented Nov 15, 2014 at 17:31
  • 22
    @Oded: WAD might be BIS == bug in specification, or it might be BID == bug in documentation. Not having the system explain what the design is (crucial little details such as 'you cannot have two consecutive spoilers without intervening text' have not been documented before) means it is impossible for people to know whether they're hitting a bug or not. And the fact that we can't tell from the help is a bug in the help. And merely documenting it will mean 'documenting an unintuitive consequence of a design decision', but that doesn't make it a good design decision. Commented Nov 15, 2014 at 17:35
  • 5
    Why copy the answer to the contents of the question?
    – BartoszKP
    Commented Nov 16, 2014 at 15:23
  • @BartoszKP: because I want to extend the information from the answer with assertions about the inadequacy of the documentation on the subject. Commented Nov 16, 2014 at 15:27
  • 3
    @JonathanLeffler All right, this however makes this a chameleon question. And the title no longer matches its purpose. Not a big problem, however looks a bit confusing :)
    – BartoszKP
    Commented Nov 16, 2014 at 15:30
  • @BartoszKP: The question changed a bit once the answer gave a better understanding of the problem. That's not unusual; when you don't know what the problem is, you can't necessarily describe the problem accurately. The problem becomes 'the functionality is more complex than the documentation says'. Commented Nov 16, 2014 at 15:49
  • @JonathanLeffler I understand this mechanism, it's not surprising to me and I know it happens :) The cause however, doesn't change the fact I've stated.
    – BartoszKP
    Commented Nov 16, 2014 at 16:01
  • 2
    @Oded how can it really be working as intended if taking every > from a quote that renders in a single block and placing ! after it doesn't make that entire block a spoiler block? If that really is what you intended it violates the principle of least surprise, and if I might be so bold a seemingly silly intention. Oooo, I said it. Silly.
    – corsiKa
    Commented Nov 17, 2014 at 20:07

1 Answer 1

36

With spoilers, every line must begin with >!, including blank lines.

One way to fix the problem — not necessarily the best, by any stretch of my imagination, but one which works — is to fix the the LHS of the lhs << (15 - i) shift so that it is either 0 or 1 that is shifted. For example:
((ptr[j] & (1 << (7 - i % 8))) ? 1 : 0) << (15 - i)

>! One way to fix the problem — not necessarily the best, by any stretch of my
>! imagination, but one which works — is to fix the the LHS of the `lhs << (15 - i)`
>! shift so that it is either 0 or 1 that is shifted.  For example:
>!  
>! `((ptr[j] & (1 << (7 - i % 8))) ? 1 : 0) << (15 - i)`
7
  • 4
    Thanks! That should be spelled out clearly in the Markdown help, though. Commented Nov 15, 2014 at 17:20
  • 11
    It should.​​​​​​ Commented Nov 15, 2014 at 17:20
  • 1
    What keeps the renderer from interpreting the above broken example as two consecutive spoilers? Commented Nov 17, 2014 at 23:32
  • 13
    I have no idea. I've slaughtered a goat and currently drawing a circle to summon one of the devs. Commented Nov 18, 2014 at 9:45
  • Is it possible to have a formatted code block within a spoiler? Such that the code lines can retain their indentation?
    – mbomb007
    Commented Feb 27, 2015 at 20:13
  • @mbomb007 From experience, no. I may be wrong here though, it's worth asking a new question. Commented Feb 27, 2015 at 22:11
  • Asked here: meta.stackoverflow.com/questions/287073/…
    – mbomb007
    Commented Feb 27, 2015 at 23:07

You must log in to answer this question.

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