From 29872edc105b6eccbd9c135b47623e615b319520 Mon Sep 17 00:00:00 2001 From: Devin Haska Date: Wed, 31 Jan 2024 11:41:17 -0800 Subject: [PATCH] feat: add markdown-it library --- config/plugins/markdown.js | 8 ++++++++ eleventy.config.js | 6 +++++- package.json | 1 + yarn.lock | 36 +++++++++++++++++++++++++++++++++++- 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 config/plugins/markdown.js diff --git a/config/plugins/markdown.js b/config/plugins/markdown.js new file mode 100644 index 0000000..4dccfa2 --- /dev/null +++ b/config/plugins/markdown.js @@ -0,0 +1,8 @@ +const markdownIt = require("markdown-it"); + +module.exports = markdownIt({ + html: true, + breaks: true, + linkify: true, + typographer: true, +}); diff --git a/eleventy.config.js b/eleventy.config.js index 71cd1f5..4b24985 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1,6 +1,7 @@ +const markdown = require("./config/plugins/markdown.js"); + module.exports = (eleventyConfig) => { eleventyConfig.addWatchTarget("./src/assets"); - // --------------------- Custom Template Languages --------------------- eleventyConfig.addPlugin( require("./config/template-languages/css-config.js"), @@ -11,6 +12,9 @@ module.exports = (eleventyConfig) => { eleventyConfig.addPassthroughCopy(path), ); + // --------------------- Markdown ----------------------- + eleventyConfig.setLibrary("md", markdown); + return { // Optional (default is set): If your site deploys to a subdirectory, change `pathPrefix`, for example with with GitHub pages pathPrefix: "/", diff --git a/package.json b/package.json index 5af05d4..5d94cd2 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "eslint": "8.56.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.1.3", + "markdown-it": "^14.0.0", "postcss": "^8.4.33", "postcss-import": "^16.0.0", "postcss-import-ext-glob": "^2.1.1", diff --git a/yarn.lock b/yarn.lock index 246ddf1..81a5a5e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -776,7 +776,7 @@ entities@^3.0.1, entities@~3.0.1: resolved "https://registry.yarnpkg.com/entities/-/entities-3.0.1.tgz#2b887ca62585e96db3903482d336c1006c3001d4" integrity sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q== -entities@^4.2.0: +entities@^4.2.0, entities@^4.4.0: version "4.5.0" resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== @@ -1401,6 +1401,13 @@ linkify-it@^4.0.1: dependencies: uc.micro "^1.0.1" +linkify-it@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-5.0.0.tgz#9ef238bfa6dc70bd8e7f9572b52d369af569b421" + integrity sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ== + dependencies: + uc.micro "^2.0.0" + liquidjs@^10.7.0: version "10.10.0" resolved "https://registry.yarnpkg.com/liquidjs/-/liquidjs-10.10.0.tgz#349197e674994b8a0c6c21db09cfa9bd4b69a702" @@ -1463,6 +1470,18 @@ markdown-it@^13.0.1: mdurl "^1.0.1" uc.micro "^1.0.5" +markdown-it@^14.0.0: + version "14.0.0" + resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-14.0.0.tgz#b4b2ddeb0f925e88d981f84c183b59bac9e3741b" + integrity sha512-seFjF0FIcPt4P9U39Bq1JYblX0KZCjDLFFQPHpL5AzHpqPEKtosxmdq/LTVZnjfH7tjt9BxStm+wXcDBNuYmzw== + dependencies: + argparse "^2.0.1" + entities "^4.4.0" + linkify-it "^5.0.0" + mdurl "^2.0.0" + punycode.js "^2.3.1" + uc.micro "^2.0.0" + maximatch@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/maximatch/-/maximatch-0.1.0.tgz#86cd8d6b04c9f307c05a6b9419906d0360fb13a2" @@ -1488,6 +1507,11 @@ mdurl@^1.0.1: resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" integrity sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g== +mdurl@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-2.0.0.tgz#80676ec0433025dd3e17ee983d0fe8de5a2237e0" + integrity sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w== + merge2@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" @@ -2137,6 +2161,11 @@ pug@^3.0.2: pug-runtime "^3.0.1" pug-strip-comments "^2.0.0" +punycode.js@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode.js/-/punycode.js-2.3.1.tgz#6b53e56ad75588234e79f4affa90972c7dd8cdb7" + integrity sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA== + punycode@^2.1.0: version "2.3.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" @@ -2398,6 +2427,11 @@ uc.micro@^1.0.1, uc.micro@^1.0.5: resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== +uc.micro@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-2.0.0.tgz#84b3c335c12b1497fd9e80fcd3bfa7634c363ff1" + integrity sha512-DffL94LsNOccVn4hyfRe5rdKa273swqeA5DJpMOeFmEn1wCDc7nAbbB0gXlgBCL7TNzeTv6G7XVWzan7iJtfig== + uglify-js@^3.1.4: version "3.17.4" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.4.tgz#61678cf5fa3f5b7eb789bb345df29afb8257c22c"