4

If snippets code have four spaces from start line, then in preview shown just

enter image description here

And in finish view snippets shown in one scrollable block

(function(){
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
    })
Snippet 1

    <div>Many lines of code, Many lines of code,Many lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of code</div>
    (function(){
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
    })
    Snippet 1

    <div>Many lines of code, Many lines of code,Many lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of code</div>
    (function(){
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
    })
    Snippet 1

    <div>Many lines of code, Many lines of code,Many lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of code</div>
    (function(){
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
    })
    Snippet 1

    <div>Many lines of code, Many lines of code,Many lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of code</div>
    (function(){
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
     // some code
    })
    Snippet 1

    <div>Many lines of code, Many lines of code,Many lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of code</div>

But if no four spaces:

(function(){
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
})
Snippet 1

<div>Many lines of code, Many lines of code,Many lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of code</div>

(function(){
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
})
Snippet 1

<div>Many lines of code, Many lines of code,Many lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of code</div>

(function(){
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
})
Snippet 1

<div>Many lines of code, Many lines of code,Many lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of code</div>

(function(){
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
})
Snippet 1

<div>Many lines of code, Many lines of code,Many lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of code</div>

(function(){
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
 // some code
})
Snippet 1

<div>Many lines of code, Many lines of code,Many lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of codeMany lines of code</div>

Each snippet shown separately.

So, is this bug or feature? And how output code for snippets now?

2
  • you mean four spaces from the start(left)?
    – Suraj Rao
    Sep 22, 2017 at 7:20
  • yep, from start line
    – Grundy
    Sep 22, 2017 at 7:27

2 Answers 2

0

You embedded your snippet into another code block. 4 spaces from the start is markdown syntax to insert a code block. So all the individual code snippet sections which had 4 additional spaces ended up inside the outer code block.

You can do the same effect by selecting the snippet code and pressing CTRL+K or {} button in the editor.

It looks like a side effect of incorrect formatting and doesnt look like a bug to me.

2
  • 2
    yep, i say about 4 spaces from the start in a question, but why in this case, snippets still work, instead just shown as code?
    – Grundy
    Sep 22, 2017 at 7:37
  • 1
    that is an interesting question.. although it is definitely not new check this sandbox post
    – Suraj Rao
    Sep 22, 2017 at 10:00
0

1. It is not new feature.

2. The snippet works but it shown as code.

This is intended behaviour of Markdown. When you add anything after a new line and four spaces, it will be rendered as codeblock.

And snippet is wrapped under some HTML comment. So the snippet will work anyway without considering it's parent. That is the code block.

<! -- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<! -- end snippet -->

One more thing you may note is that in the above code, the begin snippet and end snippet line won't render even inside code block. (I added a space to show it. Removing the space will render it as)

3
  • "This is intended behavior of Markdown" That whatever is indented 4 spaces is rendered as a code block is intended behavior of Markdown. That a snippet is rendered inside the code block is as far is I know not intended behavior, the code block should render the code inside it just like that, even if the code happens to be markdown code for a snippet. Sep 22, 2017 at 11:43
  • @DonaldDuck mark down have lots of drawbacks. You can't add a code block after a list unless you used a header #/##/### between the list and code. And there are more issues Sep 22, 2017 at 11:56
  • 1
    @redhand actually you can add code blocks after list by giving 4 additional spaces. Its one of the rules of markdown..
    – Suraj Rao
    Sep 23, 2017 at 4:16

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