diff --git a/eleventy.config.js b/eleventy.config.js index a692dd518..cab2ca0e1 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -17,6 +17,9 @@ export default async function(eleventyConfig) { // Копирование (await import('./src/eleventy-config/static-files.js')).default(eleventyConfig); + // Расширения + (await import('./src/eleventy-config/extensions.js')).default(eleventyConfig); + return { dir: { input: 'src', @@ -31,6 +34,7 @@ export default async function(eleventyConfig) { templateFormats: [ 'md', 'njk', + '11ty.js', ], }; }; diff --git a/package-lock.json b/package-lock.json index b5694a75e..b48739bb1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,7 @@ "requires": true, "packages": { "": { + "hasInstallScript": true, "devDependencies": { "@11ty/eleventy": "^3.0.0-alpha.6", "@11ty/eleventy-img": "^4.0.2", @@ -18,6 +19,7 @@ "del": "6.0.0", "editorconfig-checker": "^5.0.1", "eslint": "^9.0.0", + "fast-glob": "^3.3.2", "globals": "^15.0.0", "gulp": "^4.0.2", "gulp-babel": "^8.0.0", @@ -26,17 +28,18 @@ "gulp-rev": "9.0.0", "gulp-rev-rewrite": "5.0.0", "gulp-terser": "^2.1.0", - "html-minifier": "^4.0.0", + "html-minifier-terser": "^7.2.0", "hyphen": "^1.6.2", + "js-yaml": "^4.1.0", "linkedom": "^0.16.4", "markdown-it-multimd-table": "^4.1.1", + "minify-xml": "^4.4.1", "node-w3c-validator": "^2.0.1", - "node-xml-stream": "^1.0.2", + "podcast": "github:web-standards-ru/podcast", "postcss": "^8.3.8", "postcss-color-hex-alpha": "^9.0.2", "postcss-csso": "^6.0.0", "postcss-import": "^16.0.0", - "pretty-data": "^0.40.0", "remark-cli": "^12.0.0", "remark-frontmatter": "^5.0.0", "remark-lint": "^10.0.0", @@ -4116,13 +4119,13 @@ } }, "node_modules/camel-case": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", - "integrity": "sha512-+MbKztAYHXPr1jNTSKQF52VpcFjwY5RkR7fxksV8Doo4KAYc5Fl4UJRgthBbTmEx8C54DqahhbLJkDwjI3PI/w==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", + "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", "dev": true, "dependencies": { - "no-case": "^2.2.0", - "upper-case": "^1.1.1" + "pascal-case": "^3.1.2", + "tslib": "^2.0.3" } }, "node_modules/camelcase": { @@ -4267,15 +4270,15 @@ } }, "node_modules/clean-css": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz", - "integrity": "sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.3.tgz", + "integrity": "sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==", "dev": true, "dependencies": { "source-map": "~0.6.0" }, "engines": { - "node": ">= 4.0" + "node": ">= 10.0" } }, "node_modules/clean-stack": { @@ -5086,6 +5089,16 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, + "node_modules/dot-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", + "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "dev": true, + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/duplexer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", @@ -7526,15 +7539,6 @@ "node": ">= 0.4" } }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true, - "bin": { - "he": "bin/he" - } - }, "node_modules/homedir-polyfill": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", @@ -7559,25 +7563,34 @@ "integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==", "dev": true }, - "node_modules/html-minifier": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-4.0.0.tgz", - "integrity": "sha512-aoGxanpFPLg7MkIl/DDFYtb0iWz7jMFGqFhvEDZga6/4QTjneiD8I/NXL1x5aaoCp7FSIT6h/OhykDdPsbtMig==", + "node_modules/html-minifier-terser": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-7.2.0.tgz", + "integrity": "sha512-tXgn3QfqPIpGl9o+K5tpcj3/MN4SfLtsx2GWwBC3SSd0tXQGyF3gsSqad8loJgKZGM3ZxbYDd5yhiBIdWpmvLA==", "dev": true, "dependencies": { - "camel-case": "^3.0.0", - "clean-css": "^4.2.1", - "commander": "^2.19.0", - "he": "^1.2.0", - "param-case": "^2.1.1", + "camel-case": "^4.1.2", + "clean-css": "~5.3.2", + "commander": "^10.0.0", + "entities": "^4.4.0", + "param-case": "^3.0.4", "relateurl": "^0.2.7", - "uglify-js": "^3.5.1" + "terser": "^5.15.1" }, "bin": { - "html-minifier": "cli.js" + "html-minifier-terser": "cli.js" }, "engines": { - "node": ">=6" + "node": "^14.13.1 || >=16.0.0" + } + }, + "node_modules/html-minifier-terser/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "engines": { + "node": ">=14" } }, "node_modules/html-tags": { @@ -8642,10 +8655,13 @@ } }, "node_modules/lower-case": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", - "integrity": "sha512-2Fgx1Ycm599x+WGpIYwJOvsjmXFzTSc34IwDWALRA/8AopUKAVPwfJ+h5+f85BCp0PWmmJcWzEpxOpoXycMpdA==", - "dev": true + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", + "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "dev": true, + "dependencies": { + "tslib": "^2.0.3" + } }, "node_modules/lru-cache": { "version": "5.1.1", @@ -9633,6 +9649,56 @@ "node": ">=6" } }, + "node_modules/minify-xml": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/minify-xml/-/minify-xml-4.4.1.tgz", + "integrity": "sha512-qPAtnZjc7XqxzawXD3d8yAk+58nEq+rie+fUn2ueqBt5WNeanyhyCRTyw+2+OStusQmDKHBHfR4UMBNLExXRcQ==", + "dev": true, + "dependencies": { + "meow": "^13.2.0", + "pumpify": "^2.0.1", + "replacestream": "^4.0.3" + }, + "bin": { + "minify-xml": "cli.js" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/minify-xml/node_modules/duplexify": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.3.tgz", + "integrity": "sha512-M3BmBhwJRZsSx38lZyhE53Csddgzl5R7xGJNk7CVddZD6CcmwMCH8J+7AprIrQKH7TonKxaCjcv27Qmf+sQ+oA==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.4.1", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1", + "stream-shift": "^1.0.2" + } + }, + "node_modules/minify-xml/node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/minify-xml/node_modules/pumpify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-2.0.1.tgz", + "integrity": "sha512-m7KOje7jZxrmutanlkS1daj1dS6z6BgslzOXmcSEpIlCxM3VJH7lG5QLeck/6hgF6F4crFf01UtQmNsJfweTAw==", + "dev": true, + "dependencies": { + "duplexify": "^4.1.1", + "inherits": "^2.0.3", + "pump": "^3.0.0" + } + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -9846,12 +9912,13 @@ "dev": true }, "node_modules/no-case": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", - "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", + "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", "dev": true, "dependencies": { - "lower-case": "^1.1.1" + "lower-case": "^2.0.2", + "tslib": "^2.0.3" } }, "node_modules/node-fetch": { @@ -9989,12 +10056,6 @@ "node": ">=8" } }, - "node_modules/node-xml-stream": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/node-xml-stream/-/node-xml-stream-1.0.2.tgz", - "integrity": "sha512-W4LzsKQ1x3TldQQmXZfM/JO+3SPp+zzvA2Nf82chE7vXnZy7LqHjIqQe9yDUw58g2fTOaJo+DlPnIDfmozgsuw==", - "dev": true - }, "node_modules/nopt": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/nopt/-/nopt-7.2.0.tgz", @@ -10571,12 +10632,13 @@ } }, "node_modules/param-case": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz", - "integrity": "sha512-eQE845L6ot89sk2N8liD8HAuH4ca6Vvr7VWAWwt7+kvvG5aBcPmmphQ68JsEG2qa9n1TykS2DLeMt363AAH8/w==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", + "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", "dev": true, "dependencies": { - "no-case": "^2.2.0" + "dot-case": "^3.0.4", + "tslib": "^2.0.3" } }, "node_modules/parent-module": { @@ -10656,6 +10718,16 @@ "node": ">= 0.8" } }, + "node_modules/pascal-case": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", + "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", + "dev": true, + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/pascalcase": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", @@ -10855,6 +10927,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/podcast": { + "resolved": "git+ssh://git@github.com/web-standards-ru/podcast.git#main", + "dev": true, + "engines": { + "node": ">=16", + "npm": ">=8" + } + }, "node_modules/posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -11175,15 +11255,6 @@ "node": ">= 0.8.0" } }, - "node_modules/pretty-data": { - "version": "0.40.0", - "resolved": "https://registry.npmjs.org/pretty-data/-/pretty-data-0.40.0.tgz", - "integrity": "sha512-YFLnEdDEDnkt/GEhet5CYZHCvALw6+Elyb/tp8kQG03ZSIuzeaDWpZYndCXwgqu4NAjh1PI534dhDS1mHarRnQ==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/pretty-hrtime": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", @@ -13418,8 +13489,7 @@ "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true, - "optional": true + "dev": true }, "node_modules/type": { "version": "2.7.2", @@ -13472,18 +13542,6 @@ "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", "dev": true }, - "node_modules/uglify-js": { - "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", - "dev": true, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/uhyphen": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/uhyphen/-/uhyphen-0.2.0.tgz", @@ -14114,12 +14172,6 @@ "browserslist": ">= 4.21.0" } }, - "node_modules/upper-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", - "integrity": "sha512-WRbjgmYzgXkCV7zNVpy5YgrHgbBv126rMALQQMrmzOVC4GM2waQ9x7xtm8VU+1yF2kWyPzI9zbZ48n4vSxwfSA==", - "dev": true - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index 0833f5b83..c612bbe84 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "html": "node-w3c-validator -i ./dist/**/*.html --exclude ./dist/**/demos/** -f lint -evH", "test": "npm run editorconfig && npm run stylelint && npm run markdown && npm run eslint", "build": "cross-env-shell NODE_ENV=production \"rm -rf dist && eleventy && gulp build\"", - "deploy": "cd dist && rsync --progress --archive --compress --delete . wst@web-standards.ru:/var/www/web-standards.ru/html/" + "deploy": "cd dist && rsync --progress --archive --compress --delete . wst@web-standards.ru:/var/www/web-standards.ru/html/", + "postinstall": "npm install git://github.com/web-standards-ru/podcast.git#main --save=false --package-lock=false" }, "devDependencies": { "@11ty/eleventy": "^3.0.0-alpha.6", @@ -31,6 +32,7 @@ "del": "6.0.0", "editorconfig-checker": "^5.0.1", "eslint": "^9.0.0", + "fast-glob": "^3.3.2", "globals": "^15.0.0", "gulp": "^4.0.2", "gulp-babel": "^8.0.0", @@ -39,17 +41,18 @@ "gulp-rev": "9.0.0", "gulp-rev-rewrite": "5.0.0", "gulp-terser": "^2.1.0", - "html-minifier": "^4.0.0", + "html-minifier-terser": "^7.2.0", "hyphen": "^1.6.2", + "js-yaml": "^4.1.0", "linkedom": "^0.16.4", "markdown-it-multimd-table": "^4.1.1", + "minify-xml": "^4.4.1", "node-w3c-validator": "^2.0.1", - "node-xml-stream": "^1.0.2", + "podcast": "github:web-standards-ru/podcast", "postcss": "^8.3.8", "postcss-color-hex-alpha": "^9.0.2", "postcss-csso": "^6.0.0", "postcss-import": "^16.0.0", - "pretty-data": "^0.40.0", "remark-cli": "^12.0.0", "remark-frontmatter": "^5.0.0", "remark-lint": "^10.0.0", diff --git a/src/data/podcast.yml b/src/data/podcast.yml new file mode 100644 index 000000000..78b8139cf --- /dev/null +++ b/src/data/podcast.yml @@ -0,0 +1,20 @@ +title: Веб-стандарты +subtitle: Новости фронтенда за неделю +description: Новости фронтенда в еженедельном подкасте сообщества «[Веб-стандарты](https://web-standards.ru/)» + +url: https://web-standards.ru/podcast/ +author: Сообщество «Веб-стандарты» +type: episodic +categories: + - title: Technology + - title: News + items: + - Tech News +explicit: false +language: ru + +owner: + name: Веб-стандарты + email: wst@web-standards.ru + +copyright: СС BY-NC-ND 4.0 diff --git a/src/eleventy-config/collections.js b/src/eleventy-config/collections.js index 34618aa6c..e7821ff7c 100644 --- a/src/eleventy-config/collections.js +++ b/src/eleventy-config/collections.js @@ -1,4 +1,7 @@ -import { getEpisodesData } from '../libs/podcasts-service.js'; +import path from 'node:path'; +import fs from 'node:fs'; +import fastGlob from 'fast-glob'; +import yaml from 'js-yaml'; export default function(eleventyConfig) { eleventyConfig.addCollection('tagList', (collection) => { @@ -17,22 +20,35 @@ export default function(eleventyConfig) { return [...set].sort(); }); - /* - Коллекция для выпусков подкаста. - Формат данных одного выпуска: - - episode - - title - - date - - chapters - - time - - title - - content - - hosts - - audio - */ - eleventyConfig.addCollection('episodes', () => { - return getEpisodesData(); - }); + const templatesPaths = fastGlob.sync(['node_modules/podcast/src/episodes/*/*.md']); + for (const templatePath of templatesPaths) { + const episodeFolderPath = path.dirname(templatePath); + const episodeDataFilePath = path.join(episodeFolderPath, 'index.yml'); + const episodeGeneratedDataFilePath = path.join(episodeFolderPath, 'index.json'); + const relativePath = path.relative('node_modules/podcast/src/episodes', templatePath); + + const templateContent = fs.readFileSync(templatePath, 'utf-8'); + const templateDataFileContent = fs.readFileSync(episodeDataFilePath, 'utf-8'); + const templateGeneratedDataFileContent = fs.readFileSync(episodeGeneratedDataFilePath, 'utf-8'); + const templateData = yaml.load(templateDataFileContent); + const templateGeneratedData = JSON.parse(templateGeneratedDataFileContent); + + Object.assign(templateData, templateGeneratedData, { + permalink: false, + layout: false, + tags: ['episodes'], + eleventyComputed: { + episode(data) { + return data?.page?.fileSlug; + }, + audio(data) { + return `https://web-standards.ru/podcast/episodes/${data.episode}.mp3`; + }, + }, + }); + + eleventyConfig.addTemplate(`episodes/${relativePath}`, templateContent, templateData); + } eleventyConfig.addCollection('people', (collectionAPI) => { return collectionAPI.getFilteredByGlob('src/people/*/*.md'); diff --git a/src/eleventy-config/extensions.js b/src/eleventy-config/extensions.js new file mode 100644 index 000000000..8e98af772 --- /dev/null +++ b/src/eleventy-config/extensions.js @@ -0,0 +1,7 @@ +import yaml from 'js-yaml'; + +export default async function(eleventyConfig) { + eleventyConfig.addDataExtension('yml', (contents) => { + return yaml.load(contents); + }); +} diff --git a/src/eleventy-config/filters.js b/src/eleventy-config/filters.js index adce90a01..f4c5800ed 100644 --- a/src/eleventy-config/filters.js +++ b/src/eleventy-config/filters.js @@ -1,5 +1,6 @@ import hyphenLibRu from 'hyphen/ru/index.js'; import markdownIt from 'markdown-it'; +import htmlmin from 'html-minifier-terser'; const markdown = markdownIt({ html: true, @@ -55,4 +56,17 @@ export default function(eleventyConfig) { eleventyConfig.addFilter('markdown', (value) => { return markdown.render(value); }); + + eleventyConfig.addFilter('inlineMarkdown', (value) => { + return markdown.renderInline(value); + }); + + eleventyConfig.addFilter('htmlmin', (value) => { + return htmlmin.minify( + value, { + collapseWhitespace: true, + removeEmptyElements: true, + } + ); + }); }; diff --git a/src/eleventy-config/markdown-library.js b/src/eleventy-config/markdown-library.js index d9382bdfc..7a68c7ebc 100644 --- a/src/eleventy-config/markdown-library.js +++ b/src/eleventy-config/markdown-library.js @@ -1,6 +1,5 @@ import markdownIt from 'markdown-it'; import markdownItMultimdTable from 'markdown-it-multimd-table'; -import markdownItAnchor from '../libs/markdown-it-anchor.js'; export default function(eleventyConfig) { const md = markdownIt({ @@ -8,12 +7,6 @@ export default function(eleventyConfig) { highlight: function(str, lang) { return `
${md.utils.escapeHtml(str)}
`; }, - }).use(markdownItAnchor, { - permalink: true, - permalinkClass: 'tooltip__button', - permalinkSymbol: '', - permalinkSpace: false, - slugify: () => 'section', }).use(markdownItMultimdTable); md.renderer.rules = { ...md.renderer.rules, diff --git a/src/eleventy-config/transforms.js b/src/eleventy-config/transforms.js index 40a5ee053..6dca0d4c0 100644 --- a/src/eleventy-config/transforms.js +++ b/src/eleventy-config/transforms.js @@ -1,7 +1,7 @@ import path from 'node:path'; import os from 'node:os'; -import htmlmin from 'html-minifier'; -import prettydata from 'pretty-data'; +import htmlmin from 'html-minifier-terser'; +import minifyXml from 'minify-xml'; import { parseHTML } from 'linkedom'; import Image from '@11ty/eleventy-img'; import sharp from 'sharp'; @@ -143,30 +143,6 @@ export default function(eleventyConfig) { return document.toString(); }); - if (isProdMode) { - eleventyConfig.addTransform('htmlmin', (content, outputPath) => { - if (outputPath && outputPath.endsWith('.html')) { - let result = htmlmin.minify( - content, { - removeComments: true, - collapseWhitespace: true, - collapseBooleanAttributes: true, - } - ); - return result; - } - return content; - }); - - eleventyConfig.addTransform('xmlmin', function(content, outputPath) { - if (outputPath && outputPath.endsWith('.xml')) { - let result = prettydata.pd.xmlmin(content); - return result; - } - return content; - }); - } - eleventyConfig.addTransform('lazyYouTube', (content, outputPath) => { let articles = /articles\/([a-zA-Z0-9_-]+)\/index\.html/i; let iframes = /