Template
add the thing that auto does target=blank
This commit is contained in:
+16
-1
@@ -1,5 +1,8 @@
|
|||||||
import { attrs } from "@mdit/plugin-attrs";
|
|
||||||
import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
|
import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
|
||||||
|
|
||||||
|
import { attrs } from "@mdit/plugin-attrs";
|
||||||
|
import { markdownitLinkAttributes } from 'markdown-it-link-attributes';
|
||||||
|
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
|
||||||
import pluginFilters from "./_config/filters.js";
|
import pluginFilters from "./_config/filters.js";
|
||||||
@@ -8,6 +11,18 @@ export default async function (eleventyConfig) {
|
|||||||
/* Markdown HTML attribute parsing */
|
/* Markdown HTML attribute parsing */
|
||||||
eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(attrs));
|
eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(attrs));
|
||||||
|
|
||||||
|
/* Markdown apply target="_blank" to all external links */
|
||||||
|
const milaOptions = {
|
||||||
|
matcher(href) {
|
||||||
|
return href.match(/^https?:\/\//);
|
||||||
|
},
|
||||||
|
attrs: {
|
||||||
|
target: "_blank",
|
||||||
|
rel: "external",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(markdownitLinkAttributes, milaOptions));
|
||||||
|
|
||||||
/* Bundles */
|
/* Bundles */
|
||||||
/* CSS */
|
/* CSS */
|
||||||
eleventyConfig.addBundle("css", {
|
eleventyConfig.addBundle("css", {
|
||||||
|
|||||||
Generated
+9
-2
@@ -5,14 +5,14 @@
|
|||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "11ty",
|
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@11ty/eleventy": "^3.1.5",
|
"@11ty/eleventy": "^3.1.5",
|
||||||
"@11ty/eleventy-img": "^6.0.4",
|
"@11ty/eleventy-img": "^6.0.4",
|
||||||
"@mdit/plugin-attrs": "^0.25.1",
|
"@mdit/plugin-attrs": "^0.25.1",
|
||||||
"luxon": "^3.7.2"
|
"luxon": "^3.7.2",
|
||||||
|
"markdown-it-link-attributes": "https://github.com/lee0c/markdown-it-link-attributes/tarball/main"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@11ty/dependency-tree": {
|
"node_modules/@11ty/dependency-tree": {
|
||||||
@@ -1798,6 +1798,13 @@
|
|||||||
"markdown-it": "bin/markdown-it.mjs"
|
"markdown-it": "bin/markdown-it.mjs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/markdown-it-link-attributes": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://github.com/lee0c/markdown-it-link-attributes/tarball/main",
|
||||||
|
"integrity": "sha512-AWUn7JiBi431HkZyXR2MRJxU0wQolHmG/TFCrRSq+w/q4mIzY7c3QKBF1eYEQwXx8IKLdmBVxZA37tp3S1ZkYQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/markdown-it/node_modules/entities": {
|
"node_modules/markdown-it/node_modules/entities": {
|
||||||
"version": "4.5.0",
|
"version": "4.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
||||||
|
|||||||
+2
-1
@@ -13,6 +13,7 @@
|
|||||||
"@11ty/eleventy": "^3.1.5",
|
"@11ty/eleventy": "^3.1.5",
|
||||||
"@11ty/eleventy-img": "^6.0.4",
|
"@11ty/eleventy-img": "^6.0.4",
|
||||||
"@mdit/plugin-attrs": "^0.25.1",
|
"@mdit/plugin-attrs": "^0.25.1",
|
||||||
"luxon": "^3.7.2"
|
"luxon": "^3.7.2",
|
||||||
|
"markdown-it-link-attributes": "https://github.com/lee0c/markdown-it-link-attributes/tarball/main"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user