18

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 has an empty line before it: <!-- language: <language_string> --> ... <line 1> <line 2> <line 3> ... *<...


17

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 seriously distracting: So yes, correct syntax highlighting is i.m.o. one of the most important tools to improve readability, and I love those edits.


9

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 formatting text in the markdown editor. When text that is formatted as a code sample by clicking on {} in the markdown editor is too long to fit inside the window, ...


8

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 limit, and then you formatted it as code and did hit the limit, that's because of the additional four spaces added to each line (which is how a line in a code ...


7

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 not destructive and don't alter original content they change wall-of-text code into easier to read code (bullet point 2 from here) posts where multiple ...


6

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. This is because the comment system doesn't work at all with line breaks, etc. which the code bars like the above need.


5

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/bash a=~/dir # fill variable a Unfortunately syntax highlighting doesn’t seem to work here on meta, but on main the comment would appear greyed out if the code ...


4

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 catching. Now I can present console input/output in comments.


3

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, e.g. an answer contains a bash script while the question isn't really about bash. Reject if the syntax highlighting was already fine before the edit, e.g. an ...


3

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: Reads the the content from a file or from the clipboard Converts every TAB character to four whitespaces Indents all lines with four whitespaces Optionally ...


1

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 likely that people will explain their code? My second question would be does it make the explanation more accessible? My third question would be does it look ...


1

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 HTML tag pair <pre><code> ... </code></pre> for code formatting. It means "preformatted text" and "code" on the finally displayed site it ...


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