CloudFlare suffered a massive security issue affecting all of its customers, including Rosetta Code. All passwords not changed since February 19th 2017 have been expired, and session cookie longevity will be reduced until late March.--Michael Mol (talk) 05:15, 25 February 2017 (UTC)

Help:Syntax Highlighting

From Rosetta Code

Rosetta Code supports syntax highlighting of code using GeSHi, the Generic Syntax Highlighter.

How to highlight[edit]

Prefix your code with <lang foo> (where foo is the language to use for highlighting) and suffix it with </lang>. Be sure not to insert extra space between the tags and your code. For example, here's how you'd highlight a C program:

<lang c>int main (int argc, char* argv[])
{
  return 0;
}</lang>

That markup would be rendered thus:

int main (int argc, char* argv[])
{
return 0;
}

Supported languages[edit]

Make sure to use the standard identifier for your language even if GeSHi doesn't know how to highlight it yet. If your language isn't in the list, make up an identifier (consisting entirely of lowercase alphanumeric ASCII characters; make it short yet unambiguous) and add it to the list. That way, if your language is supported in a future release of GeSHi, Rosetta Code can immediately benefit.

Also, if it hasn't been done yet, add the identifier to your language's category page. Use the "tags" parameter in the language template to specify it (e.g. "tags=foo" for the example above). If you find that your language already has a tag listed there that isn't in the Village Pump post, add it to the post as well.

If you'd like to, it's surprisingly easy to write a new language definition for GeSHi. See this post for more on the relationship between GeSHi and Rosetta Code. AutoGeSHi may be of use, although it isn't nearly as fancy as its name suggests; see this page.

Recommended language tag usage[edit]

  • 4D 4d
  • 4DOS Batch 4dos

A

  • ALGOL 60 algol60
  • ALGOL 68 algol68
  • APL apl
  • AWK awk
  • ActionScript actionscript
  • Ada ada
  • Agda2 agda2
  • AmigaE amigae
  • App Inventor dos
  • AppleScript applescript
  • Assembly asm (for x86)
  • AutoHotkey autohotkey

B

  • BASIC qbasic freebasic thinbasic bbcbasic fuzebasic commodorebasic
  • Batch File dos
  • Bc bc
  • Befunge befunge
  • Brainf*** bf

C

  • C c
  • C# csharp
  • Caché ObjectScript cos
  • C++ cpp
  • Caml caml
  • Ceylon ceylon
  • Clean clean
  • Clojure lisp
  • CMake cmake
  • Cobol cobol
  • ColdFusion cfm
  • Common Lisp lisp
  • Component Pascal pascal
  • Coq coq
  • C Shell csh

D

  • D d
  • Dao dao
  • Dc dc
  • Delphi delphi
  • DWScript delphi

E

  • E e
  • EC ec
  • ELLA ella
  • ESQL sql
  • Eiffel eiffel
  • Emacs Lisp lisp
  • Erlang erlang
  • Euphoria euphoria

F

  • F f
  • F# fsharp
  • FALSE false
  • FP fp
  • Factor factor
  • Fan fan
  • Forth forth
  • Fortran fortran

G

  • GAP gap
  • Gnuplot gnuplot
  • Go go
  • GP parigp
  • Groovy groovy

H

  • HaXe haxe
  • Haskell haskell

I

  • IDL idl
  • Icon icon
  • Io io

J

  • J j
  • JSON json
  • JScript.NET jscript
  • Java java java5
  • JavaScript javascript
  • JoCaml jocaml
  • Joy joy
  • jq
  • JudoScript judoscript

L

  • LSE64 lse64
  • LaTeX latex
  • LabVIEW labview
  • Lisaac lisaac
  • Lisp lisp
  • Locomotive BASIC locobasic
  • Logo logo
  • Logtalk logtalk
  • LotusScript lotusscript
  • Lua lua
  • Lucid lucid

M

  • M4 m4
  • MAXScript maxscript
  • MIRC Scripting Language mirc
  • MS SQL sql
  • Make make
  • Maple maple
  • Mathematica mathematica
  • MATLAB matlab
  • Maxima maxima
  • Mercury mercury
  • Metafont metafont
  • Modula-3 modula3
  • Morfa morfa

N

  • NetRexx netrexx
  • NewLISP lisp
  • Nial nial

O

  • OCaml ocaml
  • Oberon-2 oberon2
  • Object Pascal pascal
  • Objective-C objc
  • Octave octave
  • Omega omega
  • OpenEdge/Progress progress
  • ooRexx ooRexx
  • Oz oz

P

  • PARI/GP parigp
  • PHP php
  • PL/I pli
  • PL/SQL plsql
  • Pascal pascal
  • Perl perl
  • Perl 6 perl6
  • Pike pike
  • PlainTeX tex
  • Pop11 pop11
  • PostScript postscript
  • PowerBASIC powerbasic
  • PowerShell powershell
  • Prolog prolog
  • Python python

Q

  • Q q

R

  • R r
  • REXX rexx
  • RapidQ rapidq
  • Raven raven
  • Rhope rhope
  • Ruby ruby
  • Rust rust

S

  • SAS sas
  • SETL setl
  • SMEQL smeql
  • SNUSP snusp
  • SQL sql
  • Scala scala
  • Scheme scheme
  • Script3D script3d
  • Seed7 seed7
  • Self self
  • Sinclair BASIC zxbasic
  • Slate slate
  • Smalltalk smalltalk
  • Sparkling sparkling
  • Standard ML sml

T

  • TI-83 BASIC ti83b
  • TI-89 BASIC ti89b
  • Tcl tcl
  • Toka toka
  • Tr tr
  • Transact-SQL sql
  • Twelf twelf

U

  • Unicon unicon
  • UNIX Shell bash
  • UnixPipes bash
  • Unlambda unlambda

V

  • V v
  • VBScript vbscript
  • Vedit macro language vedit
  • Visual Basic vb
  • Visual Basic .NET vbnet
  • Visual Objects visobj

W

  • Wrapl wrapl

X

  • XQuery xquery
  • XSLT xml
  • XTalk xtalk

Z

  • ZX Spectrum BASIC zxbasic

GeSHi extension self-report[edit]

Here is a list of the codes currently provided by GeSHi.


List of supported languages for Geshi 1.0.8.10:
  • 4cs
  • 6502acme
  • 6502kickass
  • 6502tasm
  • 68000devpac
  • abap
  • actionscript
  • actionscript3
  • ada
  • ahk
  • algol68
  • apache
  • applescript
  • apt_sources
  • arm
  • asm
  • asp
  • asymptote
  • autoconf
  • autohotkey
  • autoit
  • avisynth
  • awk
  • bascomavr
  • bash
  • basic4gl
  • bb4w
  • bf
  • bibtex
  • blitzbasic
  • bnf
  • boo
  • c
  • c_loadrunner
  • c_mac
  • caddcl
  • cadlisp
  • cf3
  • cfdg
  • cfm
  • chaiscript
  • cil
  • clojure
  • cmake
  • cobol
  • coffeescript
  • cpp
  • cpp-qt
  • csharp
  • css
  • cuesheet
  • d
  • dcl
  • dcpu16
  • dcs
  • delphi
  • desktop
  • diff
  • div
  • dos
  • dot
  • e
  • ecmascript
  • eiffel
  • email
  • epc
  • erlang
  • euphoria
  • f1
  • falcon
  • fo
  • fortran
  • freebasic
  • freeswitch
  • fsharp
  • gambas
  • gambas3
  • gdb
  • genero
  • genie
  • gettext
  • glsl
  • gml
  • gnuplot
  • go
  • groovy
  • gwbasic
  • haskell
  • hicest
  • hq9plus
  • html4strict
  • html5
  • icon
  • idl
  • ini
  • inno
  • intercal
  • io
  • j
  • java
  • java5
  • javascript
  • jquery
  • kixtart
  • klonec
  • klonecpp
  • latex
  • lb
  • ldif
  • lisp
  • llvm
  • locobasic
  • logtalk
  • lolcode
  • lotusformulas
  • lotusscript
  • lscript
  • lsl2
  • lua
  • m68k
  • magiksf
  • make
  • mapbasic
  • matlab
  • mirc
  • mmix
  • modula2
  • modula3
  • mpasm
  • mupad
  • mxml
  • mysql
  • nagios
  • netrexx
  • newlisp
  • nsis
  • oberon2
  • objc
  • objeck
  • ocaml
  • ocaml-brief
  • octave
  • oobas
  • oorexx
  • oracle11
  • oracle8
  • oxygene
  • oz
  • parigp
  • pascal
  • pcre
  • per
  • perl
  • perl6
  • pf
  • php
  • php-brief
  • pic16
  • pig
  • pike
  • pixelbender
  • pli
  • plsql
  • postgresql
  • povray
  • powerbuilder
  • powershell
  • proftpd
  • progress
  • prolog
  • properties
  • providex
  • purebasic
  • pycon
  • pys60
  • python
  • q
  • qbasic
  • rails
  • rebol
  • reg
  • rexx
  • robots
  • rpmspec
  • rsplus
  • ruby
  • sas
  • scala
  • scheme
  • scilab
  • sdlbasic
  • smalltalk
  • smarty
  • spark
  • sparql
  • sql
  • st
  • stonescript
  • systemverilog
  • tcl
  • teraterm
  • text
  • thinbasic
  • tsql
  • typoscript
  • unicon
  • upc
  • urbi
  • uscript
  • vala
  • vb
  • vbnet
  • vedit
  • verilog
  • vhdl
  • vim
  • visualfoxpro
  • visualprolog
  • whitespace
  • whois
  • winbatch
  • xbasic
  • xml
  • xorg_conf
  • xpp
  • yaml
  • z80
  • zxbasic