@code tag

These tags insert a piece of code which must be ended by an @end code tag.

The following optional flags are available:

  • C : Use C/C++ syntax coloring (default).

  • M : Use mkdoc syntax coloring, @ is escape character.

  • R : Don't use syntax coloring.

  • N : Show line numbers.

  • L : Do not insert links for known C/C++ identifiers.

An additional C++ scope name may be specified for identifiers lookup. The current code scope or global scope for plain documentation is used by default.

The @example tag can be used to insert code from an external file.

When C coloring is used, @/ and @* are available in order to escape nested comments.

See also @scope tag.


@code <some verbatim text on one line> @end code

@code [<flags>] [{<scope>}]
<some verbatim text spanning multiple lines>
@end code


Insertion of C code, reference to bar function will be clickable if the identifier has documentation:

int foo()
return bar() + 42;
@end code

Insertion of shell command invocation, no coloring used:

@code R
$ cd src
$ ls
foo.c foo.h
@end code

Insertion of C++ code, lookup from Foo::Bar scope for identifiers coloring:

@code {Foo::Bar}
return foo(a, b, c) + bar();
@end code

Insertion of code with a nested comment:

@code C
while (!quit())
/@* action *@/ ;
@end code
int quit();

Valid XHTML 1.0 StrictGenerated by diaxen on Sat Apr 30 17:58:47 2016 using MkDoc