{{{1}}}
Simple wrapper around the <syntaxhighlight> tag to show syntax-highlighted text. Unlike <syntaxhighlight>, text that does not fit on the screen will be wrapped.
Usage
{{Syntaxhighlight|code|lang}}
- code will become the contents of the syntax highlighted block.
- lang is the language used for syntax highlighting. Use
|lang=wikitextfor wikitext (wikimarkup). Other supported languages are listed below.
The <syntaxhighlight> tag used by this template is an expensive parser function call, so, if it is used on a page with 500 or more 'expensive' parser functions, all subsequent instances of this template after the 500th expensive function use on that page will be rendered as <code>...</code> blocks (without syntax highlighting).
Supported languages
| Code | Language |
|---|---|
4cs | 4CS |
6502acme | MOS 6502 (6510) ACME Cross Assembler |
6502kickass | MOS 6502 (6510) Kick Assembler |
6502tasm | MOS 6502 (6510) TASM/64TASS |
68000devpac | Motorola 68000 HiSoft Devpac ST 2 assembly |
abap | ABAP |
actionscript | ActionScript |
actionscript3 | ActionScript3 |
ada | Ada |
algol68 | ALGOL 68 |
apache | Apache configuration |
applescript | AppleScript |
apt_sources | APT sources |
arm | ARM assembly |
asm | Assembly |
asp | Active Server Pages (ASP) |
asymptote | Asymptote |
autoconf | Autoconf |
autohotkey | AutoHotkey |
autoit | AutoIt |
avisynth | AviSynth |
awk | AWK |
bascomavr | BASCOM AVR |
bash | Bash |
basic4gl | Basic4GL |
bf | Brainfuck |
bibtex | BibTeX |
blitzbasic | Blitz BASIC |
bnf | Backus–Naur form |
boo | Boo |
c | C |
c_loadrunner | C Loadrunner |
c_mac | C (Mac) |
caddcl | AutoCAD Dialog Control Language (DCL) |
cadlisp | AutoLISP |
cfdg | CFDG |
cfm | ColdFusion Markup Language |
chaiscript | ChaiScript |
cil | Common Intermediate Language (CIL) |
clojure | Clojure |
clp | Control Language Program |
cmake | CMake |
cobol | COBOL |
coffeescript | CoffeeScript |
cpp | C++ |
cpp-qt | C++ (Qt toolkit) |
csharp | C# |
css | Cascading Style Sheets (CSS) |
cuesheet | Cue sheet |
d | D |
dcl | DIGITAL Command Language |
dcpu16 | DCPU-16 |
dcs | Data Conversion System |
delphi | Delphi |
diff | Diff |
div | DIV |
dos | DOS batch file |
dot | DOT |
e | E |
ecmascript | ECMAScript |
eiffel | Eiffel |
email | Email (mbox \ eml \ RFC format) |
epc | Enerscript |
erlang | Erlang |
euphoria | Euphoria |
f1 | Formula One |
fo | FO |
fortran | Fortran |
freebasic | FreeBASIC |
freeswitch | FreeSWITCH |
fsharp | Fsharp |
gambas | Gambas |
gdb | GDB |
genero | Genero |
genie | Genie |
gettext | gettext |
glsl | OpenGL Shading Language (GLSL) |
gml | Game Maker Language (GML) |
gnuplot | gnuplot |
go | Go |
groovy | Groovy |
gwbasic | GW-BASIC |
haskell | Haskell |
haxe | Haxe |
hicest | HicEst |
hq9plus | HQ9+ |
html | HTML |
icon | Icon |
idl | Uno IDL |
ini | INI |
inno | Inno |
intercal | INTERCAL |
io | Io |
j | J |
java | Java |
java5 | Java(TM) 2 Platform Standard Edition 5.0 |
javascript | JavaScript |
jcl | Job Control Language |
kixtart | KiXtart |
klonec | Klone C |
klonecpp | Klone C++ |
latex | LaTeX |
lb | Liberty BASIC |
ldif | LDAP Data Interchange Format |
lisp | Lisp |
llvm | LLVM |
locobasic | Locomotive BASIC |
logtalk | Logtalk |
lolcode | LOLCODE |
lotusformulas | Formula language |
lotusscript | LotusScript |
lscript | LightWave 3D |
lsl2 | Linden Scripting Language |
lua | Lua |
magiksf | Magik |
m68k | Motorola 68000 assembly |
make | make |
mapbasic | MapBasic |
matlab | MATLAB M |
mirc | mIRC scripting language |
mmix | MMIX |
modula2 | Modula-2 |
modula3 | Modula-3 |
mpasm | Microchip assembly |
mxml | MXML |
mysql | MySQL |
nagios | Nagios |
netrexx | NetRexx |
newlisp | NewLISP |
nsis | Nullsoft Scriptable Install System (NSIS) |
oberon2 | Oberon-2 |
objc | Objective-C |
objeck | Objeck |
ocaml | OCaml |
ocaml-brief | OCaml |
ocl | Operational Control Language |
octave | Octave |
oobas | OpenOffice Basic |
oorexx | Object REXX |
oracle11 | Oracle 11 SQL |
oracle8 | Oracle 8 SQL |
oxygene | Oxygene |
oz | Oz |
parasail | ParaSail |
parigp | PARI/GP |
pascal | Pascal |
pcre | Perl Compatible Regular Expressions |
per | per |
perl | Perl |
perl6 | Raku |
pf | PF |
php | PHP |
php-brief | PHP |
pic16 | PIC assembly |
pike | Pike |
pixelbender | Pixel Bender |
pli | PL/I |
plsql | PL/SQL |
postgresql | PostgreSQL |
povray | Persistence of Vision Raytracer |
powerbuilder | PowerBuilder |
powershell | PowerShell |
proftpd | ProFTPD |
progress | OpenEdge Advanced Business Language |
prolog | Prolog |
properties | Properties file |
providex | ProvideX |
purebasic | PureBasic |
pycon | Python |
pys60 | PyS60 |
python | Python |
q | Q |
qbasic | QBasic–QuickBASIC |
ragel | Ragel |
rails | Rails |
rebol | Rebol |
reg | Windows Registry |
rexx | Rexx |
robots | robots.txt |
rpg | RPG |
rpgii | RPG II |
rpgiii | RPG III |
rpg400 | RPG/400 |
rpgiv | RPG IV |
rpmspec | RPM Spec files |
rsplus | R |
ruby | Ruby |
sas | SAS |
scala | Scala |
scheme | Scheme |
scilab | Scilab |
sdlbasic | SdlBasic |
smalltalk | Smalltalk |
smarty | Smarty |
spark | SPARK |
sparql | SPARQL |
sql | SQL |
stonescript | StoneScript (scripting language for ShiVa3D) |
systemverilog | SystemVerilog |
tcl | Tcl |
teraterm | Tera Term |
text | Plain text |
thinbasic | thinBasic |
tsql | Transact-SQL |
typoscript | TypoScript |
unicon | Unicon |
upc | Unified Parallel C |
urbi | URBI |
uscript | UnrealScript |
vala | Vala |
vb | Visual Basic (classic) |
vbnet | Visual Basic (.NET) |
vedit | VEDIT |
verilog | Verilog |
vhdl | VHDL |
vim | Vim script |
visualfoxpro | Visual FoxPro |
visualprolog | Visual Prolog |
whitespace | Whitespace |
whois | Whois |
wikitext | Help:Wikitext |
winbatch | Winbatch |
xml | XML |
xorg_conf | Xorg.conf |
yaml | YAML |
xpp | Microsoft Dynamics AX |
z80 | Zilog Z80 assembly |
zxbasic | ZXBasic (Sinclair BASIC derivative) |
Examples
JavaScript example
{{syntaxhighlight|lang=javascript|code=const elem = document.getElementById("para"); elem.style.color = "green";}}
const elem = document.getElementById("para"); elem.style.color = "green";
Necessary unescaping of source code from another page
{{syntaxhighlight|{{#invoke:DecodeEncode|decode|s={{msgnw:Template:Engvar/doc/infobox demo}}}}|lang=wikitext}}
{{infobox
| title = Personal likes
| above = Demo: using [[WP:ENGVAR|WP:Engvar]] in templates
| abovestyle = background:#ddd; font-weight:normal; font-size:smaller;
| headerstyle = background:lemonchiffon
| label1 = Home country
| data1 = {{{home country|}}}
| header2 = {{engvar|defaultWord=Favourite |defaultLang=en-GB | engvar={{{engvar|auto}}}
|en-US=Favorite }} things
| label3 = {{engvar|defaultWord=Colour |defaultLang=en-GB | engvar={{{engvar|auto}}}
|en-US=Color }}
| data3 = {{{color|}}}
| label4 = {{engvar|defaultWord=Football |defaultLang=en-GB | engvar={{{engvar|auto}}}
|en-US=Soccer |en-AU=Association Football}} team
| data4 = {{{team|}}}
| below = In this demo 'article', the template parameter is set: {{para|1=engvar|2={{{engvar|(unspecified)}}}}}
| belowstyle = background:#ddd;
}}
TemplateData
Simple wrapper around the syntaxhighlight tag to show syntax-highlighted text. Unlike syntaxhighlight, text that does not fit on the screen will be wrapped.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| code | code 1 | The code that will be displayed | Content | required |
| lang | lang 2 | The language of the code
| String | suggested |
| border | border | Set this to "no" to remove the border
| Unknown | optional |
Notes
- Sometimes, an error regarding scriptmarker exposed may occur when using these templates. If you encounter this issue, please manually highlight your code using wikitext.