This plug-in provides syntax highlighting for Qgoda.
You can also use this plug-in without Qgoda.
This Qgoda plug-in for the Template Toolkit allows you to create code blocks that can be syntax-highlighted in the browser. It works perfectly with PrismJS but other libraries that follow the recommendation for code blocks in HTML are equally supported.
The filter wraps its content into an HTML "code" element that in turn is wrapped into an HTML "pre". The above example from the synopsis would result in the following HTML:
All positional arguments (those without an equals sign) to the filter are accumulated in the class attribute of the "pre" element. All named arguments (those with an equals sign) are converted into other attributes.
Leading and trailing whitespace around the source snippet is stripped off and discarded.
Important! If you are using Text::Markup::Hoedownas your markdown processor, you can alternatively use fenced codeblocks:
Installation and Update
Like all Qgoda plug-ins, there is no need to install from CPAN (although you can).
With Node.JS Package Manager
Check that your Qgoda project directory contains a file
not, create one with either
npm init or
With NPM, you install the plug-in and update it to the latest version like this:
$ npm install --save-dev gflohr/qgoda-tt2-plugin-highlight $ npm update gflohr/qgoda-tt2-plugin-hightlight
With Yarn, you install the plug-in and update it to the latest version like this:
$ yarn add gflohr/qgoda-tt2-plugin-highlight $ npm upgrade gflohr/qgoda-plugin-tt2-hightlight
Either way, it will be recognized as a plug-in, the next time you start Qgoda.
From Version Control
You can also install the plug-in directly from git.
$ cd /path/to/your/qgoda/project $ test -e _plugins || mkdir _plugins $ git clone https://github.com/gflohr/qgoda-tt2-plugin-highlight
This will download the latest version into the directory
it will be recognized as a plug-in, the next time you start
You can also install from CPAN, if you can't help. One of the following two options should work:
$ sudo cpanm Qgoda::TT2::Plugin::Highlight
cpanm comes with App-cpanminus.
$ sudo cpan install Qgoda::TT2::Plugin::Highlight
Copyright (C) 2018 Guido Flohr firstname.lastname@example.org, all rights reserved.
This library is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What the Fuck You Want to Public License, Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.