Questions tagged [code-formatting]

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

Filter by
Sorted by
Tagged with
-1
votes
0answers
50 views

Why is my code not shown? [duplicate]

In the following question What is the difference between confidentialPort and securePort for Jetty I have the following XML snippet: But what is shown is: Is this a bug? I used the code-button {} ...
3
votes
1answer
83 views

How to fix, or document for users: Escaped backtick rendering, in question/answer or comment [duplicate]

Noting this duplication of topic, I hope this question can also address, what else might be easily done? This is a bug, or should be added to editing notes. Congratulations you discovered meta._....
3
votes
0answers
30 views

Add syntax highlighting support for Dockerfiles

Highlight.js supports syntax highlighting Dockerfiles, but support is not present on Stack Exchange’s version of highlight.js. Please consider adding support for this. Example question on Stack ...
2
votes
0answers
55 views

Add syntax highlighting support for Nim

Highlight.js supports syntax highlighting for Nim here. Questions on Stack Overflow for [nim-lang] currently have no highlighting support, and this would be a valued feature for users.
5
votes
0answers
40 views

JavaScript code snippet Tidy function injects a separating space into the null coalesce operator

For JavaScript snippets, the Tidy feature injects a space between the question marks that compose the nullish coalescing operator ??[1]. Example: Prior to Tidy: console.log(((a, b) => { return a ?...
5
votes
0answers
29 views

Add syntax highlighting support for nginxconf

Highlight.js supports syntax highlighting for nginx configuration files, but support is not present on Stack Exchange’s version of highlight.js. Please consider adding support for this. Example ...
4
votes
0answers
86 views

Syntax highlighting language request: Python REPL

Highlight.js treats Python REPL (the Python interpreter in interactive mode) as its own language separate from Python—it uses the class names python-repl and pycon. I checked Stack Exchange's ...
7
votes
1answer
139 views

What happened to Groovy syntax highlighting?

On Stack Overflow I have answered many questions about Spock and Geb, two Groovy test frameworks. For years, I have used <!-- language: lang-groovy --> in combination with indentation by four ...
5
votes
3answers
148 views

Did the automated CommonMark migration mess up the formatting of this answer?

I suspect the automated CommonMark migration messed up the formatting of this answer. Before the migration to CommonMark: https://web.archive.org/web/20200515072655/https://unix.stackexchange.com/...
298
votes
38answers
42k views

Goodbye, Prettify. Hello highlight.js! Swapping out our Syntax Highlighter

Update 2020-09-24 This is now live network-wide. Update This is now live on Meta Stack Exchange and Meta Stack Overflow. Any bugs and feedback can be posted here as an answer. I’m Ben and I’m a dev ...
27
votes
0answers
177 views

Please remove the horizontal whitespace in the left part of code blocks

With the new post formatting there's extra horizontal whitespace at the left of code blocks (not to be confused with the increased line height). Before the new formatting: Now (red circle shows the ...
7
votes
0answers
91 views

Unable to differentiate between code and hyperlinks with code formatting on mobile site

This is a follow up of my earlier question Hyperlinks in code formatting no longer follows site color. The links in code formatting on mobile site aren't underlined which worsens the above situation ...
6
votes
0answers
67 views

Hyperlinks in code formatting no longer follows site color

Earlier code used to follow site colors, for example, Orange on Ask Ubuntu[Click on image to open corresponding cached page/post] : and blue on Unix & Linux But now they no longer follow site ...
99
votes
2answers
1k views

Request for a possibility to adjust the spacing between lines

Update: The line-height in code blocks is almost back to what it was before (it was 1.3 but is now 1.30769231) and the spacing between lines in regular text is now at 1.5 (it was 1.3 before the change)...
14
votes
1answer
124 views

Can we warn users if the first line of a code block is silently discarded if placed on the same line as ```?

Here's an example. If a user types following into the question box: ```#include <iostream> int main() { std::cout << "Hello, world!\n"; } ``` It will look like this: int ...
3
votes
2answers
92 views

Should Ctrl+K in the editor use the code fences instead of indentation?

Now that the Stack Exchange network has switched to CommonMark, some features appear to be deprecated. In particular, comment-style language hints may eventually stop working. So instead of using 4-...
-10
votes
1answer
68 views

How to “prettify” my coments [duplicate]

How can I format my comments? For example, I've pasted a few lines of code (with new lines, spaces etc.) but it looks very ugly.
2
votes
0answers
57 views

Markdown inconsistency between preview and post when using blank lines [duplicate]

This happened in an answer on Code Golf.SE, where we have all sorts of uncommon programming languages to put in a code block. OP's code is copied here at the markdown level: bbcccbc-cc-b--b-- c b &#...
6
votes
1answer
82 views

Does <Shift> + <Enter> create lists automatically if the line starts with a dash or a bullet?

I just noticed that if you have some text and you add a dash in front of the first character, then when you hit Shift + Enter before any character in the text, then it gets rendered as a list. This ...
-9
votes
1answer
108 views

Extra newline risks running unwanted commands [closed]

Triple-clicking on a code block like the ones here highlight the line with an additional newline at the end. When the user copies and pastes it into the terminal the extra newline results in the ...
6
votes
0answers
58 views

Provide a proper way to indicate error messages that is visually distinct from quotes and actual code

Error messages are a fairly common thing to mention, in both questions and answers, across many Stack Exchange communities. I think it would be valuable to have a markdown syntax to denote error ...
11
votes
0answers
60 views

Code formatting error message dispenses no-longer-true advice, and doesn't indicate what to do in case of false positives

On four sites in the network, there is a code formatting filter that checks for users pasting in code but not formatting it correctly. When it is triggered, it says the following: Your post appears ...
4
votes
1answer
89 views

How to avoid the 'not properly formatted as code' alert

I've been trying for many hours to post a question in Mathematica Stack Exchange and I always get the following warning I've done the indentation but did not work (though in the preview looks ...
4
votes
0answers
48 views

Appearance of numbers for an ordered list element starting with a code block

These: 1. ``` foo bar baz bad ``` 2. foo bar baz bad Render as: foo bar baz bad foo bar baz bad Screenshot: I am pretty sure the list numbers were aligned ...
8
votes
0answers
64 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
64 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
70 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
92 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
100 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
115 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
52 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
78 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
192 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
146 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
88 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
36 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. ...
10
votes
1answer
3k 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
62 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
42 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
23 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
135 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
148 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
75 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
69 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
87 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 ...

1
2 3 4 5
14