diff --git a/.eleventy.js b/.eleventy.js index 67bc02c..ba35dbc 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -7,6 +7,7 @@ const hljs = require('highlight.js/lib/common'); const { setup } = require('highlightjs-glimmer'); const markdownit = require('markdown-it'); const markdownitClass = require('@toycode/markdown-it-class'); +const anchor = require('markdown-it-anchor'); const cheerio = require('cheerio'); const expectedInputFormat = 'YYYY-MM-DD'; @@ -53,6 +54,9 @@ const md = markdownit({ } }); md.use(markdownitClass, markdownClassMapping); +md.use(anchor, { + permalink: anchor.permalink.headerLink() +}) module.exports = function (eleventyConfig) { let nunjucksEnvironment = new Nunjucks.Environment( diff --git a/package-lock.json b/package-lock.json index 188d04e..fc23baf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,15 +8,13 @@ "name": "portfolio", "version": "1.0.0", "license": "ISC", - "dependencies": { - "@toycode/markdown-it-class": "^1.2.4" - }, "devDependencies": { "@11ty/eleventy": "^3.0.0", "@11ty/eleventy-plugin-syntaxhighlight": "^3.1.3", "@catppuccin/highlightjs": "^1.0.1", "@catppuccin/tailwindcss": "^0.1.6", "@divriots/jampack": "^0.23.3", + "@toycode/markdown-it-class": "^1.2.4", "autoprefixer": "^10.3.7", "cheerio": "^1.0.0-rc.12", "cssnano": "^5.0.8", @@ -24,6 +22,7 @@ "highlight.js": "^11.11.0", "highlightjs-glimmer": "^2.2.1", "install": "^0.13.0", + "markdown-it-anchor": "^9.2.0", "npm": "^10.5.0", "npm-run-all": "^4.1.5", "postcss": "^8.3.11", @@ -1682,6 +1681,7 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/@toycode/markdown-it-class/-/markdown-it-class-1.2.4.tgz", "integrity": "sha512-hA4gHBK8moObkOYdWTjhy1wYcYy0MJeM3JjSKbsXHRpRMvIKhk6Jm+t3bXsSScTdz/byWqQbs8YIwVYjHp+SlQ==", + "dev": true, "license": "MIT" }, "node_modules/@trysound/sax": { @@ -1694,6 +1694,34 @@ "node": ">=10.13.0" } }, + "node_modules/@types/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@types/markdown-it": { + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz", + "integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/linkify-it": "^5", + "@types/mdurl": "^2" + } + }, + "node_modules/@types/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/a-sync-waterfall": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", @@ -5451,6 +5479,17 @@ "markdown-it": "bin/markdown-it.mjs" } }, + "node_modules/markdown-it-anchor": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-9.2.0.tgz", + "integrity": "sha512-sa2ErMQ6kKOA4l31gLGYliFQrMKkqSO0ZJgGhDHKijPf0pNFM9vghjAh3gn26pS4JDRs7Iwa9S36gxm3vgZTzg==", + "dev": true, + "license": "Unlicense", + "peerDependencies": { + "@types/markdown-it": "*", + "markdown-it": "*" + } + }, "node_modules/markdown-it/node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", diff --git a/package.json b/package.json index 7b489f3..7b499e4 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "@catppuccin/highlightjs": "^1.0.1", "@catppuccin/tailwindcss": "^0.1.6", "@divriots/jampack": "^0.23.3", + "@toycode/markdown-it-class": "^1.2.4", "autoprefixer": "^10.3.7", "cheerio": "^1.0.0-rc.12", "cssnano": "^5.0.8", @@ -41,14 +42,12 @@ "highlight.js": "^11.11.0", "highlightjs-glimmer": "^2.2.1", "install": "^0.13.0", + "markdown-it-anchor": "^9.2.0", "npm": "^10.5.0", "npm-run-all": "^4.1.5", "postcss": "^8.3.11", "postcss-cli": "^9.0.1", "tailwindcss": "^3.4.17", "tailwindcss-animated": "^1.0.1" - }, - "dependencies": { - "@toycode/markdown-it-class": "^1.2.4" } }