A List of Google Prettify Language Codes
Asked Answered
S

2

26

I cannot find this anywhere and I swear I used to be able to very simply without much prying. Can anyone help me? Thanks. I would appreciate it. Also, does prettify support Batch?

Stairhead answered 25/9, 2013 at 4:47 Comment(2)
Slightly related and just as reference a question on Meta Stack Overflow: What is syntax highlighting and how does it work?. – Alby
This reminder is partly for my own benefit: 😊 . . . Specify code language (vb/vba as example): <!-- language: lang-vb --> . . . Set language for entire post: <!-- language-all: lang-vb --> Disable prettify: <!-- language: lang-none --> – Charterhouse
D
15

You can find a table in the FAQ, under the header For which languages does it work?:

The comments in prettify.js are authoritative but the lexer should work on a number of languages including C and friends, Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, Makefiles, and Rust. It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl and Ruby, but, because of commenting conventions, but doesn't work on Smalltalk.

Other languages are supported via extensions: ...


You can find the handlers, with their extensions in the loader directory


For the mapping from extensions to builtin languages, see the registerLangHandler calls in prettify.js

Deliberate answered 25/9, 2013 at 14:24 Comment(0)
C
23

I thought it would be helpful to have an actual list rather than just a link. I found it in the loader directory that @MikeSamuel linked to from Javascript code prettifier. As the readme states, the prettify.js comments are the authoritative source. However, What is syntax highlighting and how does it work? provided a better formatted list, so I will copy that below. Refer to the the links for the most up-to-date information.

If you are using the Prettify codes to markup Stack Overflow code, you use

<!-- language: lang-or-tag-here -->

    your code

Language Codes:

Let Prettify interpret the code and guess.

default

Explicitly do not use any syntax highlighting.

lang-none

Bash and other Shell scripting

lang-bash, lang-bsh, lang-csh, lang-sh

C, C++, et al

lang-c, lang-cc, lang-cpp, lang-cxx, lang-cyc, lang-m

C#

lang-cs

Clojure

lang-clj

CoffeeScript

lang-coffee

CSS

lang-css

Dart

lang-dart

Delphi

lang-pascal

Erlang

lang-erl, lang-erlang

Go

lang-go

Haskell

lang-hs

HTML

lang-html

Java

lang-java

JavaScript

lang-js, lang-javascript

JSON

lang-json

LaTeX and TeX

lang-latex, lang-tex

Lisp and Scheme

lang-cl, lang-el, lang-lisp, lang-lsp, lang-scm, lang-ss, lang-rkt

Lua

lang-lua

OCaml, SML, F#, et al

lang-fs, lang-ml

Pascal

lang-pascal

Perl

lang-pl, lang-perl

PHP

lang-php

Protocol buffers

lang-proto

Python

lang-py, lang-python, lang-cv

R and S

lang-r, lang-s

Regex

lang-regex

Ruby

lang-rb, lang-ruby

Rust

lang-rc, lang-rs, lang-rust

Scala

lang-scala

SQL

lang-sql

VHDL

lang-vhdl, lang-vhd

Visual Basic

lang-vb, lang-vbs

XML

lang-xml
Checkoff answered 27/4, 2016 at 4:3 Comment(2)
so there's nothing for property files or config files? – Poulin
What about Makefile? – Walkover
D
15

You can find a table in the FAQ, under the header For which languages does it work?:

The comments in prettify.js are authoritative but the lexer should work on a number of languages including C and friends, Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, Makefiles, and Rust. It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl and Ruby, but, because of commenting conventions, but doesn't work on Smalltalk.

Other languages are supported via extensions: ...


You can find the handlers, with their extensions in the loader directory


For the mapping from extensions to builtin languages, see the registerLangHandler calls in prettify.js

Deliberate answered 25/9, 2013 at 14:24 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.