Socket
Socket
Sign inDemoInstall

@11ty/eleventy-plugin-syntaxhighlight

Package Overview
Dependencies
298
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.4 to 3.0.5

test/LiquidHighlightTagTest.js

9

package.json
{
"name": "@11ty/eleventy-plugin-syntaxhighlight",
"version": "3.0.4",
"version": "3.0.5",
"description": "A pack of Eleventy plugins for syntax highlighting for Markdown and Liquid templates.",

@@ -40,9 +40,10 @@ "publishConfig": {

"devDependencies": {
"@11ty/eleventy": "^0.11.0",
"ava": "^3.13.0"
"ava": "^3.15.0",
"liquidjs": "^9.19.0",
"markdown-it": "^12.0.4"
},
"dependencies": {
"jsdom": "^16.4.0",
"prismjs": "^1.21.0"
"prismjs": "^1.23.0"
}
}

@@ -9,38 +9,35 @@ const HighlightPairedShortcode = require("./HighlightPairedShortcode");

getObject(options = {}) {
let ret = function(highlighter) {
return {
parse: function(tagToken, remainTokens) {
let split = tagToken.args.split(" ");
return {
parse: function(tagToken, remainTokens) {
let split = tagToken.args.split(" ");
this.language = split.shift();
this.highlightLines = split.join(" ");
this.language = split.shift();
this.highlightLines = split.join(" ");
this.tokens = [];
this.tokens = [];
var stream = highlighter.liquidEngine.parser.parseStream(remainTokens);
var stream = this.liquid.parser.parseStream(remainTokens);
stream
.on("token", token => {
if (token.name === "endhighlight") {
stream.stop();
} else {
this.tokens.push(token);
}
})
.on("end", x => {
throw new Error("tag highlight not closed");
});
stream
.on("token", token => {
if (token.name === "endhighlight") {
stream.stop();
} else {
this.tokens.push(token);
}
})
.on("end", x => {
throw new Error(`tag ${tagToken.getText()} not closed`);
});
stream.start();
},
render: function(scope, hash) {
let tokens = this.tokens.map(token => token.raw);
let tokenStr = tokens.join("").trim();
return Promise.resolve(HighlightPairedShortcode(tokenStr, this.language, this.highlightLines, options));
}
};
stream.start();
},
render: function(scope, hash) {
let tokens = this.tokens.map(token => {
return token.raw || token.getText();
});
let tokenStr = tokens.join("").trim();
return Promise.resolve(HighlightPairedShortcode(tokenStr, this.language, this.highlightLines, options));
}
};
return ret(this);
}

@@ -47,0 +44,0 @@ }

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