Questions tagged [code-formatting]

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

Filter by
Sorted by
Tagged with
6
votes
1answer
122 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 ...
7
votes
1answer
141 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-...
0
votes
0answers
46 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" ...
5
votes
0answers
70 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 ...
7
votes
1answer
99 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 ...
12
votes
0answers
204 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
1answer
80 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 ...
6
votes
1answer
65 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. ...
4
votes
1answer
111 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 ...
-15
votes
1answer
205 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
1answer
115 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 ...
1
vote
3answers
108 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 ...
2
votes
0answers
82 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 ...
2
votes
1answer
70 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 ...
23
votes
0answers
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 ...
6
votes
1answer
141 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 ...
5
votes
1answer
96 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: &...
0
votes
0answers
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 ...
9
votes
0answers
76 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 ...
-13
votes
1answer
74 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
1answer
97 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 ...
14
votes
0answers
122 views

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

Example here: The issue goes away if a trailing line break is added. A minimal reproduction of the bug: Ask on Code Golf Enter "```\ncode\n\nmore\n```" so the input field looks like:``` ...
1
vote
1answer
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
0answers
67 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 "$...
15
votes
0answers
122 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 ...
3
votes
0answers
117 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 ...
2
votes
1answer
135 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 ...
70
votes
2answers
839 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 ...
3
votes
1answer
99 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._....
5
votes
0answers
60 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 ...
4
votes
0answers
85 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.
8
votes
0answers
60 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 ?...
6
votes
0answers
107 views

Add syntax highlighting support for nginxconf

Highlight.js supports syntax highlighting for nginx configuration files, but support is not present on Stack Exchange’s version of highlight.js. Please consider adding support for this. Example ...
6
votes
0answers
244 views

Syntax highlighting language request: Python REPL

Highlight.js treats Python REPL (the Python interpreter in interactive mode) as its own language separate from Python—it uses the class names python-repl and pycon. I checked Stack Exchange's ...
2
votes
0answers
63 views

Where should I upload code which is too long to get posted? [duplicate]

I put a bounty on another question and someone answered, but the answer contains a .zip file, because Stack Exchange has a limit on the maximum post length and the code exceeds that. Problem: The .zip ...
9
votes
1answer
319 views

What happened to Groovy syntax highlighting?

On Stack Overflow I have answered many questions about Spock and Geb, two Groovy test frameworks. For years, I have used <!-- language: lang-groovy --> in combination with indentation by four ...
6
votes
3answers
187 views

Did the automated CommonMark migration mess up the formatting of this answer?

I suspect the automated CommonMark migration messed up the formatting of this answer. Before the migration to CommonMark: https://web.archive.org/web/20200515072655/https://unix.stackexchange.com/...
307
votes
38answers
48k views

Goodbye, Prettify. Hello highlight.js! Swapping out our Syntax Highlighter

Update 2020-09-24 This is now live network-wide. Update This is now live on Meta Stack Exchange and Meta Stack Overflow. Any bugs and feedback can be posted here as an answer. I’m Ben and I’m a dev ...
25
votes
0answers
183 views

Please remove the horizontal whitespace in the left part of code blocks

With the new post formatting there's extra horizontal whitespace at the left of code blocks (not to be confused with the increased line height). Before the new formatting: Now (red circle shows the ...
8
votes
0answers
108 views

Unable to differentiate between code and hyperlinks with code formatting on mobile site

This is a follow up of my earlier question Hyperlinks in code formatting no longer follows site color. The links in code formatting on mobile site aren't underlined which worsens the above situation ...
8
votes
0answers
78 views

Hyperlinks in code formatting no longer follows site color

Earlier code used to follow site colors, for example, Orange on Ask Ubuntu[Click on image to open corresponding cached page/post] : and blue on Unix & Linux But now they no longer follow site ...
111
votes
2answers
2k views

Request for a possibility to adjust the spacing between lines

Update: The line-height in code blocks is almost back to what it was before (it was 1.3 but is now 1.30769231) and the spacing between lines in regular text is now at 1.5 (it was 1.3 before the change)...
15
votes
1answer
134 views

Can we warn users if the first line of a code block is silently discarded if placed on the same line as ```?

Here's an example. If a user types following into the question box: ```#include <iostream> int main() { std::cout << "Hello, world!\n"; } ``` It will look like this: int ...
5
votes
2answers
108 views

Should Ctrl+K in the editor use the code fences instead of indentation?

Now that the Stack Exchange network has switched to CommonMark, some features appear to be deprecated. In particular, comment-style language hints may eventually stop working. So instead of using 4-...
-10
votes
1answer
71 views

How to "prettify" my coments [duplicate]

How can I format my comments? For example, I've pasted a few lines of code (with new lines, spaces etc.) but it looks very ugly.
2
votes
0answers
59 views

Markdown inconsistency between preview and post when using blank lines [duplicate]

This happened in an answer on Code Golf.SE, where we have all sorts of uncommon programming languages to put in a code block. OP's code is copied here at the markdown level: bbcccbc-cc-b--b-- c b &#...
6
votes
1answer
87 views

Does <Shift> + <Enter> create lists automatically if the line starts with a dash or a bullet?

I just noticed that if you have some text and you add a dash in front of the first character, then when you hit Shift + Enter before any character in the text, then it gets rendered as a list. This ...
-10
votes
1answer
119 views

Extra newline risks running unwanted commands [closed]

Triple-clicking on a code block like the ones here highlight the line with an additional newline at the end. When the user copies and pastes it into the terminal the extra newline results in the ...

1
2 3 4 5
17