3

Here's a Stack Snippet:

for(var o of document.getElementsByTagName("input")){(o=>o.addEventListener("change",e=>console.log(o.value=o.value?o.value[0]:"")))(o)};
input{width:1em;}
<input /><input /><input /><input /><input /><input /><input /><input />

Here's the markup to create such a Stack Snippet:

    for(var o of document.getElementsByTagName("input")){(o=>o.addEventListener("change",e=>console.log(o.value=o.value?o.value[0]:"")))(o)};
    input{width:1em;}
    <input /><input /><input /><input /><input /><input /><input /><input />

Oh. In the edit window it looks like this:

<pre>fed8cd34-c447-9c25-6a88-70385d84a60e</pre>

(except with a UUID that changes randomly whenever I type a key into the edit window) but in the actual question, it looks much more hideous, as you can see.

7
  • and why you want to indent a snippet? Jan 5, 2019 at 14:14
  • 1
    You may want to be explicit about what you expected to see instead. I would expect to see all of the indented section to be treated as a code block, including the HTML comments that make up the snippet syntax, certainly.
    – Martijn Pieters Mod
    Jan 5, 2019 at 14:15
  • 2
    @TemaniAfif how else could you talk about that syntax as code? This is a real bug, the markup should not be treated as a snippet inside a code block, whatever the use cases might be.
    – Martijn Pieters Mod
    Jan 5, 2019 at 14:15
  • @MartijnPieters a snippet is a code, so we know it's a code, why indenting it as a code? Jan 5, 2019 at 14:18
  • 1
    @TemaniAfif try posting an answer on Meta demonstrating what that syntax to mark up a snippet looks like. You can’t, because you can’t put the syntax in a code block.
    – Martijn Pieters Mod
    Jan 5, 2019 at 14:18
  • 1
    @TemaniAfif We can put Markdown and HTML in a code block, so we can normally “escape” such syntax and show it inraw form. That we can’t with the snippet markup is a bug.
    – Martijn Pieters Mod
    Jan 5, 2019 at 14:20
  • @MartijnPieters I would also expect to see all of the indented section treated as a code block.
    – wizzwizz4
    Jan 5, 2019 at 14:22

0

Browse other questions tagged .