10

Code samples (using the backtick) inside of spoilers are still visible. Like shown in this screen capture:

Code fragment visible in spoiler text

It does this on most sites other than SO and Meta.

As you can see below, code is still invisible inside of spoilers here on meta.

- Spoilers are denoted by the >! string before the line that is being spoiled.

Having bits of a spoiler visible before you mouse over it kind of spoils the purpose of a spoiler.

7
  • Oops, my bad: I voted to close too, but when I was about to change "visible" into "not visible" in the title, I realized I totally misread this. Enhanced the post a bit. I think it's NOT a duplicate, @Michael et al!
    – Arjan
    Commented Nov 15, 2011 at 21:00
  • @Arjan They seem the same; the post I linked to is "how do I make code in a spoiler block invisible", this is "bug: code in a spoiler block is visible" Commented Nov 15, 2011 at 21:01
  • I disagree, @Michael. This one is about the backticks erroneously being visible (which actually matches the 2nd example in the other post, which renders fine, in Meta's color scheme). Just a minor CSS tweak to fix this, I guess.
    – Arjan
    Commented Nov 15, 2011 at 21:03
  • 2
    @MichaelMrozek No. On the other question, he made inline code invisible in his spoiler. I'm saying that on some sites, inline code is visible inside of spoilers. His problem was specific to block code, this is specific to inline code. Commented Nov 15, 2011 at 21:03
  • 1
    While waiting for a proper fix from the SE folks, I've included a client-side fix for this (and a bunch of other spoiler CSS issues) in SOUP v1.6. Commented Feb 10, 2014 at 14:05
  • I'd love to see this resolved, there is a great technique for posting answers on Math that I'd love to be able to easily apply on SO.
    – Jason C
    Commented Mar 22, 2014 at 17:02
  • 1
    Looks like this got fixed somewhere down the line.
    – Adam Lear StaffMod
    Commented Apr 4, 2014 at 22:33

1 Answer 1

4

Also, prettified code blocks are visible, even on SO and here on Meta. I'd have guessed this was not an issue for anyone, but apparently it is.

In spoilers, using <pre> works, but using <pre><code> currently messes up with hiding the spoiler:

Spoiler with a code block:


 var a = 3;
 while (not (a > 0)) {
   alert("JavaScript code <b>goes</b> here.");
 }
 
(Also, the paragraph spacing is very different from regular Markdown.)

Even <!-- language-all: none --> does not fix this, as then all text is just rendered in black once Prettify kicks in:

Spoiler with a code block:


 var a = 3;
 while (not (a > 0)) {
   alert("JavaScript code <b>goes</b> here.");
 }
 
(Also, the paragraph spacing is very different from regular Markdown.)

2
  • We have never really supported mixing HTML and Markdown in the same post. Don't use the <pre> and <code> tags inside spoilers, and you're pretty much all set.
    – Adam Lear StaffMod
    Commented Apr 4, 2014 at 22:32
  • 1
    Unfortunately, spoilers don't support Markdown code blocks, @Anna. (Not that I ever use spoilers, and even if I did I'd dislike the huge blank grey block... For that, I'd still recommend re-using the spoilers from the mobile theme on regular sites, but like noted above, the mobile layout messes up the above as well.)
    – Arjan
    Commented Apr 5, 2014 at 0:55

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