All Questions
Tagged with code-formatting stack-snippets
13
questions
4
votes
0
answers
141
views
Appearance of HTML and CSS snippet is changing when it is indented
Today I was editing this question to change the formatting of its code into a runnable snippet. Once I configured the snippet, Stack Overflow would not let me submit my question because it thought ...
5
votes
1
answer
132
views
How do I force Stack Snippets to render as a code block?
Usually, posting blocks of code on Stack Exchange websites is very simple:
You can indent everything by 4 spaces.
Both lines are indented by 4 spaces.
or
```
You can start and end the code ...
9
votes
0
answers
90
views
JavaScript code snippet Tidy function injects a separating space into the null coalesce operator
For JavaScript snippets, the Tidy feature injects a space between the question marks that compose the nullish coalescing operator ??[1].
Example:
Prior to Tidy:
console.log(((a, b) => {
return a ?...
1
vote
0
answers
269
views
How can I explicitly show the return value of a code snippet/sample
Is there an commonly accepted way (best practice if you wish) to show the return value of example code in markdown?
One solution is to add a comment at the end of the function, but I am concerned ...
3
votes
0
answers
55
views
Why aren't runnable code snippets formatted correctly within lists?
Consider the following code snippet.
console.log("this line is all right");
console.log("but this line is indented");
This should be a part of the same bullet point but it's not.
...
4
votes
0
answers
39
views
Increase min-height on SE code snippets to prevent scrollbar from blocking code [duplicate]
When using Stack Exchange/Stack Overflow, anytime there's a one-line code snippet with a horizontal scrollbar, the majority of the code becomes covered.
I am using Chrome v72.0.3626.109.
Looks ...
8
votes
2
answers
1k
views
Embedding code sandbox
Is it possible to embed codesandbox preview in Stack Overflow?
I have tried iframe, embed URL and links but none of it works.
11
votes
0
answers
188
views
Code snippet comments in code formatting break the formatting of the post
When special HTML comments used for snippets are present in a post, these comments break the rendering of the post. For example, consider the following markdown code (notice that the whole thing is ...
-3
votes
1
answer
90
views
Code snippets numbering lines with Number Anchors
This topic has been discussed before in Why are there no line numbers in the code listings?. The most powerful reason that prevents the implement of line numbers is changing code lines numbers and ...
7
votes
0
answers
48
views
JavaScript snippet containing multiple dollar signs is corrupted [duplicate]
As part of https://codegolf.meta.stackexchange.com/a/7848/163, I posted a stack snippet that uses jQuery and ran into a problem. Take for example the following snippet:
!-- begin snippet: js hide: ...
3
votes
1
answer
40
views
Closing the Stack Snippet editor doesn't refocus the textarea
To reproduce:
Click Ask Question and focus the question body textarea
Press Ctrl + M
Hit the X and confirm that you do not want to "abandon any changes."
Immediately press Ctrl + M again.
No snippet ...
5
votes
1
answer
101
views
Distinguish languages when displaying stack snippets
I just integrated my first snippet on an existing post, nice work.
I put it on this post: https://stackoverflow.com/a/19932511/731138
Code appears without language distinction, with a small space as ...
1
vote
1
answer
73
views
How do you split a stack snippet into multiple sections? [duplicate]
Usually when I write an answer I explain each section of my code separately and then add a link to a JSFiddle demo at the end. For example take a look at this answer on StackOverflow:
Now with the ...