6

Stack Snippets still attempt to be rendered when indented or within code fences.

This behaviour was first observed "in the wild" on this (now deleted) answer on Stack Overflow and in Revision 2 of this question

A normal Stack Snippet looks like:

<span>A normal Stack Snippet</span>

However when a stack snippet appears inside code blocks we end up with this oddly formatted Stack Snippet

<span>Something went wrong</span>
    <span>This also isn't great</span>

Because of the rendering issues I can't really figure out a way to show this markdown as text (since normally I'd use code markdown to escape the rendering), but here's an image of what the markdown looks like:

Markdown for the Stack Snippets nested in code blocks

The preview renders this:

Stack Snippets nested in code blocks preview render

Also curiously typing changes the preview values:

Animation demonstrating how the stack snippet preview values change while typing

Then when the question goes live it appears like a normal snippet again except nested inside the <pre> block: Stack Snippet embedded in code markdown after being rendered


This behaviour was originally observed on Stack Overflow, reproduced here and on Code Review.

I assume the stack snippet markdown shouldn't be rendered as executable inside code markdown. However, if Stack Snippets inside of code blocks is intended then the preview would need to be fixed.

5

0

Browse other questions tagged .