Questions tagged [code-formatting]
The code-formatting tag has no usage guidance.
16 questions
25
votes
1
answer
458
views
How do I format some code specifically for the language used? Or how do I prevent it from being formatted? Which languages are supported?
If I format some code by indenting it using four spaces, the code is not formatted. How do I format some code specifically for the language used? Or how do I prevent it from being formatted? Which ...
1
vote
1
answer
69
views
How to write the grave accent to add code in the comment section?
I have a magic keyboard from Apple set on US language and I try to find the keyboard shortcut for the grave accent (`) to add code in the comment section on askubuntu.com.
I don't want to copy-paste ...
5
votes
4
answers
259
views
Community consensus regarding using backticks or 4 spaces for code
There might be similar posts regarding this in the past. So, please forgive me.
I often find it hard to edit a post which has lengthy code (indented using 4 spaces). Also, there are higher chances of ...
2
votes
0
answers
195
views
Preformatted text horizontal scrolling - bug or feature?
AskUbuntu help recommend to style pre-formatted text and console output with
#four spaces
But sometimes it results in scrolling text. See this question as an example. The problematic line (as ...
2
votes
0
answers
60
views
Syntax highlighting doesn’t work on meta
When I enter
<!-- language-all: lang-bash -->
if :; then echo "quoted"; fi
in a post on main, the output looks like this:
Here on meta, the very same code gets no syntax highlighting at ...
-3
votes
2
answers
91
views
Presentation of code should include explanation in a separate comment section
This is just an idea and I would like to see what the feedback is.
The problem
Starting Linux I've found myself many times looking through example code on this site and finding out what it actually ...
4
votes
1
answer
86
views
How do I use the grey formatting in a comment? [duplicate]
Someone showed me (by editing my question for me) how to make some of your
text show up grey to show it is code.
Now I need to know how to do it in a comment.
4
votes
1
answer
201
views
How to properly add code in comment
How can I properly add a line of code in a comment like this
test test
I like it more grey than test test if that is possible.
Or if there is another way to define code in a comment to make it ...
6
votes
1
answer
99
views
Automatically wrapping lines in Ask Ubuntu
I'm new to forums and stuff like that. I need to post my wifi-info scripts output in Ask Ubuntu using Firefox and I need to keep it as it is without wrapping any lines. As soon as copy and paste it, ...
18
votes
4
answers
410
views
What to do with <!-- language: bash --> edits?
Recently in the edit queue, there have been edits that only add <!-- language: bash --> to the post. These edits are made by the same user. And often 5-10 at a time.
Is the color highlighting of ...
2
votes
0
answers
111
views
How can I shorten the Long Code output in questions and answers and display scrollbars?
There are some questions and answers that have very log output that is condensed with scrollbars.
Is there a formatting method to control how much is displayed between the scrolling. I believe some ...
0
votes
1
answer
209
views
Code Block Limit of 30000 characters
I came across a question where user had copied the output of a certain command and made a *.docx file out of it. The file was uploaded and the link was provided in the question to this file.
I copied ...
6
votes
0
answers
65
views
Please use code fomatting for code, not quotes [duplicate]
This is some thing I see all the time recently and not just from new users.
Users are using > to format there code and that is just wrong.
Code should be formatted in one of these three ways
...
2
votes
3
answers
96
views
How can I quickly and easily format my code for SE sites' posts?
I usually indent code with tabs, and every time I want to test a snippet before posting it to a SE site I have to reformat it manually before I can post it. Even when I don't use tabs, I need to ...
4
votes
0
answers
75
views
Scrolling code blocks glitch
This is me trying to scroll left and right on this code block (animated):
Here are the still images:
This is a copy of the problematic code block, which I first found in this question
dpkg was ...
7
votes
0
answers
60
views
Preserve tabs in code
Tabs are currently rendered as spaces in code blocks. I'm sure this is just a symptom of Markdown or an otherwise well-intentioned method to standardise code samples... However some code needs tabs to ...