@11ty/eleventy-plugin-syntaxhighlight
Advanced tools
Comparing version 3.0.6 to 3.1.0
{ | ||
"name": "@11ty/eleventy-plugin-syntaxhighlight", | ||
"version": "3.0.6", | ||
"version": "3.1.0", | ||
"description": "A pack of Eleventy plugins for syntax highlighting for Markdown and Liquid templates.", | ||
@@ -41,9 +41,9 @@ "publishConfig": { | ||
"ava": "^3.15.0", | ||
"liquidjs": "^9.19.0", | ||
"liquidjs": "^9.23.1", | ||
"markdown-it": "^12.0.4" | ||
}, | ||
"dependencies": { | ||
"jsdom": "^16.4.0", | ||
"linkedom": "^0.5.5", | ||
"prismjs": "^1.23.0" | ||
} | ||
} |
const HighlightPairedShortcode = require("./HighlightPairedShortcode"); | ||
const jsdom = require("jsdom"); | ||
const { JSDOM } = jsdom; | ||
const {parseHTML} = require("linkedom"); | ||
@@ -142,7 +141,7 @@ class IndexCounter { | ||
let highlightedContent = HighlightPairedShortcode(content, codeFormat, "", { trim: false }); | ||
let jsdoc = new JSDOM(`<html><body>${highlightedContent}</body></html>`); | ||
let { document } = jsdoc.window; | ||
let {document} = parseHTML(`<html><body>${highlightedContent}</body></html>`); | ||
let counter = new IndexCounter(); | ||
this.walkTree(document, document.body, counter); | ||
return document.body.innerHTML; | ||
let bodyEl = document.getElementsByTagName("body")[0]; | ||
this.walkTree(document, bodyEl, counter); | ||
return bodyEl.innerHTML; | ||
} | ||
@@ -149,0 +148,0 @@ } |
@@ -6,3 +6,3 @@ const test = require("ava"); | ||
let wrapper = new CharacterWrap(); | ||
t.is(wrapper.wrapContent("<html></html>", "html"), `<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><span class="charwrap" data-index="1"><</span></span><span class="charwrap" data-index="2">h</span><span class="charwrap" data-index="3">t</span><span class="charwrap" data-index="4">m</span><span class="charwrap" data-index="5">l</span></span><span class="token punctuation"><span class="charwrap" data-index="6">></span></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><span class="charwrap" data-index="7"><</span><span class="charwrap" data-index="8">/</span></span><span class="charwrap" data-index="9">h</span><span class="charwrap" data-index="10">t</span><span class="charwrap" data-index="11">m</span><span class="charwrap" data-index="12">l</span></span><span class="token punctuation"><span class="charwrap" data-index="13">></span></span></span></code></pre>`); | ||
t.is(wrapper.wrapContent("<html></html>", "html"), `<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><span data-index="1" class="charwrap"><</span></span><span data-index="2" class="charwrap">h</span><span data-index="3" class="charwrap">t</span><span data-index="4" class="charwrap">m</span><span data-index="5" class="charwrap">l</span></span><span class="token punctuation"><span data-index="6" class="charwrap">></span></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><span data-index="7" class="charwrap"><</span><span data-index="8" class="charwrap">/</span></span><span data-index="9" class="charwrap">h</span><span data-index="10" class="charwrap">t</span><span data-index="11" class="charwrap">m</span><span data-index="12" class="charwrap">l</span></span><span class="token punctuation"><span data-index="13" class="charwrap">></span></span></span></code></pre>`); | ||
}); | ||
@@ -13,3 +13,3 @@ | ||
wrapper.setClassPrefix("customprefix"); | ||
t.is(wrapper.wrapContent("<html></html>", "html"), `<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><span class="customprefix" data-index="1"><</span></span><span class="customprefix" data-index="2">h</span><span class="customprefix" data-index="3">t</span><span class="customprefix" data-index="4">m</span><span class="customprefix" data-index="5">l</span></span><span class="token punctuation"><span class="customprefix" data-index="6">></span></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><span class="customprefix" data-index="7"><</span><span class="customprefix" data-index="8">/</span></span><span class="customprefix" data-index="9">h</span><span class="customprefix" data-index="10">t</span><span class="customprefix" data-index="11">m</span><span class="customprefix" data-index="12">l</span></span><span class="token punctuation"><span class="customprefix" data-index="13">></span></span></span></code></pre>`); | ||
t.is(wrapper.wrapContent("<html></html>", "html"), `<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><span data-index="1" class="customprefix"><</span></span><span data-index="2" class="customprefix">h</span><span data-index="3" class="customprefix">t</span><span data-index="4" class="customprefix">m</span><span data-index="5" class="customprefix">l</span></span><span class="token punctuation"><span data-index="6" class="customprefix">></span></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><span data-index="7" class="customprefix"><</span><span data-index="8" class="customprefix">/</span></span><span data-index="9" class="customprefix">h</span><span data-index="10" class="customprefix">t</span><span data-index="11" class="customprefix">m</span><span data-index="12" class="customprefix">l</span></span><span class="token punctuation"><span data-index="13" class="customprefix">></span></span></span></code></pre>`); | ||
}); |
59634
996
+ Addedlinkedom@^0.5.5
+ Added@ungap/event-target@0.2.4(transitive)
+ Addedboolbase@1.0.0(transitive)
+ Addedcss-select@3.1.2(transitive)
+ Addedcss-what@4.0.0(transitive)
+ Addedhtml-escaper@3.0.3(transitive)
+ Addedhtmlparser2@6.1.0(transitive)
+ Addedlinkedom@0.5.6(transitive)
+ Addednth-check@2.1.1(transitive)
+ Addeduhyphen@0.1.0(transitive)
- Removedjsdom@^16.4.0
- Removed@tootallnate/once@1.1.2(transitive)
- Removedabab@2.0.6(transitive)
- Removedacorn@8.12.0(transitive)
- Removedacorn-globals@6.0.0(transitive)
- Removedacorn-walk@7.2.0(transitive)
- Removedagent-base@6.0.2(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedbrowser-process-hrtime@1.0.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcssom@0.3.80.4.4(transitive)
- Removedcssstyle@2.3.0(transitive)
- Removeddata-urls@2.0.0(transitive)
- Removeddecimal.js@10.4.3(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddomexception@2.0.1(transitive)
- Removedescodegen@2.1.0(transitive)
- Removedestraverse@5.3.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedform-data@3.0.1(transitive)
- Removedhtml-encoding-sniffer@2.0.1(transitive)
- Removedhttp-proxy-agent@4.0.1(transitive)
- Removedhttps-proxy-agent@5.0.1(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedis-potential-custom-element-name@1.0.1(transitive)
- Removedjsdom@16.7.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removednwsapi@2.2.10(transitive)
- Removedparse5@6.0.1(transitive)
- Removedpsl@1.9.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedquerystringify@2.2.0(transitive)
- Removedrequires-port@1.0.0(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsaxes@5.0.1(transitive)
- Removedsymbol-tree@3.2.4(transitive)
- Removedtough-cookie@4.1.4(transitive)
- Removedtr46@2.1.0(transitive)
- Removeduniversalify@0.2.0(transitive)
- Removedurl-parse@1.5.10(transitive)
- Removedw3c-hr-time@1.0.2(transitive)
- Removedw3c-xmlserializer@2.0.0(transitive)
- Removedwebidl-conversions@5.0.06.1.0(transitive)
- Removedwhatwg-encoding@1.0.5(transitive)
- Removedwhatwg-mimetype@2.3.0(transitive)
- Removedwhatwg-url@8.7.0(transitive)
- Removedws@7.5.10(transitive)
- Removedxml-name-validator@3.0.0(transitive)
- Removedxmlchars@2.2.0(transitive)