First time here? Check out the FAQ!
1

Expand syntax highlighting support to allow named language?
 

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:

#!/bin/bash
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:

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

This sounds like a relatively straight-forward improvement.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
qubit's avatar
108
qubit
asked 12 years ago, updated 12 years ago

Comments

see more comments

1 Answer

0

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).

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 12 years ago
link

Comments

> 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's avatar qubit (12 years ago)
see more comments