模板:Syntaxhighlight/doc

用法

<syntaxhighlight>...</syntaxhighlight>包裹需要語法高亮的文本(syntax-highlighted text)與<syntaxhighlight>之不同,支持文本的折行(wrapped)顯示。

參數

  • lang:
代碼 語言
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 Assembler
abap ABAP
actionscript ActionScript
actionscript3 ActionScript3
ada Ada
algol68 ALGOL 68
apache Apache configuration
applescript AppleScript
apt_sources APT sources
arm ARM Assembler
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英語Basic4GL
bf Brainfuck
bibtex BibTeX
blitzbasic Blitz BASIC英語Blitz BASIC
bnf 巴科斯範式
boo Boo
c C
c_loadrunner C Loadrunner
c_mac C (Mac)
caddcl AutoCAD DCL英語Dialog Control Language
cadlisp AutoLISP
cfdg CFDG
cfm ColdFusion Markup Language英語ColdFusion Markup Language
chaiscript ChaiScript英語ChaiScript
cil Common Intermediate Language (CIL)
clojure Clojure
clp Control Language Program英語IBM i Control Language
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英語DIGITAL Command Language
dcpu16 0x10c
dcs Data Conversion System
delphi Delphi
diff Diff
div DIV
dos 批次檔
dot DOT
e E英語E (programming language)
ecmascript ECMAScript
eiffel Eiffel
email Email (mbox \ eml \ RFC format)
epc Enerscript
erlang Erlang
euphoria Euphoria英語Euphoria (programming language)
f1 Formula One
falcon Falcon
fo FO
fortran Fortran
freebasic FreeBASIC
freeswitch FreeSWITCH
fsharp F♯
gambas Gambas
gdb GNU偵錯器
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+
html4strict HTML
html5 HTML5
icon Icon英語Icon (programming language)
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英語Job Control Language
kixtart KiXtart
klonec Klone C
klonecpp Klone C++
latex LaTeX
lb Liberty BASIC英語Liberty BASIC
ldif LDAP Data Interchange Format英語LDAP Data Interchange Format
lisp Lisp
llvm LLVM
locobasic Locomotive BASIC英語Locomotive BASIC
logtalk Logtalk英語Logtalk
lolcode LOLCODE
lotusformulas Formula language英語Formula language
lotusscript LotusScript英語LotusScript
lscript LightWave 3D英語LScript
lsl2 Linden Scripting Language英語Linden Scripting Language
lua Lua
magiksf Magik英語Magik (programming language)
m68k Motorola 68000 Assembler
make make
mapbasic MapBasic英語MapBasic
matlab MATLAB M
moin Wikitext/MediaWiki[1]
mirc mIRC scripting language英語mIRC scripting language
mmix MMIX英語MMIX
modula2 Modula-2
modula3 Modula-3
mpasm Microchip Assembler
mxml MXML
mysql MySQL
nagios Nagios
netrexx NetRexx英語NetRexx
newlisp newLISP
nsis Nullsoft Scriptable Install System (NSIS)
oberon2 Oberon-2英語Oberon-2 (programming language)
objc Objective-C
objeck Objeck英語Objeck (programming language)
ocaml OCaml
ocaml-brief OCaml
ocl Operational Control Language英語Operational Control Language
octave Octave
oobas OpenOffice.org Basic英語StarOffice Basic
oorexx Object REXX英語Object REXX
oracle11 Oracle 11 SQL
oracle8 Oracle 8 SQL
oxygene Oxygene英語Oxygene (programming language)
oz Oz
parasail ParaSail英語ParaSail (programming language)
parigp PARI/GP英語PARI/GP
pascal Pascal
pcre Perl Compatible Regular Expressions英語Perl Compatible Regular Expressions
per per
perl Perl
perl6 Perl 6
pf PF英語PF (firewall)
php PHP
php-brief PHP
pic16 PIC匯編語言
pike Pike
pixelbender Pixel Bender英語Adobe Pixel Bender
pli PL/I
plsql PL-SQL
postgresql PostgreSQL
povray Persistence of Vision Raytracer
powerbuilder Powerbuilder
powershell Windows PowerShell
proftpd ProFTPd
progress OpenEdge Advanced Business Language英語OpenEdge Advanced Business Language
prolog Prolog
properties Properties file
providex ProvideX英語ProvideX
purebasic PureBasic
pycon Python
pys60 PyS60英語Python for S60
python Python
q Q英語Q (equational programming language)
qbasic QBasic/QuickBASIC
rails Rails
rebol REBOL
reg 註冊表
rexx REXX
robots robots.txt
rpg RPG英語IBM RPG
rpgii RPG II英語IBM RPG II
rpgiii RPG III英語IBM RPG III
rpg400 RPG/400英語IBM RPG
rpgiv RPG IV英語IBM RPG
rpmspec RPM Spec files
rsplus R
ruby Ruby
sas SAS
scala Scala
scheme Scheme
scilab Scilab
sdlbasic SdlBasic英語SdlBasic
smalltalk Smalltalk
smarty Smarty
spark SPARK
sparql SPARQL
sql SQL
stonescript StoneScript (Scripting language for ShiVa3D英語ShiVa)
systemverilog SystemVerilog
tcl Tcl
teraterm Tera Term
text Plain text英語Plain text
thinbasic thinBasic英語thinBasic
tsql Transact-SQL
typoscript TypoScript
unicon Unicon英語Unicon (programming language)
upc Unified Parallel C
urbi URBI英語URBI
uscript 虛幻引擎
vala Vala
vb Visual Basic
vbnet Visual Basic .NET
vedit VEDIT英語VEDIT
verilog Verilog
vhdl VHDL
vim Vim
visualfoxpro Visual FoxPro
visualprolog Visual Prolog
whitespace Whitespace
whois WHOIS
winbatch Winbatch英語Winbatch
xml XML
xorg_conf Xorg.conf英語Xorg.conf
yaml YAML
xpp Microsoft Dynamics AX英語Microsoft Dynamics AX
z80 ZiLOG Z80 Assembler
zxbasic ZXBasic
  • code:需要語法高亮顯示的內容。

例子

{{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');

參見

註釋

  1. ^ Pygments沒有提供"wikitext"或"mediawiki"語法解析(見phab:T29828)。請使用"html+handlebars"或"moin"替代。