Formatting source code

General format for inserting source code in wiki markup:

%%(programmingLanguage) source code%%

Example:

Markup Result
%%(php)
<?
phpinfo();
$s = "Hello, World!\n";
print $s;
%%

You can configure the look of a block containing code:

  • Disable line numbering. To do this, add the nomark parameter after specifying the programming language:

    Markup Result
    %%(php nomark)
    <?
    phpinfo();
    $s = "Hello, World!\n";
    print $s;
    %%
  • Disable line numbering and syntax highlighting. To do this, omit the programming language:

    Markup Result
    %%
    <?
    phpinfo();
    $s = "Hello, World!\n";
    print $s;
    %%
Supported programming languages
Language Notation in the markup
1C
1с, 1c
ActionScript
actionscript
Apache
apache
Applescript
applescript
Bash
bash, sh
C#
c#, csharp, c-sharp
C++
c, cpp, c++
Closure
closure
CMake
cmake
Coffeescript
coffeescript
CSP
csp
CSS
css
D
d
Delphi
delphi
Diff
diff
DOS .bat
bat, dos
Django
django
Dockerfile
dockerfile
Erlang
erlang
Erlang-repl
erlang-repl
Go
go
Haskell
haskell
HTTP
http
Ini
ini
JSON
json
Java
java
JavaScript
js, javascript
Lisp
lisp
Matlab
matlab
Nginx
nginx
ObjectiveC
objc, objectivec,
obj-c, objective-c
PHP
php
Perl
perl
Python
py, python
Python profile
profile, profiler,
python-profile, python-profiler
R
r
Ruby
ruby
Rust
rust
Scala
scala
Smalltalk
smalltalk
SQL
mysql, sql
Swift
swift
TeX
tex
VBScript
vbscript
XML
xml
YQL
yql