Questions tagged [code-formatting]

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

Filter by
Sorted by
Tagged with
12 votes
0 answers
91 views

Code block within spoiler gives different result than shown

Background: I'm using the opt-in beta for the new editor. When using the following markdown in the answer editor: >! ```python >! if True: >! print "Hello World" >! ``` It ...
  • 1,154
7 votes
1 answer
117 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? ...
  • 409
15 votes
0 answers
157 views

Don't treat code blocks as spaces when searching

I wanted to find all the posts containing the phrase call or call. In my case, I'll demonstrate on Stack Overflow, but this happens on Stack Exchange search too, so this isn't just an Stack Overflow ...
  • 1,074
6 votes
1 answer
110 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) ...
1 vote
0 answers
183 views

Do I have to worry about patent issues for code posted on Stack Overflow?

I purposely named this question similar to Do I have to worry about copyright issues for code posted on Stack Overflow?. Since Fedora is banning CC-0 licensed source code citing issue of explicitly ...
  • 49
6 votes
2 answers
99 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 ...
  • 28k
3 votes
0 answers
95 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 ...
  • 35
6 votes
0 answers
81 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 ...
  • 185
8 votes
2 answers
172 views

How can I find posts with particularly large code blocks in a non-code-based site?

From time to time in Space SE a question or answer about a calculation will need to share a significant amount of tabular data, say 100 or 1000 lines. It needs to be forever available to future ...
  • 5,991
8 votes
0 answers
73 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 ...
0 votes
0 answers
106 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) ** ...
  • 119
0 votes
0 answers
93 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 ...
6 votes
0 answers
106 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 ...
  • 321
6 votes
0 answers
218 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 ...
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.
  • 128
2 votes
1 answer
174 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 ...
  • 31
3 votes
0 answers
114 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. ...
6 votes
1 answer
64 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 ...
  • 2,982
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 ...
  • 149
3 votes
1 answer
327 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 ...
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 ...
  • 251
11 votes
0 answers
259 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 ...
  • 211
5 votes
2 answers
104 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 ...
  • 153
3 votes
0 answers
32 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 ...
  • 1,074
6 votes
1 answer
199 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-...
  • 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, ...
  • 225k
6 votes
1 answer
137 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 ...
  • 235
7 votes
1 answer
166 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-...
5 votes
0 answers
74 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 ...
  • 59
7 votes
1 answer
141 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 ...
  • 8,712
12 votes
0 answers
209 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 ...
5 votes
1 answer
83 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 ...
  • 201
6 votes
1 answer
68 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. ...
  • 598
4 votes
1 answer
125 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 ...
  • 1,486
-15 votes
1 answer
218 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 ...
2 votes
1 answer
157 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 ...
2 votes
0 answers
84 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 ...
  • 159
2 votes
1 answer
86 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 ...
  • 131
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 ...
  • 4,408
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: &...
  • 719
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 ...
  • 719
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 ...
  • 33.9k
-13 votes
1 answer
79 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.
6 votes
1 answer
118 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 ...
19 votes
0 answers
190 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 ...
  • 8,712
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....
4 votes
0 answers
102 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 "$...
16 votes
0 answers
141 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 ...
  • 4,608
3 votes
0 answers
134 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 ...
  • 181
2 votes
1 answer
332 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 ...

1
2 3 4 5
15