remove target=blank etc
This commit is contained in:
+16
-1
@@ -3,10 +3,13 @@ import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
|
||||
import eleventyNavigationPlugin from "@11ty/eleventy-navigation";
|
||||
import { feedPlugin } from "@11ty/eleventy-plugin-rss";
|
||||
import syntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
|
||||
|
||||
import { attrs } from "@mdit/plugin-attrs";
|
||||
import { chunk } from "lodash-es";
|
||||
import { markdownitLinkAttributes } from 'markdown-it-link-attributes';
|
||||
|
||||
import path from "node:path";
|
||||
import { execSync } from 'child_process';
|
||||
import { chunk } from "lodash-es";
|
||||
|
||||
import pluginFilters from "./_config/filters.js";
|
||||
|
||||
@@ -14,6 +17,18 @@ export default async function(eleventyConfig) {
|
||||
/* Markdown HTML attribute parsing */
|
||||
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 */
|
||||
/* CSS */
|
||||
eleventyConfig.addBundle("css", {
|
||||
|
||||
Reference in New Issue
Block a user