17

If you insert a stack snippet next to a code block, it gets the formatting of code.

Example:

font-family: tahoma, verdana, ubuntu, 'sans serif';
* {
  font-family: tahoma, verdana, ubuntu, 'sans serif';
}
<p>
  Unicorns I love them.
  <br />Unicorns I love them.
  <br />Unicorns I love them.
  <br />Unicorns I love them.
  <br />Uni uni unicorns, I love them!
</p>

In edit mode, this is somewhat different, but still formatting is screwed:

enter image description here

This is probably because the begin snippet is in the same line as the preceding code block:

font-family: tahoma, verdana, ubuntu, 'sans serif';<!-- begin snippet: ...

But inserting the begin snippet to the same line is done by the snippet editor, not the user.


Here is the bug misterManSam describes in the comments:

enter image description here

4
  • 2
    Yeah, we should be smarter about where the snippet is inserted, since Markdown parsing requires a blank line between different "blocks" to be styled correctly.
    – Adam Lear StaffMod
    Sep 25, 2014 at 20:53
  • @AnnaLear's right. Let me see what I can cook up for this.
    – Haney StaffMod
    Sep 25, 2014 at 21:02
  • 2
    @AnnaLear - Also, if you add a Stack Snippet to your post that has a link, the closing snippet tag is lined up with the [1]:Link and screws up the formatting. Looks like this: <!-- end snippet --> [1]: link Sep 26, 2014 at 7:03
  • 1
    Holy stack, snipception!
    – MarioDS
    Sep 26, 2014 at 10:53

1 Answer 1

3

Thanks for bringing this to our attention. I've corrected the Markdown insertion of Stack Snippets so that they will be properly inserted as their own block (separated by white space above and below). This will be live in the next production build (meta: > rev 2014.9.26.2606, q&a: > rev 2014.9.26.1893).

You must log in to answer this question.

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