From f5c891910ec3398f091532796412310b98dd6f2d Mon Sep 17 00:00:00 2001 From: Matthew McKinnon Date: Sat, 21 Sep 2024 16:05:02 +1000 Subject: [PATCH] feat: add syntax highlighting for code blocks --- .eleventy.js | 4 +++- package-lock.json | 21 +++++++++++++++++++++ package.json | 1 + src/_includes/layouts/header.njk | 1 + 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.eleventy.js b/.eleventy.js index fc88ec9..c9232cc 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,6 +1,8 @@ const blogTools = require("eleventy-plugin-blog-tools"); const markdownIt = require("markdown-it"); const markdownItAttrs = require("markdown-it-attrs"); +const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight"); + // Import prior to `module.exports` within `.eleventy.js` const { DateTime } = require("luxon"); @@ -40,7 +42,7 @@ module.exports = function(eleventyConfig) { }); eleventyConfig.addPlugin(blogTools); - + eleventyConfig.addPlugin(syntaxHighlight); return { passthroughFileCopy: true, diff --git a/package-lock.json b/package-lock.json index 503b1d9..3d5ee3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0", "a-sync-waterfall": "^1.0.1", "acorn": "^7.4.1", "ansi-regex": "^6.1.0", @@ -328,6 +329,18 @@ "url": "https://opencollective.com/11ty" } }, + "node_modules/@11ty/eleventy-plugin-syntaxhighlight": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@11ty/eleventy-plugin-syntaxhighlight/-/eleventy-plugin-syntaxhighlight-5.0.0.tgz", + "integrity": "sha512-y9BUmP1GofmbJgxM1+ky/UpFCpD8JSOeLeKItUs0WApgnrHk9haHziW7lS86lbArX5SiCVo4zTTw9x53gvRCaA==", + "dependencies": { + "prismjs": "^1.29.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/11ty" + } + }, "node_modules/@11ty/eleventy-utils": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-1.0.3.tgz", @@ -3654,6 +3667,14 @@ "node": ">=0.10.0" } }, + "node_modules/prismjs": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", + "integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==", + "engines": { + "node": ">=6" + } + }, "node_modules/promise": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", diff --git a/package.json b/package.json index 5e2bef5..80bf1f2 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "url": "https://gitlab.comprofix.com/comprofix/website.git" }, "dependencies": { + "@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0", "a-sync-waterfall": "^1.0.1", "acorn": "^7.4.1", "ansi-regex": "^6.1.0", diff --git a/src/_includes/layouts/header.njk b/src/_includes/layouts/header.njk index b9fd60e..41918cc 100644 --- a/src/_includes/layouts/header.njk +++ b/src/_includes/layouts/header.njk @@ -4,6 +4,7 @@ +