Template:Syntaxhighlight
{{{1}}}
Simple wrapper around the SyntaxHighlight tag to show Syntax highlighting text. Unlike syntaxhighlight, text that does not fit on the screen will be text wrap.
Usage
[edit source]{{Syntaxhighlight|code|lang}}
- code will become the contents of the syntax highlighted block.
- Use
|lang=wikitextfor Mediawiki or Help:wikitext markup. Other supported languages are listed below. - The
<syntaxhighlight>tag used by this template is WP:EXPENSIVE, so, if used on a page with 500 or more 'expensive' parser functions, subsequent instances of this template after the 500th expensive function use on that page will always be rendered as unhighlighted<code>...</code>blocks (without syntax highlighting) instead of syntax-highlighted<syntaxhighlight>...</syntaxhighlight>blocks.
Supported languages
[edit source]| Code | Language |
|---|---|
4cs |
4CS |
6502acme |
MOS Technology 6502 (6510) ACME Cross Assembler |
6502kickass |
MOS Technology 6502 (6510) Kick Assembler |
6502tasm |
MOS Technology 6502 (6510) TASM/64TASS |
68000devpac |
Motorola 68000 HiSoft Devpac ST 2 Assembler |
abap |
ABAP |
actionscript |
ActionScript |
actionscript3 |
ActionScript3 |
ada |
Ada (programming language) |
algol68 |
ALGOL 68 |
apache |
Apache HTTP Server |
applescript |
AppleScript |
apt_sources |
Advanced Packaging Tool |
arm |
ARM architecture family Assembler |
asm |
Assembly language |
asp |
Active Server Pages (ASP) |
asymptote |
Asymptote (vector graphics language) |
autoconf |
Autoconf |
autohotkey |
AutoHotkey |
autoit |
AutoIt |
avisynth |
AviSynth |
awk |
AWK |
bascomavr |
BASCOM AVR |
bash |
Bash (Unix shell) |
basic4gl |
Basic4GL |
bf |
Brainfuck |
bibtex |
BibTeX |
blitzbasic |
Blitz BASIC |
bnf |
Backus–Naur form |
boo |
Boo (programming language) |
c |
C (programming language) |
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 |
Qt (software) |
csharp |
C Sharp (programming language) |
css |
Cascading Style Sheets (CSS) |
cuesheet |
Cue sheet (computing) |
d |
D (programming language) |
dcl |
DIGITAL Command Language |
dcpu16 |
DCPU-16 |
dcs |
Data Conversion System |
delphi |
Delphi (software) |
diff |
Diff |
div |
DIV |
dos |
DOS batch file |
dot |
DOT (graph description language) |
e |
E (programming language) |
ecmascript |
ECMAScript |
eiffel |
Eiffel (programming language) |
email |
Email (mbox \ eml \ RFC format) |
epc |
Enerscript |
erlang |
Erlang (programming language) |
euphoria |
Euphoria (programming language) |
f1 |
Formula One |
fo |
FO |
fortran |
Fortran |
freebasic |
FreeBASIC |
freeswitch |
FreeSWITCH |
fsharp |
Fsharp |
gambas |
Gambas programming language |
gdb |
GDB |
genero |
Genero |
genie |
Genie |
gettext |
gettext |
glsl |
GLSL |
gml |
Game Maker Language |
gnuplot |
gnuplot |
go |
Go (programming language) |
groovy |
Groovy (programming language) |
gwbasic |
GW-BASIC |
haskell |
Haskell |
haxe |
Haxe |
hicest |
HicEst |
hq9plus |
HQ9+ |
html |
HTML |
icon |
Icon (programming language) |
idl |
Universal Network Objects |
ini |
INI file |
inno |
Inno Setup |
intercal |
INTERCAL |
io |
Io (programming language) |
j |
J (programming language) |
java |
Java (programming language) |
java5 |
Java (programming language) |
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 (programming language) |
llvm |
LLVM |
locobasic |
Locomotive BASIC |
logtalk |
Logtalk |
lolcode |
LOLCODE |
lotusformulas |
Formula language |
lotusscript |
LotusScript |
lscript |
LScript |
lsl2 |
Linden Scripting Language |
lua |
Lua (programming language) |
magiksf |
Magik (programming language) |
m68k |
Motorola 68000 |
make |
Make (software) |
mapbasic |
MapBasic |
matlab |
MATLAB |
mirc |
mIRC scripting language |
mmix |
MMIX |
modula2 |
Modula-2 |
modula3 |
Modula-3 |
mpasm |
PIC microcontroller |
mxml |
MXML |
mysql |
MySQL |
nagios |
Nagios |
netrexx |
NetRexx |
newlisp |
NewLISP |
nsis |
Nullsoft Scriptable Install System (NSIS) |
oberon2 |
Oberon-2 |
objc |
Objective-C |
objeck |
Objeck (programming language) |
ocaml |
OCaml |
ocaml-brief |
OCaml |
ocl |
Operational Control Language |
octave |
GNU Octave |
oobas |
OpenOffice Basic |
oorexx |
Object REXX |
oracle11 |
PL/SQL |
oracle8 |
PL/SQL |
oxygene |
Oxygene (programming language) |
oz |
Oz (programming language) |
parasail |
ParaSail (programming language) |
parigp |
PARI/GP |
pascal |
Pascal (programming language) |
pcre |
Perl Compatible Regular Expressions |
per |
per |
perl |
Perl |
perl6 |
Raku (programming language) |
pf |
PF (firewall) |
php |
PHP |
php-brief |
PHP |
pic16 |
PIC microcontroller |
pike |
Pike (programming language) |
pixelbender |
Adobe Pixel Bender |
pli |
PL/I |
plsql |
PL/SQL |
postgresql |
PostgreSQL |
povray |
POV-Ray |
powerbuilder |
PowerBuilder |
powershell |
PowerShell |
proftpd |
ProFTPD |
progress |
OpenEdge Advanced Business Language |
prolog |
Prolog |
properties |
.properties |
providex |
ProvideX |
purebasic |
PureBasic |
pycon |
Python (programming language) |
pys60 |
Python for S60 |
python |
Python (programming language) |
q |
Q (equational programming language) |
qbasic |
QBasic |
ragel |
Ragel |
rails |
Ruby on Rails |
rebol |
Rebol |
reg |
Windows Registry |
rexx |
Rexx |
robots |
Robots exclusion standard |
rpg |
IBM RPG |
rpgii |
IBM RPG II |
rpgiii |
IBM RPG III |
rpg400 |
IBM RPG |
rpgiv |
IBM RPG |
rpmspec |
RPM Package Manager |
rsplus |
R (programming language) |
ruby |
Ruby (programming language) |
sas |
SAS (software) |
scala |
Scala_(programming_language) |
scheme |
Scheme (programming language) |
scilab |
Scilab |
sdlbasic |
SdlBasic |
smalltalk |
Smalltalk |
smarty |
Smarty (template engine) |
spark |
SPARK (programming language) |
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 |
TYPO3 |
unicon |
Unicon (programming language) |
upc |
Unified Parallel C |
urbi |
URBI |
uscript |
UnrealScript |
vala |
Vala (programming language) |
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 (programming language) |
whois |
Whois |
wikitext |
Help:Wikitext |
winbatch |
Winbatch |
xml |
XML |
xorg_conf |
Xorg.conf |
yaml |
YAML |
xpp |
Microsoft Dynamics AX |
z80 |
Zilog Z80 Assembler |
zxbasic |
ZXBasic |
Examples
[edit source]Inline code
[edit source]{{syntaxhighlight|lang=javascript|code=mw.util.addPortletLink('p-personal', '/w/index.php?title=Special:MyPage/Sandbox&action=edit&preload=Template%3AUser_sandbox%2Fpreload&editintro=Template%3AUser_sandbox', 'My sandbox', 'pt-mysandbox', 'Go to my sandbox');}}
mw.util.addPortletLink('p-personal', '/w/index.php?title=Special:MyPage/Sandbox&action=edit&preload=Template%3AUser_sandbox%2Fpreload&editintro=Template%3AUser_sandbox', 'My sandbox', 'pt-mysandbox', 'Go to my sandbox');
Necessary unescaping of source code from another page
[edit source]{{syntaxhighlight|{{#invoke:DecodeEncode|decode|s={{msgnw:Template:Engvar/doc/infobox demo}}}}|lang=wikitext}}
[[:Template:Engvar/doc/infobox demo]]
TemplateData
[edit source]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 |
Category:Text-specific formatting and function templates