Questions tagged [code-formatting]
For questions about making code appear correctly in questions, answers and comments.
980 questions
6
votes
0
answers
99
views
Copy button on fenced code blocks copies mixed Windows and Unix line endings
There's a new-to-me Copy button on fenced code blocks on various stack exchange sites now. When pressed, it puts a copy of the code block to the client's clipboard, along with a couple lines of ...
0
votes
1
answer
68
views
How to apply text attributes in code blocks? [duplicate]
In bio.SE, I use code blocks to type out genetic code and related things like sequence of numerical position of codons like in this answer.
So in this answer, I've added the following code block
123 ...
7
votes
1
answer
104
views
Code samples in spoilers still have issues
Suppose I have a section of text in the middle of a spoiler and I want to put some in a code block such that it is surrounded by the spoiler text on both sides:
If I try
>! something
>! <pre&...
10
votes
1
answer
214
views
Code block usability issues in Stacks Editor
Some issues with the new Stacks Editor's code block usage:
Had to make it a GIF to upload here but the video is supposed to stop when I press the discard button and click the off-screen confirm box.
...
14
votes
1
answer
361
views
when typing code, backslashes are automatically inserted
Today I noticed the first time, that when I post an answer and enter code (by prefixing the line using 4 spaces), and my code contains a backslash or an asterisk, these characters are then prefixed by ...
5
votes
0
answers
109
views
Arrow key navigation broken in code blocks in Stacks Editor
Steps to reproduce:
Select the WYSIWYG mode of the new Stacks Editor
create a code block
add some text below the code block
put your cursor into the code block
press the down arrow key
This will ...
11
votes
0
answers
77
views
Can code-blocks get line-numbers? [duplicate]
I was peeking at a question that included two full scripts and an error message that referenced a particular line. I copy-pasted the code into VS Code to see the line numbers, but it would be ...
9
votes
1
answer
146
views
The Stacks Editor messes up code formatting
I’ve started a new question on Stack Overflow and the Wizard form was shown to me. This uses the Stacks Editor.
When I use the code icon to format blocks of code, it adds single back-ticks instead of ...
2
votes
0
answers
51
views
Extremely long inline code in comments overflows right sidebar [duplicate]
It's egregious e.g. when the viewport exceeds the 1180px's boundary, however it acts erraticly at many viewport sizes.
Ubuntu 24.04.1 / Google Chrome 129.0.6668.58. I can't reproduce it on Firefox 130....
5
votes
0
answers
103
views
Stacks Editor says plain text, but code formatting isn't plain text
Stacks Editor says plain text, but code formatting isn't plain text:
Screenshot taken on https://meta.stackexchange.com/
Markdown:
> **To create a reviewers' Custom Max Papers after having run ...
-14
votes
1
answer
214
views
Sharing code and images efficiently
Let me assume I would like to share a particular image that contains certain simplifications. I don't want to directly paste it to make the question short, simple, and straightforward. So, the best ...
8
votes
0
answers
89
views
Formatting tips below the body textbox of a post are wrong
When posting a question or answer, there is a formatting help below the body textbox, which includes tips for how to format code, make text bold or italic, and quote text:
However, the tips for ...
2
votes
0
answers
129
views
Asking how to format code blocks on SOF because I am prohibited from commenting on an existing post
I am getting this warning when proofreading a question:
Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or ...
11
votes
1
answer
220
views
Colors of code-formatted text in comment help is difficult to read
The new color scheme on the collapsible help section when adding a comment is very difficult to read for the highlighted sections. The new darker highlight does not have enough contrast with the black ...
7
votes
1
answer
147
views
Markdown errors in blog post about RAG
Editor note: While there's at least one other applicable tag, I'd like to leave it at four tags to allow for a status-* tag.
In this blog post, there's an unusual use of a code block to quote LLM ...
12
votes
0
answers
90
views
Blockquote reflows fenced code blocks
When using the ” button to blockquote someone else's words (presumably also when using Ctrl+Q, if that wasn't the browser quit key), the quoted material is reflowed, by design. I don't particularly ...
3
votes
0
answers
62
views
Code background can overflow comments [duplicate]
Look at this:
I think that overflow is due to the following CSS rule:
code {
white-space: pre-wrap;
}
Changing it to the following seems to fix the issue:
code {
white-space: break-spaces;
}
...
3
votes
1
answer
90
views
Code highlighting and image placement breaks despite correct syntax
Signal Processing answer, normal vs preview:
It's only toward the bottom of the post, yet it doesn't happen toward bottom of a much longer post. I confirmed it's also reproduced only with the ...
5
votes
0
answers
171
views
Cannot post question - 'Your post appears to contain code that is not properly formatted as code'
I am trying to post a question to Stack Overflow (and also relevant on a few other sites) but am met with the following message:
Your post appears to contain code that is not properly formatted as ...
3
votes
0
answers
48
views
Comments with `code ticked` text with large spaces seems to leak onto other parts of the page [duplicate]
I posted a comment on Stack Overflow with the following text:
@DougMaurer that command returns `Cmdlet Get-PackageProvider 1.4.8.1 PackageManagement`
It ...
5
votes
0
answers
40
views
Added code not always visible as a change in the Reopen Votes review queue
Here is a Reopen Votes review queue item, where the author added some code to the question. However, that is not displayed in the 'Inline' and 'Side-by-side' tabs, which just show some grammar ...
7
votes
1
answer
157
views
Code no longer displays, despite being selectable [closed]
Since today, suddenly code no longer displays for me:
The same happens for in-line code, also that in comments. However, I can select the code:
and copy-paste it to a text editor. Is this a new bug?
...
7
votes
1
answer
158
views
Is the language name case sensitive for syntax highlighting?
I often use the syntax-highlighting feature of Stack Exchange in order to make my code easier to read.
```lang-python
for k in range(0, 10):
print(k)
```
for k in range(0, 10):
print(k)
...
6
votes
2
answers
140
views
Search fails when original text includes backticks for formatting
A Stack Overflow post including the following:
service1 has integration tests that needs to call the API on service2.
...or in its Markdown source:
`service1` has integration tests that needs to ...
6
votes
0
answers
84
views
What are the chances of getting auto-prettier code formatting on code blocks on Stack Overflow? [duplicate]
This answer taught me that highlighting a code block and clicking the curly brackets icons auto-formats the code block.
Many developers, me included, are used to the comfort of format-on-save ...