Skip to main content
Re-broke example
Source Link
dbr
  • 23.2k
  • 10
  • 67
  • 86

There are problems with code-prettify,

this [^\s>/] == "example" # is highlighted as a regex, not a comment, 1 / 2

..but it mostly does a really good job

There's no good solution to this, Markdown does not provide a way to specify what language a code-block is (see here), so StackOverflow would need to implement their own way.

In the past I've modified a markdown parser to look for a special first-line, something like..

{{language:python}}
import os
print os.listdir()

The usability problem then is, there's no way to know which languages are supported, or how I should specify say, Visual Basic .NET - should it be visualbasicnet, visual-basic.net, vb.net vbnet, etc..?

I suppose this could be overcome by making the code-block button ask for a language (or maybe add second specific-language-code button), but then the site isn't using Markdown anymore, it's using StackOverflows own non-standard version..

There are problems with code-prettify,

this [^\s>/] # is highlighted as a regex, not a comment

..but it mostly does a really good job

There's no good solution to this, Markdown does not provide a way to specify what language a code-block is (see here), so StackOverflow would need to implement their own way.

In the past I've modified a markdown parser to look for a special first-line, something like..

{{language:python}}
import os
print os.listdir()

The usability problem then is, there's no way to know which languages are supported, or how I should specify say, Visual Basic .NET - should it be visualbasicnet, visual-basic.net, vb.net vbnet, etc..?

I suppose this could be overcome by making the code-block button ask for a language (or maybe add second specific-language-code button), but then the site isn't using Markdown anymore, it's using StackOverflows own non-standard version..

There are problems with code-prettify,

this [^\s>/] == "example" # is highlighted as a regex, not a comment, 1 / 2

..but it mostly does a really good job

There's no good solution to this, Markdown does not provide a way to specify what language a code-block is (see here), so StackOverflow would need to implement their own way.

In the past I've modified a markdown parser to look for a special first-line, something like..

{{language:python}}
import os
print os.listdir()

The usability problem then is, there's no way to know which languages are supported, or how I should specify say, Visual Basic .NET - should it be visualbasicnet, visual-basic.net, vb.net vbnet, etc..?

I suppose this could be overcome by making the code-block button ask for a language (or maybe add second specific-language-code button), but then the site isn't using Markdown anymore, it's using StackOverflows own non-standard version..

Source Link
dbr
  • 23.2k
  • 10
  • 67
  • 86

There are problems with code-prettify,

this [^\s>/] # is highlighted as a regex, not a comment

..but it mostly does a really good job

There's no good solution to this, Markdown does not provide a way to specify what language a code-block is (see here), so StackOverflow would need to implement their own way.

In the past I've modified a markdown parser to look for a special first-line, something like..

{{language:python}}
import os
print os.listdir()

The usability problem then is, there's no way to know which languages are supported, or how I should specify say, Visual Basic .NET - should it be visualbasicnet, visual-basic.net, vb.net vbnet, etc..?

I suppose this could be overcome by making the code-block button ask for a language (or maybe add second specific-language-code button), but then the site isn't using Markdown anymore, it's using StackOverflows own non-standard version..