Questions tagged [code-formatting]

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

Filter by
Sorted by
Tagged with
8
votes
0answers
56 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
62 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
62 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
77 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
95 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
109 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
51 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 ...
4
votes
0answers
73 views

Link to line in code snippet

When sharing code from Github with people, I can get a link to the exact line, which helps with clarity when I'm bringing attention to something specific. I would like to do the same when linking ...
6
votes
3answers
117 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
189 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
131 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
85 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
35 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. ...
4
votes
1answer
682 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
125 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
92 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
121 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
43 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
69 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 ...
5
votes
1answer
66 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
81 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
53 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 ...
6
votes
0answers
58 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 ...
3
votes
1answer
43 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? ...
-5
votes
1answer
164 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
61 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
45 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 ...
9
votes
1answer
145 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 ...
4
votes
2answers
67 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
39 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
2k 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 ...
1
vote
2answers
222 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
131 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 ...
25
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
41 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?
4
votes
1answer
50 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
58 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.
3
votes
1answer
48 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 ...
5
votes
1answer
84 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
64 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 ...
8
votes
1answer
44 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
74 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 ...

1
2 3 4 5
13