While going through the edit queue I came across an edit to this answer. I rejected it for two reasons; firstly it wasn't very substantive and secondly (the reason for this post) it was simply wrong - javascript code blocks should start with ```js
rather than ```javascript
(example shown at the bottom of the post).
Had the edit been more substantive or the code block larger I would have simply improved the edit by correcting their mistake.
Before I go further I should make it clear that I am not taking issue with the edit (though it wasn't the greatest I do agree with the the editors intent; highlighting syntax does make a post easier to read when you have a large block of code). My issue is how we, or rather, the site, can help users get it right first time.
I can't blame the editor for their mistake; if I look to the right of this box I'm typing into right now I see this -
Which tells me that if I am entering a block of Python code I add python
after the backticks. Seeing this I think -
Ah, so if I want code highlighting I need to add the language name after the backticks! So as I am adding Javascript code I add 'javascript'.
As mentioned above, in this case I would be wrong. But still how would I know that? Short of editing and checking the rendered markup below? But in this instance, should I need to? I read the "How to Format" help box and followed the convention it suggested.
While this question relates to the Javascript language I'm sure there will be others where the language identifier is not immediately obvious to new users. With this in mind could I suggest an addition to the "How to Format" help box with a link to a page with all accepted language identifiers?
```javascript
function example()
{
var string = "something";
return string;
}
```js
function example()
{
var string = "something";
return string;
}