@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.

See also @scope tag section.

Syntax  

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

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

Examples  

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

@code
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

Valid XHTML 1.0 StrictGenerated by diaxen on Sun Jan 8 22:43:00 2012 using MkDoc