Questions tagged [code-formatting]

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

Filter by
Sorted by
Tagged with
5
votes
1answer
71 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. ...
5
votes
1answer
98 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 ...
-13
votes
1answer
177 views

I need help and Stack Overflow 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
64 views

Triple backticks code formatting doesn't showup 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
0answers
79 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 ...
6
votes
1answer
130 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
95 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: &...
1
vote
0answers
23 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
75 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
72 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
91 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 ...
13
votes
0answers
114 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
137 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
47 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 "$...
10
votes
0answers
69 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
107 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
79 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 ...
61
votes
2answers
697 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
97 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._....
4
votes
0answers
55 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
77 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.
6
votes
0answers
47 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
63 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 ...
5
votes
0answers
179 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 ...
8
votes
1answer
265 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
182 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/...
304
votes
38answers
46k 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
104 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
77 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 ...
108
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
128 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 ...
4
votes
2answers
101 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
83 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
117 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 ...
7
votes
0answers
61 views

Provide a proper way to indicate error messages that is visually distinct from quotes and actual code

Error messages are a fairly common thing to mention, in both questions and answers, across many Stack Exchange communities. I think it would be valuable to have a markdown syntax to denote error ...
13
votes
0answers
75 views

Code formatting error message dispenses no-longer-true advice, and doesn't indicate what to do in case of false positives

On four sites in the network, there is a code formatting filter that checks for users pasting in code but not formatting it correctly. When it is triggered, it says the following: Your post appears ...
4
votes
1answer
95 views

How to avoid the 'not properly formatted as code' alert

I've been trying for many hours to post a question in Mathematica Stack Exchange and I always get the following warning I've done the indentation but did not work (though in the preview looks ...
4
votes
0answers
52 views

Appearance of numbers for an ordered list element starting with a code block

These: 1. ``` foo bar baz bad ``` 2. foo bar baz bad Render as: foo bar baz bad foo bar baz bad Screenshot: I am pretty sure the list numbers were aligned ...
8
votes
0answers
65 views

Why does this post show ``` at the end of a code block?

Here is a post on Game Development Stack Exchange which uses the newish fenced code blocks, i.e. the ones starting and finishing with a triple backquote: ``` [insert code here] ``` As you can see, ...
-7
votes
1answer
64 views

Answer comment cells need text formatting

I noticed certain keywords for text formatting are ignored in the app, e.g. code tags See attached image for reference. App Version: 1.6.6.2 Device: iPhone 7 Plus OS Version: Version 13.3.1 (Build ...
1
vote
1answer
97 views

How to write a ` symbol inside a code block [duplicate]

How can I write this symbol: ` inside a code block in just one line? As the code blocks are defined by: ```, I am not able to write one of these inside the code block.
1
vote
1answer
102 views

Fenced code markdowns in posts before 2019 doesn't render correctly

This answer on Ask Ubuntu was posted in October 2016. The last revision was made then only and there answerer used fenced code markdown (```) which at that moment wasn't introduced on Stack Exchange. ...
1
vote
0answers
117 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 ...
5
votes
1answer
125 views

Cannot post my question because of code formatting [closed]

I tried to post a question on the Mathematica forum, I spend a hour writting it correctly and I have the following error when I want to submit it : "Your post appears to contain code that is not ...
2
votes
1answer
52 views

How to switch off syntax highlight in cited code? [duplicate]

Suppose some code snippet that appears to be some specific syntax like C in this case, and I want to format it like plain text: ``` #include <code> ``` On stackexchange, this will be rendered ...

1
2 3 4 5
14