Questions tagged [code-formatting]

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

Filter by
Sorted by
Tagged with
2
votes
0answers
34 views

How to preserve a TAB character in a string?

I want to preserve the TAB character in a string, because I want to give an example input that contains a TAB. Then users can copy that string and use it. But it seems like StackExchange always ...
3
votes
1answer
49 views

Display issue of three-backticks formatted code

I came across an answer on Stack Overflow whose code is formatted with triple backticks (AKA CommonMark / GitHub style / ```), that layouts weirdly: When I edit the question, the preview looks ...
-9
votes
1answer
89 views

Inserting code method should be changed

I realize this suggestion would affect only the Stack Exchange sites that use code as part of their questions. However, since my suggestion would involve a re-code, if it's accepted, I thought it best ...
1
vote
0answers
63 views

Code sample button to insert code fences with backticks by default

At least on stackoverflow, new users tend insert their code using the {} "code sample" button in the formatting bar, which uses 4 spaces to pad the code. And I've seen several times when that ...
3
votes
0answers
48 views

Don't show how to format code when I'm not on a programming site [duplicate]

Instructions on how to format code are the first thing you see under "How to Format" when asking a question, which is great, except when you're on a site that isn't about programming: ► create code ...
5
votes
0answers
44 views

Code block with more than 81 characters adds a newline if preceded with spaces

The standard editor for posts seems to have problem with non-word-breakable code blocks above a certain length. If such a 'word' is present in the editor, inserting spaces before it to create a code ...
2
votes
1answer
39 views

Cannot format code

I am trying to format the code from the link using the Stack Exchange app but when I cut and paste the code wall the spaces get removed and the hash marks disappear in the output. How can I fix it? ...
-4
votes
1answer
111 views

Labels atop code blocks

I'm sure this is an accident, but I've recently found out that you can "label" code blocks in a really nice way by using inline code in a level 4 (####) header: #### `Main.hs` ```haskell module Main ...
6
votes
0answers
54 views

An empty code block gets added after an embedded list containing code

If I have a code block which is created using three backticks (```) inside a nested list, a second empty code block sometimes gets added after the list. For example, this markdown code: 1. Testing a ...
6
votes
0answers
54 views

“How to format” block mentions syntax highlighting even if it is not available on the site

When you edit the body of a post, the "How to Format" widget is shown in the right sidebar. It mentions the syntax highlighting function, even on sites which don't have syntax highlighting enabled ...
4
votes
0answers
44 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
129 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 ...
-1
votes
0answers
47 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
56 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
479 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
206 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
106 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 ...
24
votes
3answers
1k 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
36 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
37 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
43 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
56 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
62 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
69 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
71 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
64 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
270 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
53 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
1k 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
69 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
913 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
75 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
62 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
55 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
87 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
455 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
85 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
62 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
380 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
77 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 ...