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

edit

{{Syntaxhighlight|code|lang}}

  • code will become the contents of the syntax highlighted block.
  • lang is the language used for syntax highlighting. Use |lang=wikitext for 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

edit
CodeLanguage
4cs4CS
6502acmeMOS 6502 (6510) ACME Cross Assembler
6502kickassMOS 6502 (6510) Kick Assembler
6502tasmMOS 6502 (6510) TASM/64TASS
68000devpacMotorola 68000 HiSoft Devpac ST 2 assembly
abapABAP
actionscriptActionScript
actionscript3ActionScript3
adaAda
algol68ALGOL 68
apacheApache configuration
applescriptAppleScript
apt_sourcesAPT sources
armARM assembly
asmAssembly
aspActive Server Pages (ASP)
asymptoteAsymptote
autoconfAutoconf
autohotkeyAutoHotkey
autoitAutoIt
avisynthAviSynth
awkAWK
bascomavrBASCOM AVR
bashBash
basic4glBasic4GL
bfBrainfuck
bibtexBibTeX
blitzbasicBlitz BASIC
bnfBackus–Naur form
booBoo
cC
c_loadrunnerC Loadrunner
c_macC (Mac)
caddclAutoCAD Dialog Control Language (DCL)
cadlispAutoLISP
cfdgCFDG
cfmColdFusion Markup Language
chaiscriptChaiScript
cilCommon Intermediate Language (CIL)
clojureClojure
clpControl Language Program
cmakeCMake
cobolCOBOL
coffeescriptCoffeeScript
cppC++
cpp-qtC++ (Qt toolkit)
csharpC#
cssCascading Style Sheets (CSS)
cuesheetCue sheet
dD
dclDIGITAL Command Language
dcpu16DCPU-16
dcsData Conversion System
delphiDelphi
diffDiff
divDIV
dosDOS batch file
dotDOT
eE
ecmascriptECMAScript
eiffelEiffel
emailEmail (mbox \ eml \ RFC format)
epcEnerscript
erlangErlang
euphoriaEuphoria
f1Formula One
foFO
fortranFortran
freebasicFreeBASIC
freeswitchFreeSWITCH
fsharpFsharp
gambasGambas
gdbGDB
generoGenero
genieGenie
gettextgettext
glslOpenGL Shading Language (GLSL)
gmlGame Maker Language (GML)
gnuplotgnuplot
goGo
groovyGroovy
gwbasicGW-BASIC
haskellHaskell
haxeHaxe
hicestHicEst
hq9plusHQ9+
htmlHTML
iconIcon
idlUno IDL
iniINI
innoInno
intercalINTERCAL
ioIo
jJ
javaJava
java5Java(TM) 2 Platform Standard Edition 5.0
javascriptJavaScript
jclJob Control Language
kixtartKiXtart
klonecKlone C
klonecppKlone C++
latexLaTeX
lbLiberty BASIC
ldifLDAP Data Interchange Format
lispLisp
llvmLLVM
locobasicLocomotive BASIC
logtalkLogtalk
lolcodeLOLCODE
lotusformulasFormula language
lotusscriptLotusScript
lscriptLightWave 3D
lsl2Linden Scripting Language
luaLua
magiksfMagik
m68kMotorola 68000 assembly
makemake
mapbasicMapBasic
matlabMATLAB M
mircmIRC scripting language
mmixMMIX
modula2Modula-2
modula3Modula-3
mpasmMicrochip assembly
mxmlMXML
mysqlMySQL
nagiosNagios
netrexxNetRexx
newlispNewLISP
nsisNullsoft Scriptable Install System (NSIS)
oberon2Oberon-2
objcObjective-C
objeckObjeck
ocamlOCaml
ocaml-briefOCaml
oclOperational Control Language
octaveOctave
oobasOpenOffice Basic
oorexxObject REXX
oracle11Oracle 11 SQL
oracle8Oracle 8 SQL
oxygeneOxygene
ozOz
parasailParaSail
parigpPARI/GP
pascalPascal
pcrePerl Compatible Regular Expressions
perper
perlPerl
perl6Raku
pfPF
phpPHP
php-briefPHP
pic16PIC assembly
pikePike
pixelbenderPixel Bender
pliPL/I
plsqlPL/SQL
postgresqlPostgreSQL
povrayPersistence of Vision Raytracer
powerbuilderPowerBuilder
powershellPowerShell
proftpdProFTPD
progressOpenEdge Advanced Business Language
prologProlog
propertiesProperties file
providexProvideX
purebasicPureBasic
pyconPython
pys60PyS60
pythonPython
qQ
qbasicQBasic–QuickBASIC
ragelRagel
railsRails
rebolRebol
regWindows Registry
rexxRexx
robotsrobots.txt
rpgRPG
rpgiiRPG II
rpgiiiRPG III
rpg400RPG/400
rpgivRPG IV
rpmspecRPM Spec files
rsplusR
rubyRuby
sasSAS
scalaScala
schemeScheme
scilabScilab
sdlbasicSdlBasic
smalltalkSmalltalk
smartySmarty
sparkSPARK
sparqlSPARQL
sqlSQL
stonescriptStoneScript (scripting language for ShiVa3D)
systemverilogSystemVerilog
tclTcl
teratermTera Term
textPlain text
thinbasicthinBasic
tsqlTransact-SQL
typoscriptTypoScript
uniconUnicon
upcUnified Parallel C
urbiURBI
uscriptUnrealScript
valaVala
vbVisual Basic (classic)
vbnetVisual Basic (.NET)
veditVEDIT
verilogVerilog
vhdlVHDL
vimVim script
visualfoxproVisual FoxPro
visualprologVisual Prolog
whitespaceWhitespace
whoisWhois
wikitextHelp:Wikitext
winbatchWinbatch
xmlXML
xorg_confXorg.conf
yamlYAML
xppMicrosoft Dynamics AX
z80Zilog Z80 assembly
zxbasicZXBasic (Sinclair BASIC derivative)

Examples

edit

JavaScript example

edit

{{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

edit
{{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

edit

Simple wrapper around the syntaxhighlight tag to show syntax-highlighted text. Unlike syntaxhighlight, text that does not fit on the screen will be wrapped.

Template parameters

ParameterDescriptionTypeStatus
codecode 1

The code that will be displayed

Contentrequired
langlang 2

The language of the code

Default
text
Stringsuggested
borderborder

Set this to "no" to remove the border

Auto value
no
Unknownoptional

Notes

edit

See also

edit