Socket
Socket
Sign inDemoInstall

@11ty/eleventy-plugin-syntaxhighlight

Package Overview
Dependencies
356
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

6

package.json
{
"name": "@11ty/eleventy-plugin-syntaxhighlight",
"version": "1.0.0",
"version": "1.0.1",
"description": "A pack of Eleventy plugins for syntax highlighting using the Liquid templating engine.",

@@ -30,5 +30,5 @@ "main": ".eleventy.js",

"dependencies": {
"@11ty/eleventy": "^0.2.13",
"prismjs": "^1.10.0"
"@11ty/eleventy": "^0.2.15",
"prismjs": "^1.13.0"
}
}
# eleventy-plugin-syntaxhighlight
A pack of Eleventy plugins for syntax highlighting using the Liquid templating engine.
A pack of [Eleventy](https://github.com/11ty/eleventy) plugins for syntax highlighting using the Liquid templating engine. No runtime JavaScript here, these highlight transformations are all done at build-time.
## Installation
Available on [npm](https://www.npmjs.com/package/@11ty/eleventy-plugin-syntaxhighlight).
```
npm install @11ty/eleventy-plugin-syntaxhighlight --save
```
Open up your Eleventy config file (probably `.eleventy.js`) and use `addPlugin`:
```
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(syntaxHighlight);
};
```
If you use the Prism version, you are responsible for including [your favorite theme CSS](https://github.com/PrismJS/prism-themes)!
[Read more about Eleventy plugins.](https://github.com/11ty/eleventy/blob/master/docs/plugins.md)
## Usage
### Supplies: Two Liquid Tags
* `{% highlight %}`: syntax highlights a block of code using PrismJS.
* `{% highlight-plain %}`: adds `<pre><code>` around a block of code and offers the line-highlighting feature set as `highlight`.
### Prism Syntax Highlighter
* [List of supported PrismJS languages](http://prismjs.com/#languages-list)
```

@@ -10,0 +38,0 @@ {% highlight js %}

@@ -8,2 +8,5 @@ const Prism = require('prismjs');

highlight.addHook(function(language, htmlStr, lines) {
if (! Prism.languages[ language ]) {
require(`prismjs/components/prism-${language}`);
}
return Prism.highlight(htmlStr, Prism.languages[ language ]);

@@ -13,2 +16,2 @@ });

return highlight.getObject();
};
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc