From 5a0601e532655e93ec7e51da4368000b2dee6345 Mon Sep 17 00:00:00 2001 From: maia arson crimew Date: Fri, 19 May 2023 14:12:14 +0200 Subject: [PATCH] make external links safer --- .eleventy.js | 4 +- package-lock.json | 121 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 125 insertions(+), 1 deletion(-) diff --git a/.eleventy.js b/.eleventy.js index 5b01a3d..e43532f 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,6 +1,7 @@ -const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight') +const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight'); const pluginRss = require('@11ty/eleventy-plugin-rss'); const timeToRead = require('eleventy-plugin-time-to-read'); +const safeLinks = require('@sardine/eleventy-plugin-external-links'); module.exports = function (eleventyConfig) { const parseDate = (str) => { @@ -16,6 +17,7 @@ module.exports = function (eleventyConfig) { eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPlugin(syntaxHighlight); eleventyConfig.addPlugin(timeToRead); + eleventyConfig.addPlugin(safeLinks); eleventyConfig.addPassthroughCopy({ "src/static": "/" }); diff --git a/package-lock.json b/package-lock.json index 329fa78..45d008f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@11ty/eleventy": "^v2.0.0-beta.1", "@11ty/eleventy-plugin-rss": "^1.2.0", "@11ty/eleventy-plugin-syntaxhighlight": "^4.0.0", + "@sardine/eleventy-plugin-external-links": "^1.4.0", "eleventy-plugin-time-to-read": "^1.3.0" } }, @@ -233,6 +234,126 @@ "node": ">= 8" } }, + "node_modules/@sardine/eleventy-plugin-external-links": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@sardine/eleventy-plugin-external-links/-/eleventy-plugin-external-links-1.4.0.tgz", + "integrity": "sha512-K9WDFQwLMSBo6bjqNmH3kZSdXKTAb0MYHK3Tmm8IChsprF1XHl574U4pxgouTwJNjzlxqPKI/JYbY2okg0tiaQ==", + "dependencies": { + "linkedom": "^0.13.0" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@sardine/eleventy-plugin-external-links/node_modules/css-select": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", + "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.0.1", + "domhandler": "^4.3.1", + "domutils": "^2.8.0", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/@sardine/eleventy-plugin-external-links/node_modules/dom-serializer": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", + "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/@sardine/eleventy-plugin-external-links/node_modules/domhandler": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz", + "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", + "dependencies": { + "domelementtype": "^2.2.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/@sardine/eleventy-plugin-external-links/node_modules/domutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", + "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "dependencies": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/@sardine/eleventy-plugin-external-links/node_modules/entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/@sardine/eleventy-plugin-external-links/node_modules/htmlparser2": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-7.2.0.tgz", + "integrity": "sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==", + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.2", + "domutils": "^2.8.0", + "entities": "^3.0.1" + } + }, + "node_modules/@sardine/eleventy-plugin-external-links/node_modules/htmlparser2/node_modules/entities": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", + "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/@sardine/eleventy-plugin-external-links/node_modules/linkedom": { + "version": "0.13.7", + "resolved": "https://registry.npmjs.org/linkedom/-/linkedom-0.13.7.tgz", + "integrity": "sha512-We9cyPHV/exsrC43KXtItjqSTxwrK9pLpOnG6TLzqXrmqwe/wqd3Gi6eAAU4YCqfTgy79R8g75hY2fS7723XUg==", + "dependencies": { + "css-select": "^4.2.1", + "cssom": "^0.5.0", + "html-escaper": "^3.0.3", + "htmlparser2": "^7.2.0", + "uhyphen": "^0.1.0" + } + }, + "node_modules/@sardine/eleventy-plugin-external-links/node_modules/uhyphen": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/uhyphen/-/uhyphen-0.1.0.tgz", + "integrity": "sha512-o0QVGuFg24FK765Qdd5kk0zU/U4dEsCtN/GSiwNI9i8xsSVtjIAOdTaVhLwZ1nrbWxFVMxNDDl+9fednsOMsBw==" + }, "node_modules/@sindresorhus/slugify": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-1.1.2.tgz", diff --git a/package.json b/package.json index f764bca..ab88c08 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "@11ty/eleventy": "^v2.0.0-beta.1", "@11ty/eleventy-plugin-rss": "^1.2.0", "@11ty/eleventy-plugin-syntaxhighlight": "^4.0.0", + "@sardine/eleventy-plugin-external-links": "^1.4.0", "eleventy-plugin-time-to-read": "^1.3.0" } }