Questions tagged [code-formatting]

For questions about making code appear correctly in questions, answers and comments.

Filter by
Sorted by
Tagged with
8 votes
0 answers
67 views

Markdown reformatting is broken if a list item starts with a block element

The new/stacks editor, when switching from source mode to Markdown mode, breaks alignment of list items <li> if it begins with a block-level element (<blockquote> or <pre>). For ...
user avatar
0 votes
0 answers
99 views

Why is my Python code not highlighted? [duplicate]

I have posted the following code in my question: import numpy as np for i in range(3): n = np.random.randint(2, 10000) m = np.random.randint(1, n) A = np.random.randn(m, n) * ((1 / m) ** ...
user avatar
  • 19
0 votes
0 answers
81 views

Getting a code formatting error when I try to post this question on Stack Overflow

When I try to post this question to Stack Overflow I get the following error: Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the ...
user avatar
6 votes
0 answers
91 views

Code blocks not using fixed-width font family in Firefox

Code blocks are not rendered using a fixed-width font in Firefox 99 64-bit Ubuntu. A screenshot of the issue for this post (left is using Chrome, and right is using Firefox): The issue is caused by ...
user avatar
  • 321
6 votes
0 answers
179 views

HTML formatting inside code blocks doesn't work if syntax highlighting is being performed for the block

I have plenty of old answers where I used <pre><code> to format code, with HTML tags such as <b> or <strike> inside such blocks. That has been broken for some time now, on SO ...
user avatar
2 votes
0 answers
23 views

Display bug on code block in comments [duplicate]

I noticed this display bug on a comment, where the spaces inside code block is extended well past the comment width, and well beyond the content width as well, bleeding into the margins.
user avatar
  • 128
2 votes
1 answer
83 views

Getting code formatting error on Stack Overflow

I don't know what is wrong with my indentation but it's not taking this input from me. I get the error: Your post appears to contain code that is not properly formatted as code. Please indent all ...
user avatar
  • 31
3 votes
0 answers
80 views

The code used in code blocks for Stack Overflow has changed after I installed some new fonts on my system. How can I change it back?

I was installing and testing new fonts in my macOS for use in Visual Studio Code. After I was finished with that, I noticed the font has changed in Stack Overflow code blocks to one I do not prefer. ...
user avatar
6 votes
1 answer
59 views

Code Markdown bug

I've only seen this happen on music.se, the latest one on Metronome Sound today. The last code block on a page renders as a blank box. It looks like a few people have had different attempts to get the ...
user avatar
  • 2,932
4 votes
1 answer
86 views

Code formatting error for no reason

I have Mathematica code that I am trying to post, but to no avail. No matter what I try, I am still getting the code formatting error. The code is this: {18 wbcd^3 - 192 w^2 bde^2 + 18 b^3 cde + 144 ...
user avatar
  • 149
3 votes
1 answer
223 views

"Your post appears to contain code that is not properly formatted as code." I have no idea why

I can’t seem to understand what is wrong with the following Markdown content. I keep getting the Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 ...
user avatar
15 votes
1 answer
123 views

Question Summary Text Outside Border

If text is formatted as code in a question and that text is used for the summary on the Questions page it will go past the border of the summary. Question Link I'm on Windows 7 64-bit, Chrome Version ...
user avatar
  • 251
10 votes
0 answers
180 views

How can I change the fonts of the code snippets in Stack Overflow back to Consolas?

I've installed the Windows Terminal from Microsoft Store and, together with it, the Cascadia Code font family (mono and code) in my system, but I don't use them. Since then, the snippets on Stack ...
user avatar
  • 201
5 votes
2 answers
96 views

How do I handle suggested edits changing code block style?

I'm new to reviewing suggested edits, but one pattern I noticed is that many edits only change the style of code block formatting (mostly from indented to ```-based, example), in a way that does not ...
user avatar
  • 153
3 votes
0 answers
31 views

Inline code formatting tries to escape the page! [duplicate]

I was going through the First Questions review queue, and was given this review. I don't think the inline code block should render like that. Even though the OP should have used a code block, I don't ...
user avatar
  • 244
6 votes
1 answer
191 views

Yet another error of "Your post appears to contain code that is not properly formatted as code"

I feel like I've found and read through all the relevant posts on Meta about this error, but I still can't resolve this error! I have about 6 equations in double-dollar-signs, several in single-dollar-...
user avatar
  • 61
4 votes
0 answers
34 views

Code formatting fails for closing brace on some sites [duplicate]

The following block of code ``` } ``` renders correctly when asking a question on most sites, e.g. Stack Overflow and here on Meta: } However, on some sites, like Game Development and Code Review, ...
user avatar
  • 212k
6 votes
1 answer
130 views

How should I represent/display pseudo code in Stack Exchange?

This semester I'm attending a course on Algorithms and Data Structures. I will probably have a few questions to post to Computer Science or Mathematics. The slides of my teacher use math symbols such ...
user avatar
  • 235
7 votes
1 answer
160 views

When someone adds a "language identifier" to a code block does the specified syntax highlighting show in the "suggested edits" "queue"?

When I edit someone's code block with a language identifier: Example: from: ``` def py ``` to: ```python def py ``` Is that change reflected in the Suggested edits queue in the Inline or side-by-...
user avatar
0 votes
0 answers
48 views

Please allow to edit questions that are mostly code [duplicate]

There are some low-quality questions that consist mostly of wrongly formatted code. When trying to format it correctly (i.e., code actually becomes code), you get a notification that "your" ...
user avatar
  • 117
5 votes
0 answers
72 views

Add full screen button to code blocks

I suggest adding a "Full screen button" underneath code blocks. For example in this post: I get java.lang.VerifyError using FontAwesome in JavaFX The first code block, "Error", is ...
user avatar
  • 59
7 votes
1 answer
117 views

Markdown characters in code both shown and rendered as markdown

With certain syntax colourings active (for example "apl" but not "c"), and for certain specific characters, symbols that have meaning in markdown are visible while also causing ...
user avatar
  • 8,724
12 votes
0 answers
208 views

I am being incorrectly told that "Your post appears to contain code that is not properly formatted as code." Please can I have more specific feedback?

I've been trying for about 30 minutes to work out what on earth in my message the system is mistaking for code, and every time I press submit and it tells me vaguely "oh I think there's code in ...
user avatar
5 votes
1 answer
82 views

Erroneous "Your post appears to contain code that is not properly formatted as code" error

I spent more than an hour trying to fix the formatting of the question below such that the Mathematica and Wolfram Language forum would accept it. I had no success, even though I am aware of threads ...
user avatar
  • 201
6 votes
1 answer
66 views

Quote button shouldn't reformat code in triple-backticks

I've seen Blockquote rewrap destroys code, but that question (and answer) are about the situation where a user mistakenly uses the quote button instead of the code button. I instead want to use both. ...
user avatar
  • 598
4 votes
1 answer
119 views

Some lines of code block are bold when the question has at least two language tags

We've found this problem in this question on Stack Overflow in Portuguese, but I've also tested in other sites (English and Spanish SO's), and it happened there as well. In the aforementioned ...
user avatar
  • 1,476
-15 votes
1 answer
216 views

I need help and the site is not letting me post my code. Says “Your post appears to contain code that is not properly formatted as code.”

I am trying to learn React and there's a concept that I'm feeling pretty stuck on. I was hoping someone could help me and I've been trying to put effort into making a question post detailing my ...
user avatar
2 votes
1 answer
141 views

Triple backticks code formatting doesn't show up in the suggested-edits queue on side-by-side mode

I just noticed that answers (I don't know about the questions), that used triple backticks codes in the body, don't show up in the suggested-edits review queue on side-by-side mode. Instead it shows ...
user avatar
1 vote
3 answers
130 views

Bug in Stack Overflow Markdown rendering when code follows a list [duplicate]

Code following a list, though not to be included in the list itself, is not correctly rendered, as shown below. I have tried inserting linebreaks, to no avail. Inserting "dummy" text will ...
user avatar
2 votes
0 answers
83 views

Prefer code fences or indenting? [duplicate]

Personally, code fences are cleaner (less whitespace) and are parsed more quickly due to the ability to hint at the language via cpp,lang-none,js, etc. Other than requiring indenting to use code in ...
user avatar
  • 159
2 votes
1 answer
73 views

Why does copying a code block line contain a trailing newline?

Using macOS and Chrome, triple clicking a line to select and copy in a code block results in a trailing newline. When pasting a command into a shell, this results in the cursor being placed on a line ...
user avatar
  • 131
23 votes
0 answers
198 views

Code marked as deleted does not look good in side by side markdown view in dark mode

Can't see deleted code I have come across a situation in dark mode. This is a serious contrast problem according to the following preview: It is too expensive to distinguish the text from the ...
user avatar
6 votes
1 answer
142 views

Revisions list Code Block stretches screen

bug See the revision histories here: https://stackoverflow.com/posts/46344443/revisions https://wordpress.stackexchange.com/posts/383658/revisions The long code blocks page-stretch, as opposed to ...
user avatar
  • 4,360
5 votes
1 answer
98 views

Incorrect preview of fenced code block within an ordered list

The preview for a fenced code block within an ordered list: This is the actual result after posting: The fenced code block turned into inline code! The preview is wrong. 1. scheme (doc id: 1 title: &...
user avatar
  • 689
0 votes
0 answers
27 views

How to disable syntax highlighting in Markdown fenced code blocks [duplicate]

For indented code blocks, adding <!-- language: lang-none --> disables syntax highlighting. What about for fenced code blocks? Can I use lang-none or none in fenced code blocks too? Which of the ...
user avatar
  • 689
10 votes
0 answers
78 views

Please have same background color for indented code and inline code

In this answer I included both indented code, and an inline codeblock. (Yes you may blame me for abusing code make-up for something that isn't technically code) They both have a different shade of ...
user avatar
  • 31.6k
-13 votes
1 answer
76 views

Option to format and view C and C++ code with ClangFormat [closed]

I want an option to render blocks of code found in questions and answers, with ClangFormat, so I can read the C++ and C code in the style I deem appropriate.
user avatar
6 votes
1 answer
105 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 ...
user avatar
18 votes
0 answers
183 views

On some sites, the closing fence is visible if post ends immediately after a code block that has an empty line

An example of the bug is shown in the screenshot below, which occurred while editing this answer: The issue goes away if a trailing line break is added. A minimal reproduction of the bug: Ask on ...
user avatar
  • 8,724
1 vote
1 answer
140 views

How can I automatically edit all my answers and questions so that no quotes are broken down?

The CommonMark migration messed up the formatting of many of my posts. Specifically, one common issue is that my quotes are now broken down, e.g.: instead of Screenshots taken from https://stats....
user avatar
4 votes
0 answers
87 views

Markdown renderer changes indentation inside fenced code blocks

On some (but not all!) sites, code fenced blocks (but not indented code blocks!) are indented incorrectly. The following Markdown input: ``` for arg; do if [[ $arg ]]; then echo "$...
user avatar
16 votes
0 answers
137 views

Rendering bug with backslash and dollar sign on MathJax-enabled sites

Typing `\$` on a MathJax-enabled site renders \\\$ instead of the expected \$ On the preview, the rendering is also wrong, but it only renders \\$, as can be seen in the following screenshot: This ...
user avatar
  • 4,518
3 votes
0 answers
125 views

Erroneous "Your post appears to contain code that is not properly formatted as code"?

I just read Stack Overflow won't let me post code, I don't have proper "formatting"? because I get the same error message. However, all code etc is marked as code in my post, see the ...
user avatar
  • 181
2 votes
1 answer
222 views

Is it possible to copy formatted text from Stack Overflow posts/answers, i.e. colors, fonts, etc.?

I'm attempting to copy and then paste code examples from existing Stack Overflow posts into personal documentation which I often end up using Word to paste into. I find that I often am having to copy ...
user avatar
73 votes
2 answers
959 views

Stop guessing/auto-detecting a language when you KNOW it will be incorrect

The problem: SE asks Highlight.js to auto-detect the language when it knows there is no optimal/correct choice for us to make - resulting in very poor outcomes. Disclaimer: I say this as the current ...
user avatar
  • 1,409
3 votes
1 answer
100 views

How to fix, or document for users: Escaped backtick rendering, in question/answer or comment [duplicate]

Noting this duplication of topic, I hope this question can also address, what else might be easily done? This is a bug, or should be added to editing notes. Congratulations you discovered meta._....
user avatar
  • 149
5 votes
0 answers
64 views

Add syntax highlighting support for Dockerfiles

Highlight.js supports syntax highlighting Dockerfiles, but support is not present on Stack Exchange’s version of highlight.js. Please consider adding support for this. Example question on Stack ...
user avatar
  • 221
4 votes
0 answers
99 views

Add syntax highlighting support for Nim

Highlight.js supports syntax highlighting for Nim here. Questions on Stack Overflow for [nim-lang] currently have no highlighting support, and this would be a valued feature for users.
user avatar
9 votes
0 answers
83 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 ?...
user avatar

1
2 3 4 5
17