Syntax highlighting support
I have added syntax highlighting support for code blocks to Qua. The support is automatic in the sense that you do not have to do anything special other than writing a code block. All code blocks will be highlighted automatically.
There's three things you should know:
- All highlightjs languages are automatically supported (loaded on demand). This reference from highlightjs.org shows which languages are available.
- You can explicitly state the language after the
```
on the first line of your code block in case the language is not properly detected or you want to force another language. - Specifying a language of
nohighlight
will force no highlighting in the block.
Example
Here's an example of a syntax highlighted block:
# This has syntax highlighting because python is loaded by default
def action_done(self, cr, uid, ids, context=None):
logger.debug('Overridden mro_order.action_done called.')
for order in self.browse(cr, uid, ids, context=context):
self.pool.get('stock.move').action_done(
cr, uid, [x.id for x in order.parts_move_lines])
self.write(cr, uid, ids, {'state': 'done'})
return True
The above block was entered into the editor as:
``` python
# This has syntax highlighting because python is loaded by default
def action_done(self, cr, uid, ids, context=None):
logger.debug('Overridden mro_order.action_done called.')
for order in self.browse(cr, uid, ids, context=context):
self.pool.get('stock.move').action_done(
cr, uid, [x.id for x in order.parts_move_lines])
self.write(cr, uid, ids, {'state': 'done'})
return True
```