Template
add id attributes package
This commit is contained in:
+9
-3
@@ -2,6 +2,7 @@ import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
|
||||
|
||||
import { attrs } from "@mdit/plugin-attrs";
|
||||
import { markdownitLinkAttributes } from 'markdown-it-link-attributes';
|
||||
import markdownitIdAttributes from "markdown-it-anchor";
|
||||
|
||||
import path from "node:path";
|
||||
|
||||
@@ -12,7 +13,7 @@ export default async function (eleventyConfig) {
|
||||
eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(attrs));
|
||||
|
||||
/* Markdown apply target="_blank" to all external links */
|
||||
const milaOptions = {
|
||||
eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(markdownitLinkAttributes, {
|
||||
matcher(href) {
|
||||
return href.match(/^https?:\/\//);
|
||||
},
|
||||
@@ -20,8 +21,13 @@ export default async function (eleventyConfig) {
|
||||
target: "_blank",
|
||||
rel: "external",
|
||||
},
|
||||
};
|
||||
eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(markdownitLinkAttributes, milaOptions));
|
||||
}));
|
||||
|
||||
/* Markdown apply ID attributes to headers */
|
||||
eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(markdownitIdAttributes, {
|
||||
level: [2, 3, 4],
|
||||
tabIndex: false,
|
||||
}));
|
||||
|
||||
/* Bundles */
|
||||
/* CSS */
|
||||
|
||||
Generated
+12
@@ -12,6 +12,7 @@
|
||||
"@11ty/eleventy-img": "^6.0.4",
|
||||
"@mdit/plugin-attrs": "^0.25.1",
|
||||
"luxon": "^3.7.2",
|
||||
"markdown-it-anchor": "^10.0.0",
|
||||
"markdown-it-link-attributes": "https://github.com/lee0c/markdown-it-link-attributes/tarball/main"
|
||||
}
|
||||
},
|
||||
@@ -1798,6 +1799,17 @@
|
||||
"markdown-it": "bin/markdown-it.mjs"
|
||||
}
|
||||
},
|
||||
"node_modules/markdown-it-anchor": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-10.0.0.tgz",
|
||||
"integrity": "sha512-Q8g7Z6OBdH3eXF0lujFqukIxUvgCDZcjzCrJxmD6QiEzU1HWR9fVN+Bf6gxmM+0yrPFs+jUw8gNjLmUQqt6Eew==",
|
||||
"dev": true,
|
||||
"license": "Unlicense",
|
||||
"peerDependencies": {
|
||||
"@types/markdown-it": "*",
|
||||
"markdown-it": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/markdown-it-link-attributes": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://github.com/lee0c/markdown-it-link-attributes/tarball/main",
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"@11ty/eleventy-img": "^6.0.4",
|
||||
"@mdit/plugin-attrs": "^0.25.1",
|
||||
"luxon": "^3.7.2",
|
||||
"markdown-it-anchor": "^10.0.0",
|
||||
"markdown-it-link-attributes": "https://github.com/lee0c/markdown-it-link-attributes/tarball/main"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user