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

Possible Duplicate:
How can I put a whole code block in spoiler text?

I know I can use the <code> tag and some other html tags inside a spoiler block, but the code is not formatted or highlighted.

Is there a way to include formatted code inside a spoiler block?

share|improve this question

marked as duplicate by Arjan, Lance Roberts, Martijn Pieters, Austin Henley, Toon Krijthe Feb 2 '13 at 19:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
In the preview, using >! <code><pre> ... actually does trigger highlighting, and then even messes up the spoiler, by always showing the text... (Assuming the question's tags would trigger some highlighting to start with.) –  Arjan Feb 2 '13 at 14:00
add comment

1 Answer

Nope, everything in the spoiler block is treated as one paragraph. :-(

You cannot use bullets either. I consider this a bug, the parser should treat it just like a blockquote, albeit one that is rendered with an extra class. In a blockquote you can use all the other formatting options still, provided you use one extra space in your indentations:

Block quotes support bullets and code blocks:

  • This is a bullet with a codeblock:

    # Python easter egg:
    import this
    

(note that no highlighting is applied to blockquotes either).

In a spoiler block (which only adds a ! exclamation mark) this doesn't work, but I feel it should:

Block quotes support bullets and code blocks: * This is a bullet with a codeblock: # Python easter egg: import this

Your only workaround is to use explicit HTML tags yourself.

Markdown source for the above blocks are:

  • Blockquote

    > Block quotes support bullets and code blocks:
    >
    > * This is a bullet *with* a codeblock:
    >
    >         # Python easter egg:
    >         import this
    
  • Spoiler block

    >! Block quotes support bullets and code blocks:
    >!
    >! * This is a bullet *with* a codeblock:
    >!
    >!         # Python easter egg:
    >!         import this
    
share|improve this answer
    
Well, like the question explains: one can use HTML in spoilers, including lists. –  Arjan Feb 2 '13 at 13:54
    
@Arjan: Yup, but the spoiler block should be handled just like a blockquote instead. –  Martijn Pieters Feb 2 '13 at 13:55
add comment

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