+14
-7
@@ -1,11 +1,13 @@
|
||||
import { IdAttributePlugin } from "@11ty/eleventy";
|
||||
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 toc from "eleventy-plugin-nesting-toc";
|
||||
|
||||
import { attrs } from "@mdit/plugin-attrs";
|
||||
import { markdownitLinkAttributes } from 'markdown-it-link-attributes';
|
||||
import markdownitIdAttributes from "markdown-it-anchor";
|
||||
|
||||
import path from "node:path";
|
||||
import { execSync } from 'child_process';
|
||||
@@ -18,7 +20,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?:\/\//);
|
||||
},
|
||||
@@ -26,8 +28,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 */
|
||||
@@ -128,12 +135,12 @@ export default async function(eleventyConfig) {
|
||||
/* Navigation */
|
||||
eleventyConfig.addPlugin(eleventyNavigationPlugin);
|
||||
|
||||
/* `id` attributes */
|
||||
eleventyConfig.addPlugin(IdAttributePlugin);
|
||||
|
||||
/* Syntax highlighting */
|
||||
eleventyConfig.addPlugin(syntaxHighlight);
|
||||
|
||||
/* Table of contents */
|
||||
eleventyConfig.addPlugin(toc);
|
||||
|
||||
/* Draft handling */
|
||||
eleventyConfig.addPreprocessor("drafts", "*", (data, content) => {
|
||||
if (data.draft) {
|
||||
|
||||
Reference in New Issue
Block a user