Ask Your Question

Expand syntax highlighting support to allow named language?

asked 2013-02-19 17:56:23 -0600

qubit gravatar image

updated 2013-02-19 18:22:05 -0600

Askbot includes support for syntax highlighting using google-code-prettify (GCP), but doesn't offer an option to specify a particular language.

As a result, this bash code formats nicely:

echo "Foo bar"

But this BASIC code has some problems:

Sub FooBar
  Dim CountInteger As Integer  'For counting a thing
  Dim OtherInteger As Integer
  CountInteger = Blah / 2
  REM Do some stuff here 
  OtherInteger = 5
End Sub

There is already a mechanism within GCP to specify a language:

"You can specify a language by specifying the
language extension along with the prettyprint
class like so:

<pre class="prettyprint lang-html">

Here's the markdown-ish syntax GitHub uses to indicate language-specific syntax-highlighting:

ask = "bot"
puts "#{ask}: loopbackoffice"

This sounds like a relatively straight-forward improvement.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-02-22 17:54:47 -0600

Evgeny gravatar image

More likely we will refresh the version of the editor. I've looked at what Stackoverflow does these days for the syntax highlighting and they use a special comment for the cases where the language cannot be guessed <!-- lang: lang-name--> - on the preceding line of the code block.

In order to adopt that editor we'd also need to reconcile the potential new version with our changes: i18n and file attachments (and maybe some other things).

edit flag offensive delete link more


> they use a special comment for the cases where the language cannot be guessed &lt;!-- lang: lang-name--&gt;

How would a user specify a particular language? Hopefully the markup would be something simple, like the syntax used by GitHub above.

qubit gravatar imagequbit ( 2013-02-26 14:56:06 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-02-19 17:56:23 -0600

Seen: 408 times

Last updated: Feb 22 '13