Code Highlighting
AutoNOTE 2 uses a Rouge highlighter to provide effective code formatting. There are two distinct versions of code highlighting:
- Inline code or keywords.
- Code snippets.
The AutoNOTE highlighter has some additional features and options, detailed in the document below.
Inline Keywords
You can highlight
keywords in a body of text using the tick symbol, for example this sentence was generated using:
Code snippets
Code snippets are generated using the highlight
command. For example:
As shown in this example, the programming language (python) is provided as an argument to ensure that the syntax highlighting is processed correctly. This yields the following result:
You should be able to see it in . This should show as undefined
Optional arguments
linenos - Line numbering
startline - Numbering start count
enddots
noselect
...3
4
5
6
7
# Start with a comment.
def HelloWorld():
message = 'Hello World'
print(message) # Prints the message 'Hello World' to the terminal
return 0
...
Referencing and Captioning Code Snippets
Like with images, you can reference a code snippet using their unique ID.
This will produce a link with the number automatically populated by AutoNOTE. For example, . Clicking on these links will scroll the page to the referenced image.
First, the code snippet must include an ID and caption argument, as follows:
You may then reference the code snippet in the text using the reference include. This is achieved using the following command, simply replace the id in the arguments with the id of the image you wish to reference:
The reference will then appear on page like this:
Coming soon
- Filename argument
Todo: Explore custom include folder.