Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
swig-highlight
Advanced tools
extension for the swig templating engine, adding highlight.js code blocks to be rendered!
extension for the swig templating engine, adding highlight.js code blocks to be rendered!
Wherever you're including require('swig')
, you'll have to include swig-highlight
as
well.
Enable it with the helper like this:
var swig = require('swig');
require('swig-highlight').apply(swig);
apply
adds the new tag into swig.
Use it barebone like this (tag name is customizable here):
var swig = require('swig'),
swig-hl = require('swig-highlight');
swig.setTag('hlcode', swig-hl.parse, swig-hl.compile, swig-hl.ends, swig-hl.block);
You can start using {% highlight %}<CODE>{% endhighlight %}
in your code.
For now you can enforce a language highlighting (list), or let highlight.js guess by omitting it.
{% highlight 'bash' %}
###### COMMENT HERE
if [ "$UID" -ne 0 ]
then
echo "Superuser rights is required"
echo 'Printing the # sign'
exit 2
fi
{% endhighlight %}
You will need to read also highlight.js usage to make your html be correctly colorized.
As an easy hint, just include (as suggested by highlight.js authors) a default css from Yandex
<link rel="stylesheet" href="http://yandex.st/highlightjs/8.0/styles/default.min.css">
Using the highlight tag with the code being a variable instead of a string does not work currently.
There is no limitation around this, just requires quite a bit of coding, so PR are welcome!
FAQs
extension for the swig templating engine, adding highlight.js code blocks to be rendered!
We found that swig-highlight demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.