Language highlighting
-
Continuing the discussion from [Docker] Upgrades:
@sam said:
and you can select syntax highlighting languages in site settings
New stuff to break!
It seems we can't be too silly and stuff everything in there.
So.
Within reason, I'm open to requests to add languages from (I'm guessing) this list.
-
We have no "Go" support, yet? Is this racist against our local Go-guy?
Filed Under: Paging @ben_lubar
-
I'd say add the VB ones; of the others, I don't think anyone posts code snippets of them anyway.
-
-
> Brainfuck
Heh.
Ok - I've removed a couple, added all the VB ones. And Brainfuck for giggles.
-
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
-
Worth it!
-
Just don't add mathematica its 65kbs for god knows what.
-
There is no "html" highlighting? Or can you add "handlebars" as alternative?
You might as well add "go" and make @ben_lubar's posts more readable.
Personal unreasonable request: Delphi. Hey if others can get their own dead languages (vb), why can't I get mine?
-
xml is a hybrid of html
-
Is it worth adding
html
as an option though? Obviously it'd use the same highlighter asxml
; it'd be like an alias or something.
-
<p> But wouldn't it be nicer to be able to post {{forumSoftwareName}} code with highlighting? <br/> (speaking about handlebars) </p>
-
Or can you add "handlebars" as alternative?
You might as well add "go" and make @ben_lubar's posts more readable.
Personal unreasonable request: Delphi.
Handlebars put back in, Go and Delphi added.
Is it worth adding html as an option though?
Maybe - it seems to pick it up as XML anyway - specifying
html
as the language auto-picks xml:<head> <body> body </body> <title> title </title> </html>
View source (from preview window):
<code class="lang-auto hljs xml">
-
{{#data}} <div>{{value}}</div> {{/data}} {{^data}} {{! comment the lack of data }} No data. Boo! {{/data}}
-
<p></p><pre><code class="lang-handlebars hljs">
What were you expecting?
-
What were you expecting?
{{#something}}
tag opens a block that iterates over data, should be highlighted.
{{/something}}
tag closes a block that iterates over data, should be highlighted.
{{^something}}
tag means "something
not defined or empty. Seems to highlight only^something
, and it seems to do that beacause of the^
.
{{! something}}
is a comment. Seems to get highlighted because of the!
.In any case, I'd expect curly braces to be highlighted, like
<
and>
are in HTML / XML.
-
And Brainfuck for giggles
Yeah, that one just screams to be enabled around here.
I'd suggest Rust. We have at least one dedicated thread, and it comes up occasionally.
We see a bit of Lisp now and again, too.
-
-
Is this detected as Lisp?
()
Apparently so... but it doesn’t highlight the parentheses
-
Reasonable request: Haskell.
Slightly-less-reasonable request: Ada.
Are-you-belgiumÂing-crazy? request: Forth
-
I feel like we could live without http ( ), ini and nginx, maybe even diff, and I'd expect that JavaScript could cover for json.
-
I'd expect that JavaScript could cover for json
Sort of.
The colouring's different, but it could work maybe?
-
-
Within reason, I'm open to requests to add languages
Ooh, ooh, can we haz Scheme plx? (And maybe Haskell and Rust as well...)
-
xml is a hybrid of html
They're more like siblings, actually. Both derive from SGML. XML and HTML have no direct relationship.
-
Sorry was on mobile when I typed that, I mean in the context of https://highlightjs.org/ they use the exact same ruleset.
-
Ah, got it.
-
-
@tar said:
Scheme
(define (thanks n) (display "Thanks, ") (display n) (display "!\n")) (thanks '@PJH)
-
package main import "fmt" func main() { fmt.Println("Thanks, @PJH!") }
package main import "fmt" func main() { fmt.Println("Thanks, @PJH!") }
-
package thanks import "fmt" func To(recipient string) { fmt.Printf("Thanks, %v!\n", recipient); }
package main import "thanks" func main() { thanks.To("@PJH") }
-
That is much closer to the spirit of the original.
Quite frankly, I thought Ben's attempt was sloppy, and it brought ill repute upon Go.
-
func To(string recipient) {
Why not
func To(recipient interface{}) {
?
I don't see the recipient type defined anywhere and you should probably not use
string
as a variable name.
-
Why is whitespace and Piet not on that list?
-
Happy?
-
-
-
That racist page doesn't even have Progress.
-
How do you write "Get off my lawn" in Progress?
Damned kids and their new-fangled languages *grumble*
-
How do you write "Get off my lawn" in Progress?
message "Get off my lawn" view-as alert-box title ":trollface:"
because they're syntax idiots. (That's obviously for a message box. If you want to print it in a regular window, it's
display "Get off my lawn"
because, as I said below, this is an ancient language with borrowage from COBOL.Here, have a screenshot.
Hey, it even comes with an Eclipse environment, these days.
Damned kids and their new-fangled languages grumble
It's only new-fangled relative to stuff like Fortran.
-
syntax idiots
What you did there. I see it.
Hey, it even comes with an Eclipse environment, these days.
That's a plus?
Fortran
Luxury!
-
That's a plus?
Compared to the regular environment, which is basically Notepad, yes.
ETA: That is, as long as your computer isn't the kind of POS that takes an entire minute to load Eclipse.
-
Thank you, syntax highlighting really makes whitespace code more readable.
-
Thank you, syntax highlighting really makes whitespace code more readable.
More (or perhaps less) seriously:
http://vim.sourceforge.net/scripts/script.php?script_id=5035
-
comment
Not even applying in preview... also no way to enter tabs w/o copy/paste.
-
comment bar foo
Looks like we have a bug, it's ignoring the class and using
nginx
instead. Along with the "Stripping whitespace from the front/end of code blocks", but that one's fixed
-
More (or perhaps less) seriously:
http://vim.sourceforge.net/scripts/script.php?script_id=5035
Hmm...
It is important that you use Ctrl-L frequently, since Vim is not too happy about syntax'es that includes newlines.
...OK, then.