Disclaimer: My request is about using the same markdown format used in GitHub for code blocks and syntax highlighting.

In most recent markdown formatters, other than the 4 space indentations, we can create code samples by using triple ticks before and after the code block, for example:

this would become a code block

On the top of my head, I can think of 2 advantages:

Line length

Using backticks instead of the current format would allows us to gain 4 extra characters for each line of code inside the editor. I find this really advantageous as the editor currently allows 79 characters per line and 78 when the scroll bar is showing on the right.
This is just around the 80 character limit which most programming languages suggest. Thus giving us back those 4 extra characters would be quite nice in my opinion.

I'm currently using Firefox on Ubuntu, but I don't believe the character count per line would be much different on a different browser/OS, probably 1 extra or less character per line.

Syntax Highlighting and ease of use

Also, I find this style of formatting much simpler for use, especially when explicitly specifying the language for syntax highlighting.

Currently in SE, when we need to specify the language, we need to prepend the code block with the following unindented line <!-- language: js --> followed by empty line.

<!-- language: js -->

    // JavaScript code

In contrast, using the triple backticks format, we would use the much simpler:

// JavaScript code

In my opinion, the format of the latter is much easier to remember.

P.S. I'm not asking to replace the current format with backticks, I'm asking if we can add this feature thus having 2 ways of formatting code.



Browse other questions tagged .