Questions tagged [code-formatting]

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

Filter by
Sorted by
Tagged with
6
votes
3answers
110 views

Fold a big chunk of text in a question

Is it possible to fold a big chunk of text in a question? In my case I need to paste this html into this question. I need this, because, the big chunk of text is relevant for the question, but is ...
12
votes
2answers
182 views

Preventing word-breaking in flowed paragraphs

In questions and answers, I would sometimes like to keep a whole string together, to avoid what's happening to the string [![:print:]] here: Is there a trick to avoid breaking a short string? In ...
3
votes
1answer
113 views

Why am I getting a “code not properly formatted” error?

I know this question is asked a lot, but I looked at those answers and don't see an obvious place where that would apply to my post. I'm trying to post the following to Stack Overflow, but it won'...
5
votes
1answer
78 views

Why doesn't the syntax highlighting work?

I tried several ways of how to do syntax highlighting for R in this question, but it doesn't work. I tried ```R (see revision 3 of the question) and <!-- language: R --> (see revision 2) but ...
2
votes
0answers
33 views

Why aren't runnable code snippets formatted correctly within lists?

Consider the following code snippet. console.log("this line is all right"); console.log("but this line is indented"); This should be a part of the same bullet point but it's not. ...
3
votes
1answer
93 views

Where is the list of language names supported by the markdown fenced code blocks?

Related to Implement ```-style (fenced) Markdown code blocks On this answer I used ```makefile and it is "working" the highlighting: However, on this other answer, I am also using ```makefile and it ...
2
votes
1answer
57 views

How do you type `\` inside a codeblock in chat?

I showed someone in the Bridge how to make a shrug emoji (¯\_(ツ)_/¯) and while discussing the use of backticks, code blocks and backslashes in markdown, I realized that it's impossible to type ...
3
votes
0answers
40 views

The code after crossing the number of lines limit is masked

I noticed that in the Stack Exchange Android app, when the posted code crosses the normal limit of number of lines to be shown, the rest of the code gets masked with white color rather than hiding the ...
1
vote
0answers
22 views

Swift multiline strings are not formatted correctly [duplicate]

Swift multiline strings that contain quotation marks, such as: let multilineString = """ "let myString = 123" is part of my multiline string """ are formatted ...
7
votes
1answer
117 views

Why is double space replaced by single space when enclosed in backticks in comments?

I was trying to put a small line of code in a comment, but I noticed that the multiple spaces in the comment enclosed in backticks(`) were replaced with single ones. To make it clear, I wrote this as ...
5
votes
1answer
89 views

Chat removes ´ when trying to type code to someone

I am not sure if this should be a bug report or a feature request. I am trying to help someone and I keep trying to type `name` `=` 'Group project drive' but the ´ are being removed making it hard ...
6
votes
1answer
103 views

How to type italics or bold inside code in a comment

How can you put italics or bold inside code in a comment? For example, to produce normal italic in a comment I've tried `normal _italic_` `normal `_`italic`_ <code>normal _italic_</code> ...
-1
votes
1answer
41 views

Which elements are recommended to enclose in <code> tag within the description in Stack Overflow? [closed]

Enclosing code/text elements in the code tag varies user to user. For example, one user put 'decimal' inside the code tag. Then another user edited the post and put it as simple text. Such types of ...
2
votes
0answers
49 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 ...
4
votes
1answer
61 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
90 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
75 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
52 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
47 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
42 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
136 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
56 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
60 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
141 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 ...
3
votes
2answers
61 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
37 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
1k 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
214 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
127 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
2k 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
37 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
46 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
57 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
45 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
32 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
63 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 ...
7
votes
1answer
42 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
72 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
81 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
65 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 ...
3
votes
2answers
407 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
56 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
2k 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
167 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
71 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 ...