Refactors Liquid syntax highlighters to add line highlights.
Usage (ranges are space separated):
{% highlight js 1,4-6 %}
One range
Adds `highlight-line-active` to lines 1,4,5,6
{% highlight js 3-4 -1 %}
Two ranges (add/remove), remove is N/A
Adds `highlight-line-add` to lines 3,4
{% highlight js -1 3-4 %}
Two ranges (add/remove), add is N/A
Adds `highlight-line-remove` to lines 3,4
{% highlight js 3-4 5,8-10 %}
Two ranges, both are used
Adds `highlight-line-add` to lines 3-4
Adds `highlight-line-remove` to lines 5,8,9,10
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const { DateTime } = require("luxon");
|
||||
const liquidjsSyntaxHighlighter = require("./_src/eleventy-liquidjs-tag-highlight-prismjs");
|
||||
const highlighters = require("./_src/eleventy-liquidjs-tag-highlight");
|
||||
|
||||
function dateToISO(dateObj) {
|
||||
return DateTime.fromJSDate(dateObj).toISO({ includeOffset: true, suppressMilliseconds: true });
|
||||
@@ -25,7 +25,7 @@ module.exports = function(eleventyConfig) {
|
||||
});
|
||||
|
||||
// compatibility with existing {% highlight js %} and others
|
||||
eleventyConfig.addLiquidTag("highlight", liquidjsSyntaxHighlighter);
|
||||
eleventyConfig.addLiquidTag("highlight", highlighters.prismjs);
|
||||
|
||||
// only content in the `posts/` directory
|
||||
eleventyConfig.addCollection("posts", function(collection) {
|
||||
|
||||
Reference in New Issue
Block a user