Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [code-formatting]

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

1
vote
0answers
26 views

Cannot suggest basic formatting edits based on whitespace: “Edits must be at least 6 characters” [duplicate]

I often find myself wanting to improve new member's OPs readability by only doing basic formatting: adding whitespace to break down one chunk of text into several lines/sections adding - to format ...
4
votes
1answer
79 views

I suggested an edit for updating formatting which was accepted but the author just rolled back the change to the previous unformatted state

I suggested this edit for updating formatting which was accepted by the community but the author just rolled back the change to the previous unformatted state. It seems there is no direct recourse of ...
8
votes
0answers
55 views

Do not use `code formatting` for the number of days on the Roomba help center page

On the Help Center page about Roomba (the script that automatically deletes 'abandoned' bad questions), code formatting is used a couple of times. While it's OK (at least in my book) to use this for ...
6
votes
1answer
36 views

Editing code-heavy answers doesn't always work

Let's say I'm editing some poor sod's code that is unformatted, and is almost the entire question. I format the code, I add in the error message that was copy-pasted into the title, I fix the grammar, ...
0
votes
0answers
49 views

What sites have the code formatting filter enabled?

I know that the code formatting filter ("your post appears to contain code that is not properly formatted as code") is enabled on Stack Overflow. However, are there any other sites where this filter ...
4
votes
0answers
53 views

Backticks don't render correctly on sites with MathJax enabled

Typing \` `text` produces ` `text` rather than the expected ` text on sites with MathJax enabled. The bug is visible in the preview and the final output.
0
votes
0answers
61 views

Bug: Add code in an ordered list [duplicate]

Prologue It seems this is a duplicate of an almost 6 year request. Fair enough, though I think this question adds new value (e.g. the <pre><code></code></pre>+< comparison ...
2
votes
2answers
68 views

Embedding code sandbox

Is it possible to embed codesandbox preview in Stack Overflow? I have tried iframe, embed URL and links but none of it works.
1
vote
0answers
62 views

Set space after inline code environment which ends with a space in comments [duplicate]

When writing comments, it is possible to write a space after the last character of the code so that it looks like A:<space>. When writing it within a question, however, it does not work. But ...
2
votes
1answer
45 views

Any way to auto-format SQL in Stack Exchange Data Explorer?

One really nice feature of Toad (database administration tool) is the ability to auto-format your SQL (usually with CTRL + SHIFT + F). Manually formatting SQL greatly increases readability, but takes ...
1
vote
0answers
164 views

Syntax highlighting for shell sessions? [duplicate]

Edit: I've opened an issue for this in the code-prettify project on GitHub. The author of the question Why does bash login shell break here-doc command string argument? noted in the comments that: ...
3
votes
2answers
64 views

How do I write code with comments in it?

I wanted to edit this answer, because there is a code comment (that starts with /** and ends with */) in the code, and that's why code wasn't shown properly. But selecting the whole code and marking ...
2
votes
0answers
10 views

Whitespace in preformatted blocks not shown on mobile [duplicate]

I posted this answer today, containing some preformatted text to function as headers for two side by side images. WITHOUT RULE WITH RULE I know this is not the intended use ...
-1
votes
1answer
355 views

Alternatives for placeholders in Markdown?

Which one is the best way of writing a "placeholder" (I don't know if it has another name) in Markdown. I mean a string inside a code listing that the reader should consider as a generic variable, ...
10
votes
1answer
68 views

How to code highlight words in plural

The backtick is used on many sites of Stack Exchange to format inline text as code. How do I pluralise words when they refer to code? Let's say I have some item in my code called "ToolBarButton". ...
2
votes
1answer
46 views

How do I properly indent long lines of code?

I saw code like this in another question: mockStatic(DockerRestClient.class); ObjectMapper obj=EasyMock.createMock(ObjectMapper.class); expect(DockerRestClient.doGet(EasyMock.isA(String.class)))....
0
votes
0answers
26 views

Syntax highlighting hints not working for in-line code [duplicate]

It appears that manual syntax highlighting hints aren't working properly for in-line code samples. If I specify the language for my question using <!-- language-all: lang-java -->, the language ...
4
votes
2answers
47 views

How can I allow linebreaks after backslash `\` characters?

I have an answer which involves a very long filepath. Search for regedit, and then press Enter. Open HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace ...
-4
votes
1answer
58 views

Add a way to highlight/emphasize changes in code [duplicate]

Answers to coding questions often use a minor change to the example code. But because it's code, you cant emphasize those differences with markdown syntax. See example below where I've done some ...
2
votes
1answer
181 views

How can I escape an HTML tag without using code blocks?

In a question on Meta Code Golf, I want to quote a comment by SteveFest which displays an HTML tag as a literal set of characters. I can't find a way to include <s>not</s> without ...
-17
votes
1answer
80 views

How to delete the white space in the end of the line?

The is the code : POST http://api.ltp-cloud.com/analysis/ HTTP/1.1 cache-control: no-cache Postman-Token: d6172632-c912-43f0-9af7-8a8decd0c0e2 Content-Type: application/x-www-form-urlencoded User-...
1
vote
1answer
60 views

Editing comments with inline code removes code markers and triples the text

Sorry for the long title, but I think it aptly describes the problem. For an example, on this answer on the PPCG meta, I commented the text: I made a bunch of edits, feel free to roll back any ...
5
votes
1answer
178 views

Question gets error: Please indent all code by 4 spaces

My code is not in a list. I added an enter line before my code and indented by 4 spaces using ctrl + K, so why am I still getting this error: "Please indent all code by 4 spaces"? My code registers ...
3
votes
0answers
73 views

Underline formatting option should be implemented in all the SE sites [duplicate]

Bold and italics simply aren't enough. This is especially true in the case of websites on the sciences and languages, where a lot of explanation needs to be provided. The formatting package should ...
3
votes
0answers
52 views

Any way to 'format as code' before paste?

When I paste code into the Stack Overflow editor, my process typically takes the following steps: Highlight code. Copy. Paste at desired location. Highlight pasted code. Mark as formatted. Step 4 ...
1
vote
0answers
12 views

Accessibility issue caused by indentation code check [duplicate]

I'm blind and I wrote some years ago about this issue but nothing was done, now I retry to submit this issue also because there is the reviewer role. To understand my problem I can tell you that I ...
3
votes
1answer
11k views

Can't add code to comment

I am trying to add code to my comment using inline code in backticks, but it doesn't work for the below path: \Users\user_name\AppData\Local\Packages\Microsoft.MicrosoftE‌​dge_xxxx\AC\#!001\Mi‌​...
1
vote
0answers
48 views

JavaScript syntax highlighter does not highlight template literals correctly

The lang-js highlighter does not appear to recognize backticked strings properly: let s = `a a a 'a a a' "a a a" a a ${true}`; // not quite let t = `a a a 'a a a ${true}'`; // a little ...
3
votes
0answers
20 views

Cannot manually insert four spaces in front of long lines (like URLs)

I ran into a strange issue when posting this answer. I cannot manually insert four spaces (to format as code) in front of the following line in the editor: http://data.stackexchange.com/beer,%20wine%...
8
votes
0answers
63 views

Code snippet comments in code formatting break the formatting of the post

When special HTML comments used for snippets are present in a post, these comments break the rendering of the post. For example, consider the following markdown code (notice that the whole thing is ...
-3
votes
1answer
55 views

Code snippets numbering lines with Number Anchors

This topic has been discussed before in Why are there no line numbers in the code listings?. The most powerful reason that prevents the implement of line numbers is changing code lines numbers and ...
2
votes
0answers
54 views

Missing blank line under code snippet with scroll bar

I've only just noticed this. I am not sure if it used to happen before, and I have only just noticed it, or it is something that is new. Check the answer to the question, Does anyone know how Slic3r ...
-11
votes
1answer
72 views

What is wrong with the code formatting in this answer? [closed]

It took me a while, but in the end I found a solution. I created a script with the following content that I place within the graphviz directory. GVTARGET is a directory within my development ...
2
votes
0answers
36 views

Make suggested edits which indent code easier to verify

It's fairly frequent to review suggested edits where someone helpfully puts code into code blocks. For instance: These edits are great and are appreciated; they generally improve the atmosphere of ...
6
votes
0answers
35 views

Quotation of code on meta sites differs from the main ones

When I add code in quote on main sites it looks fine: But if I do same on meta, result is significantly differs: As you can see, only the text is highlighted, not the whole line. Pictures ...
2
votes
1answer
99 views

Can't post answer because of malformed code, but code seems well formed

I am trying to post answer to a question, but I fail validation for malformed code. What I've tried so far: Paste markdown into text editor Turn on visible white space and count the spaces, ...
3
votes
2answers
126 views

False positive? I get this error but cannot find any reason: “Your post appears to contain code that is not properly formatted as code.”

EDIT: This seems to be a bug. See my answer below for explanations. I was trying to post a question to StackOverflow but I keep getting this error message: Your post appears to contain code that ...
0
votes
1answer
69 views

Shortcut for code formatting in comments on mobile

It's commonly known that you can use code formatting by surrounding your code with backticks: `enter code here`. Unfortunately, the ` character is fairly well hidden on the default iOS keyboard, ...
-2
votes
1answer
76 views

How to paste code into question [duplicate]

I have a coding question and I want to paste the code that I have written into my question. I have seen several examples of such formatting, but I can't find how do I manage to do the same and there ...
2
votes
1answer
228 views

Adding back ticks to keyboard

I spend a lot of time on SE whilst on my phone out and about. Sometimes I want to use some inline code and I have to go through a rigmarole of clicking 123, then holding the ' and selecting the back ...
7
votes
2answers
133 views

Could we get different font colors for SEDE comments and strings?

In SEDE, using Chrome on Windows, comments and strings are both formatted in the same shade of green: (Snip is from this query) Now, I'm sure many out there will have bones to pick with my query ...
1
vote
0answers
33 views

I tried to post a code-free edit, but the site threw a spurious error claiming that my post contains improperly-formatted code

Bug I posted a question. Then conio posted an answer. I tried to dejargonify and copyedit his/her answer, but got the error message: "Your post appears to contain code that is not properly formatted ...
2
votes
1answer
52 views

Code-formatting error

I've looked at many answers on this topic but none of these solutions seem to work in my case. The error I get: Your post appears to contain code that is not properly formatted as code. Made ...
2
votes
0answers
41 views

False Positive: Your post appears to contain code that is not properly formatted as code [duplicate]

I don't know why I'm getting the dreaded "Your post appears to contain code that is not properly formatted as code" error on this post. Here is the text of my post as I originally wanted to post it: ...
1
vote
2answers
27 views

How to keep tabbing data when editing/replying to a post

If you edit this question, you will see that the table (below) is formatted, but the result does not look the same. So how do keep tabbing data? Table example Column1 Column2 Column3 ...
3
votes
0answers
86 views

Add syntax highlighting for the Makefile language

I want to post a question with a significant chunk of Makefile code, but the preview given from my code isn't very exciting, and it highlights seemingly random words here and there. The seemingly-...
2
votes
2answers
82 views

Problem getting code to format completely (Ctrl + K, ```, manual space)

solved per accepted answer. I would also encourage readers to read @Nathan Tuggy's answer, which has some related details that may help you understand the issue more quickly Question I have some ...
2
votes
1answer
43 views

Having a hard time formatting code/file [duplicate]

I was improving the edit and contents of a post, but there was one part that wouldn't stop fighting back. Let me try to reproduce it here: Start of text Then you can open the file and write all the ...
2
votes
1answer
56 views

Ctrl+K doesn't work for &nbsp; indented lines

Below code is indented with 2 &nbsp;.   <- no-break space   <- no-break space I wrote this code block manually, i.e. prepend 4 spaces to each line. Why don't I use Ctrl+K? Because it didn'...
-5
votes
3answers
98 views

Please add a full-frame text editor to StackOverflow [duplicate]

edit #2: here's what the editor looks like in SBS mode when using SOX Done and done. Thanks @ᔕᖺᘎᕊ edit: My point here is that when editing code there is a lot of unused screen real-estate. I don't ...