20 votes
Accepted

What to do with <!-- language: bash --> edits?

Yes, syntax highlighting of anything more than a couple of lines is a readability improvement. While the software used to apply syntax highlighting isn't all that great, it has rendered obvious some ...
muru's user avatar
  • 191k
18 votes

How do I format some code specifically for the language used? Or how do I prevent it from being formatted? Which languages are supported?

Add the line <!-- language: <language_string> --> (where <language_string> is the string identifying the language) before the start of the code, and make sure that the code itself ...
kos's user avatar
  • 35.3k
18 votes

What to do with <!-- language: bash --> edits?

Just look at the examples. Does it matter? If you are used to read syntax highlighting in a specific language: YES The other way around, on e.g. a .desktop file, (default bash) highlighting can be ...
Jacob Vlijm's user avatar
10 votes

Community consensus regarding using backticks or 4 spaces for code

My personal preference is to use the triple backtick as that's the most common way to set code blocks in Markdown outside of Stack Exchange. I find it much easier to use. When I am editing someone ...
Dan's user avatar
  • 12.2k
9 votes

Automatically wrapping lines in Ask Ubuntu

Click the gray circle with a question mark inside it in the upper right corner of the Ask Ubuntu markdown editor to show the link for advanced help (in red letters) which tells all the rules for ...
karel's user avatar
  • 109k
8 votes

Code Block Limit of 30000 characters

Unless a new code-block-specific limit has been introduced recently (and not talked about), the limit is for the whole post, not specifically for a code block. If you pasted code in and didn't hit the ...
Eliah Kagan's user avatar
8 votes

What to do with <!-- language: bash --> edits?

Here's just my 2-cents on this: color highlighting improves clarity and readability of code, hence improves clarity and readability of the edited post, makes it easier to read (related post). they're ...
Sergiy Kolodyazhnyy's user avatar
7 votes
Accepted

How to properly add code in comment

In comments you are limited to just test test which is generated by the code: `test test` There is no way to get the larger code bar like in your example or in the line above this in a comment. ...
Thomas Ward's user avatar
  • 71.8k
5 votes

Presentation of code should include explanation in a separate comment section

My two cents to just those two points you raised: users may mistakenly take in code comments as part of the provided solution The syntax highlighting prevents that very well, for example: #!/bin/...
dessert's user avatar
  • 39k
4 votes

Community consensus regarding using backticks or 4 spaces for code

Just like Dan, I don’t think we need a consensus. In your posts, use whatever you want (but keep the difference of in-line vs. block code formatting as Mark Kirby noted). However, if I edit someone ...
Melebius's user avatar
  • 11k
4 votes
Accepted

How do I use the grey formatting in a comment?

I was using the wrong character. I thought the directions said to use the apostrophe character ( ' ) but they said to use the backtick character ( ` ) which was a subtle difference that I wasn't ...
XqRG's user avatar
  • 1
4 votes

What to do with <!-- language: bash --> edits?

I also came across edits of this type and treated them as follows: Approve if the edit actually improved the post by triggering correct syntax highlighting while it wasn't possible to just add a tag, ...
dessert's user avatar
  • 39k
3 votes

How can I quickly and easily format my code for SE sites' posts?

SEcopy SEcopy it's a bash script I wrote for myself which will read the content from a file or from the clipboard and format it for SE sites, copying the formatted content to the clipboard. Features:...
kos's user avatar
  • 35.3k
3 votes

Community consensus regarding using backticks or 4 spaces for code

I actually know of five ways to format code on SE, not including the editor button (click edit to see): back ticks html four spaces blocks using back ticks blocks using tilde I know, that is even ...
Mark Kirby's user avatar
  • 18.2k
3 votes

Community consensus regarding using backticks or 4 spaces for code

I don't think it makes any difference at all. I am very used to the 4-spaces indentation, my muscle memory works that way and there is a nifty userscript that means I can indent by just selecting text ...
terdon's user avatar
  • 97.6k
2 votes
Accepted

How to write the grave accent to add code in the comment section?

As far as I can see, the ` is the top left standard key (to the left of the 1) on both US an UK keyboards. Images from Wikipedia. UK Keyboard: US Keyboard:
Artur Meinild's user avatar
1 vote

Presentation of code should include explanation in a separate comment section

I think people not explaining what code does is a much bigger problem on this site than code comments being unwieldy. My first question about your feature request would be does it make it more ...
Zanna's user avatar
  • 68.9k
1 vote

How can I quickly and easily format my code for SE sites' posts?

If you're just too lazy to indent a huge number of lines, you can select it and click on the {}-button in the panel above the text field where you enter your post. Another possibility is to use the ...
Byte Commander's user avatar
  • 105k

Only top scored, non community-wiki answers of a minimum length are eligible