Highlighting code syntax in the old editor
Specially formatted blocks work in both dynamic tables and pages built with the legacy editor. For information on working with diagrams in the new editor, see Formatting text.
You can no longer create pages using the old editor. However, you can easily convert any existing pages from the legacy editor to the new editor format. For more information, see Switching a page to the new editor format.
You can highlight code syntax in Wiki pages. To do this, use the markup:
%%(<сoding_language> nomark nohighlight)
source code
%%
| Parameter | Description |
|---|---|
| Coding language | Programming language for highlighting syntax |
nomark |
Optional parameter that disables line numbering |
nohighlight |
Optional parameter that disables line numbering and syntax highlighting |
Your browser's monospaced
font is used for code highlighting in Wiki by default. You can change this font in your browser settings.
Supported programming languages
List of supported programming languages
| Programming language | Parameter |
|---|---|
| 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 |
| YAML | yaml, yml |
| YQL | yql |
Examples of source code formatting
Standard formatting
%%(php)
<?
phpinfo();
$s = "Hello, World!\n";
print $s;
%%
No line numbering
%%(python nomark)
@requires_authorization
def somefunc(param1, param2):
r'''A docstring'''
if param1 > param2: # interesting
print 'Gre\'ater'
print ''
return (param2 - param1 + 1) or None
class SomeClass:
pass
%%
No syntax highlighting
%%(code nohighlight)
@requires_authorization
def somefunc(param1, param2):
r'''A docstring'''
if param1 > param2: # interesting
print 'Gre\'ater'
print ''
return (param2 - param1 + 1) or None
class SomeClass:
pass
%%
Single-line code
Single-line source code that remains single-line after formatting.
%%(css)body {display: none;}%%
Code line in Markdown style
`body {display: none;}`
Formatting comments
To add a comment to your source code and hide it from a Wiki page, use the following syntax:
%%(comments) Comment text that is not displayed on the Wiki page%%