Macros
Rock Chisel ships with useful Jinja2 macros that insert HTML elements that are otherwise annoying to hand code or remember how they work. Using Macros is 100% optional - if you would rather include the HTML equivalents, you can.
These macros are defined in macros.j2, which is a file you can override inside a theme, or inside an individual documentation project, you may wish to create a file called 'user_macros.j2' to define your own additional macros.
begin_code and end_code #
This starts a Prism.js block for syntax highlighting. You can pass in any language name that Prism.js supports. An example, itself drawn with Prism.js:{{ begin_code(language="python") }}
#!/usr/bin/python
print("hello world!")
{{ end_code() }}
#!/usr/bin/python
print("hello world!")
doc #
Generates internal documentation links. You don't really need to use this, as anchor tags work fine, but could be a nice way to add some extra styling in a modified theme.
- {{ doc("building") }}
- {{ doc("community", "The Community Chapter") }}
It renders as you might expect:
link #
{{ begin_code(language='python') }}
{{ link('http://google.com', 'Google') }}
{{ end_code() }}
begin_info_block & end_info_block
{{ begin_info_block() }}
Don't forget to press the button every 108 seconds.
{{ end_info_block() }}
Don't forget to press the button every 108 seconds.
begin_warn_block and end_warn_block #
{{ begin_warn_block() }}
I am the Bad Wolf. I create myself. I take the words. I scatter them ... in time, and space
{{ end_info_block() }}
I am the Bad Wolf. I create myself. I take the words. I scatter them ... in time, and space
quiz #
{{ quiz(
id="quiz1",
question="What is the average airspeed velocity of an unladen swallow?",
a="7.2 meters per second",
b="32 cubits per metric ton",
c="is that an african or european swallow?",
d="I don't know that",
answer="c",
if_correct="Impressive. You may cross.",
if_incorrect="I'm sorry."
) }}
What is the average airspeed velocity of an unladen swallow?