Preformatted code starts with a space or a tab. The code will be syntax highlighted according to the current Source Mode:
#include <iostream> int main() { // Sample code std::cout << "Hello, World\n"; return 0; }
import cgi def cookForHtml(text): '''"Cooks" the input text for HTML.''' return cgi.escape(text)
Macros that are already defined are expanded in source code. Example:
[def __array__ [@http://www.boost.org/doc/html/array/reference.html array]] [def __boost__ [@http://www.boost.org/libs/libraries.htm boost]] using __boost__::__array__;
Generates:
using boost::array;
In quickbook 1.7 and later, you can include callouts in code blocks, like so:
[!c++] std::string foo_bar() /*< The /Mythical/ FooBar. See [@http://en.wikipedia.org/wiki/Foobar Foobar for details] >*/ { return "foo-bar"; /*< return 'em, foo-bar man! >*/ }
Which will generate:
std::string foo_bar() { return "foo-bar"; }
The Mythical FooBar. See Foobar for details |
|
return 'em, foo-bar man! |