Stack Exchange Network

Stack Exchange network consists of 175 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.

4
votes
0answers
40 views

Double back slashes escape code formatting in comments (but not answers) [duplicate]

I recently posted on answer on Stack Overflow which mentioned the discrepancy between windows and linux path separators in the answer. I enclosed both in inline code snippets like so: \\ and /. These ...
8
votes
1answer
106 views

What happened to code fences and Stack Snippets?

I just noticed that something weird happened today with code fences and Stack Snippets. Examples: <h1>Hello World!<h1> Hello World! Seems like the boxes are bigger. What is ...
0
votes
0answers
42 views

Why is Syntax Highlighting enabled only for some SE sites? [duplicate]

Syntax highlighting is available on some SE sites. It certainly works on Stackoverflow, and it also appears to work in this example: var a = 3; while( !(a < 0)){ alert("JavaScript code <b&...
3
votes
2answers
50 views

How to post code from mobile?

Can somebody show me how to post code from a mobile device, as I cannot use control-K or any other combination. I have tried putting 4 spaces before each line and making 4 new lines in before and ...
4
votes
0answers
34 views

Increase min-height on SE code snippets to prevent scrollbar from blocking code [duplicate]

When using Stack Exchange/Stack Overflow, anytime there's a one-line code snippet with a horizontal scrollbar, the majority of the code becomes covered. I am using Chrome v72.0.3626.109. Looks ...
4
votes
2answers
82 views

Bold or italics in Markdown inline code [duplicate]

I would like to add bold (or italic) text to inline code (not a block of code). So in one **two** three, I would like "two" to be bold rather than surrounded by asterisks. Note: This is a similar ...
0
votes
2answers
196 views

Add some bottom padding to code snippets

Currently it's impossible to see the bottom line of code snippets because the horizontal scroll bar is positioned over the top of them (post in question): Please could you add some bottom padding so ...
2
votes
0answers
62 views

Single line code is hidden by the horizontal scrollBar [duplicate]

The horizontal ScrollBar on a one line code on any post is hiding the code for me. I'm using Google Chrome 71.0.3578.98 on macOS v10.14 (Mojave), but I think this bug is a general issue. And here are ...
19
votes
3answers
487 views

Cannot dismiss scrollbar in code box, blocks view

This question is a duplicate of One-line codeblock scrollbars won't disappear (but this question can't be marked as a duplicate because that question is on meta.stackoverflow.com, and this ...
5
votes
0answers
35 views

Android app stops rendering code at a certain point

If the code is too long it stops rendering the post. But I can scroll down to other answers App Version: 1.0.95 Device Manufacturer: HUAWEI Device Model: EVA-L09 OS Version: 7.0 (C432B504)
0
votes
0answers
36 views

How do I write a comment which contains commands that contain the character ` (backtick)? [duplicate]

I would like to use in a comment the following command: How can I do that so that character " ` " before and after the word "Private" is visible?
3
votes
1answer
40 views

How to format as code in Stack Exchange mobile app

How to write code when asking a question in the Stack Exchange mobile app? For example, on the computer, we arrange code by just pressing Ctrl+K. What should I do in the mobile app?
1
vote
1answer
53 views

Is there a way to include formatted text to a comment? [duplicate]

Is there a way to include formatted text to a comment? By that I mean adding formatted source code, or literal text, as well as new lines, that is, starting new paragraphs on new lines.
2
votes
1answer
44 views

Code formatting XML hides code?

I'm trying to answer my own question on Stack Overflow. I've followed the guides on pasting XML, however it still doesn't show on the answer: The InnerException message was 'Maximum number of ...
0
votes
0answers
29 views

Is it appropriate to edit a Q/A for the indentation of brackets (curly braces: “{}”) in code on SE sites (SO, SU, …)? [duplicate]

Is there a standard/preferred/approved way to format the indentation/placement of curly braces ("{}") in code on SE sites (SO, SU, ...) ? More precisely, I'm talking about the placement of the ...
1
vote
0answers
30 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
81 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
59 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, ...
1
vote
1answer
65 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
64 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
62 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
157 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.
2
votes
1answer
49 views

“Improperly formatted code” when adding an additional image in an edit

I made a question on Stack Overflow and then tried to edit it so that what I entered in the entry box was the exact text shown below in the code block. The system would not let me post it, throwing ...
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
106 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
165 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
65 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
vote
1answer
698 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
72 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
60 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
53 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
76 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
344 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 ...
-18
votes
1answer
84 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
234 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
74 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
54 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‌​...
2
votes
0answers
56 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
72 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
62 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
63 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
80 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
37 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 ...