From 53be570c160390d3695158b12582ee108db7a2d6 Mon Sep 17 00:00:00 2001 From: Robert McGovern Date: Fri, 3 Feb 2023 02:32:52 +0000 Subject: [PATCH] Added .liquid file/tags support --- .eleventy.js | 4 +-- README.md | 5 ++++ demo/test-liquid.liquid | 58 +++++++++++++++++++-------------------- src/LiquidHighlightTag.js | 16 ++--------- 4 files changed, 39 insertions(+), 44 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index 3af4272..40f4b98 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -21,9 +21,9 @@ module.exports = { theme: "onedark", lineNumbers: false, /* lineNumbersStyle: "table",*/ /* "table" or "inline" */ - alwaysWrapLineHighlights: false, + //alwaysWrapLineHighlights: false, // eligible to change the default to \n in a new major version. - lineSeparator: "
", + //lineSeparator: "
", preAttributes: {}, codeAttributes: { theme: "onedark", diff --git a/README.md b/README.md index 3155750..42aa620 100644 --- a/README.md +++ b/README.md @@ -41,3 +41,8 @@ Theme can be set to one of these [themes](https://xyproto.github.io/splash/docs/ - `lineNumbers` will add line numbers starting from 1 for each code block. - `lineNumbersStyle` if `table` is used, then code block will use a table to make it easier to drag and select the code. + +## TO DO + +- [✅] Support `.liquid` files +- [] Add passed in `code` and `pre` atributes into returned html from chroma diff --git a/demo/test-liquid.liquid b/demo/test-liquid.liquid index db39646..f0d8660 100644 --- a/demo/test-liquid.liquid +++ b/demo/test-liquid.liquid @@ -5,65 +5,65 @@ - + - Just JS -{% highlight js %} -function myFunction() { - return true; -} -{% endhighlight %} + Just JS + {% highlight js %} + function myFunction() { + return true; + } + {% endhighlight %} -Just JS multiline + Just JS multiline {% highlight js %} let multilineString = ` - this is the first line - this is the middle line - this is the last line +this is the first line +this is the middle line +this is the last line `; {% endhighlight %} -JS + Linehighlight + JS + Linehighlight {% highlight js 1,3 %} let multilineString = ` - this is the first line - this is the middle line - this is the last line +this is the first line +this is the middle line +this is the last line `; {% endhighlight %} -Swift + show lineNumbers + Swift + show lineNumbers {% highlight swift lineNumbers %} let multilineString = ` - this is the first line - this is the middle line - this is the last line +this is the first line +this is the middle line +this is the last line `; {% endhighlight %} -Swift + show lineNumbers + highlight 1 & 3 + Swift + show lineNumbers + highlight 1 & 3 {% highlight swift lineNumbers 1,3 %} let multilineString = ` - this is the first line - this is the middle line - this is the last line +this is the first line +this is the middle line +this is the last line `; {% endhighlight %} -Swift + show lineNumbers + highlight 1 & 3 + Swift + show lineNumbers + highlight 1 & 3 -{% highlight swift lineNumbers 1,3 table %} +{% highlight swift lineNumbers 2:3 table %} let multilineString = ` - this is the first line - this is the middle line - this is the last line +this is the first line +this is the middle line +this is the last line `; {% endhighlight %} - + \ No newline at end of file diff --git a/src/LiquidHighlightTag.js b/src/LiquidHighlightTag.js index 10f364d..e782ee9 100644 --- a/src/LiquidHighlightTag.js +++ b/src/LiquidHighlightTag.js @@ -12,13 +12,7 @@ class LiquidHighlightTag { let ret = function (highlighter) { return { parse: function (tagToken, remainTokens) { - console.log(">>LIQIUD"); - console.log(tagToken.args); - console.log("<