Fixes #6
This commit is contained in:
18
.eleventy.js
18
.eleventy.js
@@ -1,4 +1,7 @@
|
||||
const { DateTime } = require("luxon");
|
||||
const metadata = require("./_data/metadata.json");
|
||||
const absoluteUrl = require("./_src/absoluteUrl");
|
||||
const HtmlToAbsoluteUrls = require("./_src/HtmlToAbsoluteUrls");
|
||||
const highlighters = require("./_src/eleventy-liquidjs-tag-highlight");
|
||||
|
||||
function dateToISO(dateObj) {
|
||||
@@ -24,6 +27,21 @@ module.exports = function(eleventyConfig) {
|
||||
return DateTime.fromJSDate(dateObj).toFormat("dd LLL yyyy");
|
||||
});
|
||||
|
||||
eleventyConfig.addNunjucksFilter("absoluteUrl", function(href, base) {
|
||||
return absoluteUrl(href, base);
|
||||
});
|
||||
|
||||
eleventyConfig.addNunjucksFilter("htmlToAbsoluteUrls", function(htmlContent, base, callback) {
|
||||
if(!htmlContent) {
|
||||
callback(null, "");
|
||||
return;
|
||||
}
|
||||
|
||||
HtmlToAbsoluteUrls(htmlContent, base, callback).then(result => {
|
||||
callback(null, result.html);
|
||||
});
|
||||
}, true);
|
||||
|
||||
// compatibility with existing {% highlight js %} and others
|
||||
eleventyConfig.addLiquidTag("highlight", highlighters.prismjs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user