feat: add syntax highlighting for code blocks
All checks were successful
/ build-node (push) Successful in 50s
/ publish (push) Successful in 26s

This commit is contained in:
Matthew McKinnon 2024-09-21 16:05:02 +10:00
parent 78a1c3d8d2
commit f5c891910e
4 changed files with 26 additions and 1 deletions

View File

@ -1,6 +1,8 @@
const blogTools = require("eleventy-plugin-blog-tools"); const blogTools = require("eleventy-plugin-blog-tools");
const markdownIt = require("markdown-it"); const markdownIt = require("markdown-it");
const markdownItAttrs = require("markdown-it-attrs"); const markdownItAttrs = require("markdown-it-attrs");
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
// Import prior to `module.exports` within `.eleventy.js` // Import prior to `module.exports` within `.eleventy.js`
const { DateTime } = require("luxon"); const { DateTime } = require("luxon");
@ -40,7 +42,7 @@ module.exports = function(eleventyConfig) {
}); });
eleventyConfig.addPlugin(blogTools); eleventyConfig.addPlugin(blogTools);
eleventyConfig.addPlugin(syntaxHighlight);
return { return {
passthroughFileCopy: true, passthroughFileCopy: true,

21
package-lock.json generated
View File

@ -9,6 +9,7 @@
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
"a-sync-waterfall": "^1.0.1", "a-sync-waterfall": "^1.0.1",
"acorn": "^7.4.1", "acorn": "^7.4.1",
"ansi-regex": "^6.1.0", "ansi-regex": "^6.1.0",
@ -328,6 +329,18 @@
"url": "https://opencollective.com/11ty" "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": { "node_modules/@11ty/eleventy-utils": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-1.0.3.tgz", "resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-1.0.3.tgz",
@ -3654,6 +3667,14 @@
"node": ">=0.10.0" "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": { "node_modules/promise": {
"version": "7.3.1", "version": "7.3.1",
"resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",

View File

@ -27,6 +27,7 @@
"url": "https://gitlab.comprofix.com/comprofix/website.git" "url": "https://gitlab.comprofix.com/comprofix/website.git"
}, },
"dependencies": { "dependencies": {
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
"a-sync-waterfall": "^1.0.1", "a-sync-waterfall": "^1.0.1",
"acorn": "^7.4.1", "acorn": "^7.4.1",
"ansi-regex": "^6.1.0", "ansi-regex": "^6.1.0",

View File

@ -4,6 +4,7 @@
<link rel="stylesheet" href="/css/global.css" /> <link rel="stylesheet" href="/css/global.css" />
<script src="https://kit.fontawesome.com/83f4233a72.js" crossorigin="anonymous"></script> <script src="https://kit.fontawesome.com/83f4233a72.js" crossorigin="anonymous"></script>
<script src="/js/darkmode.js"></script> <script src="/js/darkmode.js"></script>
<link href="https://unpkg.com/prismjs@1.20.0/themes/prism-okaidia.css" rel="stylesheet" />
<div class="menu"> <div class="menu">
<ul class="menu>"> <ul class="menu>">