Skip to content

Commit f40329e

Browse files
committed
JavaScript functions are used throughout Eleventy (not just 11ty.js)
1 parent ac92151 commit f40329e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

.eleventy.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@ module.exports = {
4545
eleventyConfig.addMarkdownHighlighter(markdownPrismJs(options));
4646
}
4747

48-
if( hasTemplateFormat(options.templateFormats, "11ty.js") ) {
49-
eleventyConfig.addJavaScriptFunction("highlight", (language, content, highlight1, highlight2) => {
50-
let highlightLines = [highlight1, highlight2].filter(entry => entry).join(" ");
51-
let result = HighlightPairedShortcode(content, language, highlightLines, options);
52-
return result;
53-
});
54-
}
48+
// we need to add this as many template languages rely on JavaScript functions (not just 11ty.js)
49+
eleventyConfig.addJavaScriptFunction("highlight", (language, content, highlight1, highlight2) => {
50+
let highlightLines = [highlight1, highlight2].filter(entry => entry).join(" ");
51+
let result = HighlightPairedShortcode(content, language, highlightLines, options);
52+
return result;
53+
});
5554
}
5655
};
5756

0 commit comments

Comments
 (0)