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 ...
user avatar
  • 183k
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 ...
user avatar
  • 34.1k
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 ...
user avatar
  • 79.8k
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 ...
user avatar
  • 11.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 ...
user avatar
  • 99.8k
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 ...
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 ...
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. ...
user avatar
  • 67.5k
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/...
user avatar
  • 37.5k
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 ...
user avatar
  • 1
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 ...
user avatar
  • 10.5k
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, ...
user avatar
  • 37.5k
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:...
user avatar
  • 34.1k
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 ...
user avatar
  • 93k
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 ...
user avatar
  • 17.8k
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 ...
user avatar
  • 66.7k
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 ...
user avatar
  • 101k

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