diff --git a/package.json b/package.json index ac07b96..e514d93 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,11 @@ "eslint": "^8.20.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-svelte3": "^4.0.0", + "hast-util-from-selector": "^2.0.0", "prettier": "^2.7.1", "prettier-plugin-svelte": "^2.7.0", + "rehype-parse": "^8.0.4", + "rehype-stringify": "^9.0.3", "sass": "^1.54.0", "svelte": "^3.49.0", "svelte-check": "^2.8.0", @@ -35,11 +38,13 @@ "svelte2tsx": "^0.5.12", "tslib": "^2.4.0", "typescript": "^4.7.4", - "vite": "^3.0.2" + "unified": "^10.1.2", + "unist-util-visit": "^4.1.0", + "vite": "^3.0.3" }, "type": "module", "dependencies": { - "@damillora/plachta": "^1.8.2", + "@damillora/plachta": "^1.8.3", "@tryghost/content-api": "^1.11.0", "fitvids": "^2.1.1", "svelte-material-icons": "^2.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f503f6c..158d513 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,7 +1,7 @@ lockfileVersion: 5.3 specifiers: - '@damillora/plachta': ^1.8.2 + '@damillora/plachta': ^1.8.3 '@sveltejs/adapter-auto': next '@sveltejs/adapter-node': ^1.0.0-next.83 '@sveltejs/kit': next @@ -15,8 +15,11 @@ specifiers: eslint-config-prettier: ^8.5.0 eslint-plugin-svelte3: ^4.0.0 fitvids: ^2.1.1 + hast-util-from-selector: ^2.0.0 prettier: ^2.7.1 prettier-plugin-svelte: ^2.7.0 + rehype-parse: ^8.0.4 + rehype-stringify: ^9.0.3 sass: ^1.54.0 svelte: ^3.49.0 svelte-check: ^2.8.0 @@ -27,10 +30,12 @@ specifiers: svelte2tsx: ^0.5.12 tslib: ^2.4.0 typescript: ^4.7.4 - vite: ^3.0.2 + unified: ^10.1.2 + unist-util-visit: ^4.1.0 + vite: ^3.0.3 dependencies: - '@damillora/plachta': 1.8.2_svelte@3.49.0 + '@damillora/plachta': 1.8.3_svelte@3.49.0 '@tryghost/content-api': 1.11.0 fitvids: 2.1.1 svelte-material-icons: 2.0.2_svelte@3.49.0 @@ -39,7 +44,7 @@ dependencies: devDependencies: '@sveltejs/adapter-auto': 1.0.0-next.63 '@sveltejs/adapter-node': 1.0.0-next.83 - '@sveltejs/kit': 1.0.0-next.392_svelte@3.49.0+vite@3.0.2 + '@sveltejs/kit': 1.0.0-next.393_svelte@3.49.0+vite@3.0.3 '@types/fitvids': 2.1.1 '@types/tryghost__content-api': 1.3.11 '@typescript-eslint/eslint-plugin': 5.30.7_f59730a40ab520cf82d095906622871f @@ -48,8 +53,11 @@ devDependencies: eslint: 8.20.0 eslint-config-prettier: 8.5.0_eslint@8.20.0 eslint-plugin-svelte3: 4.0.0_eslint@8.20.0+svelte@3.49.0 + hast-util-from-selector: 2.0.0 prettier: 2.7.1 prettier-plugin-svelte: 2.7.0_prettier@2.7.1+svelte@3.49.0 + rehype-parse: 8.0.4 + rehype-stringify: 9.0.3 sass: 1.54.0 svelte: 3.49.0 svelte-check: 2.8.0_sass@1.54.0+svelte@3.49.0 @@ -58,7 +66,9 @@ devDependencies: svelte2tsx: 0.5.12_svelte@3.49.0+typescript@4.7.4 tslib: 2.4.0 typescript: 4.7.4 - vite: 3.0.2_sass@1.54.0 + unified: 10.1.2 + unist-util-visit: 4.1.0 + vite: 3.0.3_sass@1.54.0 packages: @@ -66,8 +76,8 @@ packages: resolution: {integrity: sha512-B1/plF62pt+H2IJHvApK8fdOJAVsvojvacuac8x8s+JIyqbropMyqNqHTKLm3YD8ZFLGwYeFTudU+PQ7vGvBdA==} dev: true - /@damillora/plachta/1.8.2_svelte@3.49.0: - resolution: {integrity: sha512-if4acS53wl1IxlPzLuNymnicGikyThT3yoKlk1sFT7ITdLjh/9bIA2okxiLw6nNaVZOO+F+VoCSXtoMLZJYKUg==} + /@damillora/plachta/1.8.3_svelte@3.49.0: + resolution: {integrity: sha512-JuxfOb/0lJs4+v6GAXQuodRQ+zUlwT/wwOJ6HvgosiOEGGZhPUm6lQGs2zvwC0mnuM7GS7BBdiVfZce/Egsfrw==} dependencies: svelte-material-icons: 2.0.2_svelte@3.49.0 svelte-themes: 0.0.98 @@ -189,7 +199,7 @@ packages: resolution: {integrity: sha512-jIclgb58n3Uoo8TTudXSa7wmLP7Rn/ESLQS+zOUe0xsti5DG/eDhELTnSvkoSa2lJY21ym5rej/GSERRyeuBVw==} dependencies: '@cloudflare/workers-types': 3.14.1 - esbuild: 0.14.49 + esbuild: 0.14.50 worktop: 0.8.0-next.14 dev: true @@ -197,7 +207,7 @@ packages: resolution: {integrity: sha512-lIXY6KIgIFBz4+mdvilx9Ny8oFV7T2iVTKLirJayoI/SqPWGAcxklvWvjGfS4QT8rS9pWKDaKRUQM4M/gl8LlA==} dependencies: '@iarna/toml': 2.2.5 - esbuild: 0.14.49 + esbuild: 0.14.50 set-cookie-parser: 2.5.0 tiny-glob: 0.2.9 dev: true @@ -212,31 +222,31 @@ packages: resolution: {integrity: sha512-RV3HL7Ic7pGgIoBSHPwN1pBX96Km1X683oHImPHAKX9h/WOvJZ3bY5+IWNRcR8tx9rPB5gfMRg+msvPSBr3RVw==} dependencies: '@vercel/nft': 0.20.1 - esbuild: 0.14.49 + esbuild: 0.14.50 transitivePeerDependencies: - encoding - supports-color dev: true - /@sveltejs/kit/1.0.0-next.392_svelte@3.49.0+vite@3.0.2: - resolution: {integrity: sha512-od4rDJ/Soq0I7mda7sTbAnNKERHSDEGNa7QBpLA859xgBkwC1JnEIymYOh9dm+hMyHhB0bUoRoaur0qxKLqOOw==} + /@sveltejs/kit/1.0.0-next.393_svelte@3.49.0+vite@3.0.3: + resolution: {integrity: sha512-B7tCEcHJepsgJxY3jonOKhxGjB/58h9UWa7KZKvgSTswQOcuDZ9IXyQ1LRizc2BhcN2htUUVMuwU77NmM7jGFg==} engines: {node: '>=16.9'} hasBin: true peerDependencies: svelte: ^3.44.0 vite: ^3.0.0 dependencies: - '@sveltejs/vite-plugin-svelte': 1.0.1_svelte@3.49.0+vite@3.0.2 + '@sveltejs/vite-plugin-svelte': 1.0.1_svelte@3.49.0+vite@3.0.3 chokidar: 3.5.3 sade: 1.8.1 svelte: 3.49.0 - vite: 3.0.2_sass@1.54.0 + vite: 3.0.3_sass@1.54.0 transitivePeerDependencies: - diff-match-patch - supports-color dev: true - /@sveltejs/vite-plugin-svelte/1.0.1_svelte@3.49.0+vite@3.0.2: + /@sveltejs/vite-plugin-svelte/1.0.1_svelte@3.49.0+vite@3.0.3: resolution: {integrity: sha512-PorCgUounn0VXcpeJu+hOweZODKmGuLHsLomwqSj+p26IwjjGffmYQfVHtiTWq+NqaUuuHWWG7vPge6UFw4Aeg==} engines: {node: ^14.18.0 || >= 16} peerDependencies: @@ -254,7 +264,7 @@ packages: magic-string: 0.26.2 svelte: 3.49.0 svelte-hmr: 0.14.12_svelte@3.49.0 - vite: 3.0.2_sass@1.54.0 + vite: 3.0.3_sass@1.54.0 transitivePeerDependencies: - supports-color dev: true @@ -271,12 +281,22 @@ packages: resolution: {integrity: sha512-hMYSqGqE24Bx6nKb41SwoODA8ewTQRM3mrIznwgDjLQCvYonOXBb/Ju11nkDt7K6mlj8QF58h32+R7ah0mITbQ==} dev: true + /@types/hast/2.3.4: + resolution: {integrity: sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==} + dependencies: + '@types/unist': 2.0.6 + dev: true + /@types/json-schema/7.0.11: resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==} dev: true - /@types/node/18.6.0: - resolution: {integrity: sha512-WZ/6I1GL0DNAo4bb01lGGKTHH8BHJyECepf11kWONg3OJoHq2WYOm16Es1V54Er7NTUXsbDCpKRKdmBc4X2xhA==} + /@types/node/18.6.1: + resolution: {integrity: sha512-z+2vB6yDt1fNwKOeGbckpmirO+VBDuQqecXkgeIqDlaOtmKn6hPR/viQ8cxCfqLU4fTlvM3+YjM367TukWdxpg==} + dev: true + + /@types/parse5/6.0.3: + resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==} dev: true /@types/pug/2.0.6: @@ -286,13 +306,17 @@ packages: /@types/sass/1.43.1: resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==} dependencies: - '@types/node': 18.6.0 + '@types/node': 18.6.1 dev: true /@types/tryghost__content-api/1.3.11: resolution: {integrity: sha512-Gv8zoIVvIALZKjyZWa1dZT1WUtZgqLkpdH+tK/YlfL1JTEn+oeAEvj5AX/jjX2Scv7oaEc/SlZry4Km2xp+ZEw==} dev: true + /@types/unist/2.0.6: + resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==} + dev: true + /@typescript-eslint/eslint-plugin/5.30.7_f59730a40ab520cf82d095906622871f: resolution: {integrity: sha512-l4L6Do+tfeM2OK0GJsU7TUcM/1oN/N25xHm3Jb4z3OiDU4Lj8dIuxX9LpVMS9riSXQs42D1ieX7b85/r16H9Fw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -528,6 +552,10 @@ packages: - debug dev: false + /bail/2.0.2: + resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==} + dev: true + /balanced-match/1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} dev: true @@ -566,6 +594,10 @@ packages: engines: {node: '>=6'} dev: true + /ccount/2.0.1: + resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} + dev: true + /chalk/4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} @@ -574,6 +606,14 @@ packages: supports-color: 7.2.0 dev: true + /character-entities-html4/2.1.0: + resolution: {integrity: sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==} + dev: true + + /character-entities-legacy/3.0.0: + resolution: {integrity: sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==} + dev: true + /chokidar/3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} engines: {node: '>= 8.10.0'} @@ -617,6 +657,10 @@ packages: delayed-stream: 1.0.0 dev: false + /comma-separated-tokens/2.0.2: + resolution: {integrity: sha512-G5yTt3KQN4Yn7Yk4ed73hlZ1evrFKXeUW3086p3PRFNp7m2vIjI6Pg+Kgb+oyzhd9F2qdcoj67+y3SdxL5XWsg==} + dev: true + /concat-map/0.0.1: resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} dev: true @@ -634,6 +678,10 @@ packages: which: 2.0.2 dev: true + /css-selector-parser/1.4.1: + resolution: {integrity: sha512-HYPSb7y/Z7BNDCOrakL4raGO2zltZkbeXyAd6Tg9obzix6QhzxCotdBl6VT0Dv4vZfJGVz3WL/xaEI9Ly3ul0g==} + dev: true + /dayjs/1.11.4: resolution: {integrity: sha512-Zj/lPM5hOvQ1Bf7uAvewDaUcsJoI6JmNqmHhHl3nyumwe0XHwt8sWdOVAPACJzCebL8gQCi+K49w7iKWnGwX9g==} dev: true @@ -704,192 +752,192 @@ packages: resolution: {integrity: sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==} dev: true - /esbuild-android-64/0.14.49: - resolution: {integrity: sha512-vYsdOTD+yi+kquhBiFWl3tyxnj2qZJsl4tAqwhT90ktUdnyTizgle7TjNx6Ar1bN7wcwWqZ9QInfdk2WVagSww==} + /esbuild-android-64/0.14.50: + resolution: {integrity: sha512-H7iUEm7gUJHzidsBlFPGF6FTExazcgXL/46xxLo6i6bMtPim6ZmXyTccS8yOMpy6HAC6dPZ/JCQqrkkin69n6Q==} engines: {node: '>=12'} cpu: [x64] os: [android] dev: true optional: true - /esbuild-android-arm64/0.14.49: - resolution: {integrity: sha512-g2HGr/hjOXCgSsvQZ1nK4nW/ei8JUx04Li74qub9qWrStlysaVmadRyTVuW32FGIpLQyc5sUjjZopj49eGGM2g==} + /esbuild-android-arm64/0.14.50: + resolution: {integrity: sha512-NFaoqEwa+OYfoYVpQWDMdKII7wZZkAjtJFo1WdnBeCYlYikvUhTnf2aPwPu5qEAw/ie1NYK0yn3cafwP+kP+OQ==} engines: {node: '>=12'} cpu: [arm64] os: [android] dev: true optional: true - /esbuild-darwin-64/0.14.49: - resolution: {integrity: sha512-3rvqnBCtX9ywso5fCHixt2GBCUsogNp9DjGmvbBohh31Ces34BVzFltMSxJpacNki96+WIcX5s/vum+ckXiLYg==} + /esbuild-darwin-64/0.14.50: + resolution: {integrity: sha512-gDQsCvGnZiJv9cfdO48QqxkRV8oKAXgR2CGp7TdIpccwFdJMHf8hyIJhMW/05b/HJjET/26Us27Jx91BFfEVSA==} engines: {node: '>=12'} cpu: [x64] os: [darwin] dev: true optional: true - /esbuild-darwin-arm64/0.14.49: - resolution: {integrity: sha512-XMaqDxO846srnGlUSJnwbijV29MTKUATmOLyQSfswbK/2X5Uv28M9tTLUJcKKxzoo9lnkYPsx2o8EJcTYwCs/A==} + /esbuild-darwin-arm64/0.14.50: + resolution: {integrity: sha512-36nNs5OjKIb/Q50Sgp8+rYW/PqirRiFN0NFc9hEvgPzNJxeJedktXwzfJSln4EcRFRh5Vz4IlqFRScp+aiBBzA==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] dev: true optional: true - /esbuild-freebsd-64/0.14.49: - resolution: {integrity: sha512-NJ5Q6AjV879mOHFri+5lZLTp5XsO2hQ+KSJYLbfY9DgCu8s6/Zl2prWXVANYTeCDLlrIlNNYw8y34xqyLDKOmQ==} + /esbuild-freebsd-64/0.14.50: + resolution: {integrity: sha512-/1pHHCUem8e/R86/uR+4v5diI2CtBdiWKiqGuPa9b/0x3Nwdh5AOH7lj+8823C6uX1e0ufwkSLkS+aFZiBCWxA==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] dev: true optional: true - /esbuild-freebsd-arm64/0.14.49: - resolution: {integrity: sha512-lFLtgXnAc3eXYqj5koPlBZvEbBSOSUbWO3gyY/0+4lBdRqELyz4bAuamHvmvHW5swJYL7kngzIZw6kdu25KGOA==} + /esbuild-freebsd-arm64/0.14.50: + resolution: {integrity: sha512-iKwUVMQztnPZe5pUYHdMkRc9aSpvoV1mkuHlCoPtxZA3V+Kg/ptpzkcSY+fKd0kuom+l6Rc93k0UPVkP7xoqrw==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] dev: true optional: true - /esbuild-linux-32/0.14.49: - resolution: {integrity: sha512-zTTH4gr2Kb8u4QcOpTDVn7Z8q7QEIvFl/+vHrI3cF6XOJS7iEI1FWslTo3uofB2+mn6sIJEQD9PrNZKoAAMDiA==} + /esbuild-linux-32/0.14.50: + resolution: {integrity: sha512-sWUwvf3uz7dFOpLzYuih+WQ7dRycrBWHCdoXJ4I4XdMxEHCECd8b7a9N9u7FzT6XR2gHPk9EzvchQUtiEMRwqw==} engines: {node: '>=12'} cpu: [ia32] os: [linux] dev: true optional: true - /esbuild-linux-64/0.14.49: - resolution: {integrity: sha512-hYmzRIDzFfLrB5c1SknkxzM8LdEUOusp6M2TnuQZJLRtxTgyPnZZVtyMeCLki0wKgYPXkFsAVhi8vzo2mBNeTg==} + /esbuild-linux-64/0.14.50: + resolution: {integrity: sha512-u0PQxPhaeI629t4Y3EEcQ0wmWG+tC/LpP2K7yDFvwuPq0jSQ8SIN+ARNYfRjGW15O2we3XJvklbGV0wRuUCPig==} engines: {node: '>=12'} cpu: [x64] os: [linux] dev: true optional: true - /esbuild-linux-arm/0.14.49: - resolution: {integrity: sha512-iE3e+ZVv1Qz1Sy0gifIsarJMQ89Rpm9mtLSRtG3AH0FPgAzQ5Z5oU6vYzhc/3gSPi2UxdCOfRhw2onXuFw/0lg==} + /esbuild-linux-arm/0.14.50: + resolution: {integrity: sha512-VALZq13bhmFJYFE/mLEb+9A0w5vo8z+YDVOWeaf9vOTrSC31RohRIwtxXBnVJ7YKLYfEMzcgFYf+OFln3Y0cWg==} engines: {node: '>=12'} cpu: [arm] os: [linux] dev: true optional: true - /esbuild-linux-arm64/0.14.49: - resolution: {integrity: sha512-KLQ+WpeuY+7bxukxLz5VgkAAVQxUv67Ft4DmHIPIW+2w3ObBPQhqNoeQUHxopoW/aiOn3m99NSmSV+bs4BSsdA==} + /esbuild-linux-arm64/0.14.50: + resolution: {integrity: sha512-ZyfoNgsTftD7Rp5S7La5auomKdNeB3Ck+kSKXC4pp96VnHyYGjHHXWIlcbH8i+efRn9brszo1/Thl1qn8RqmhQ==} engines: {node: '>=12'} cpu: [arm64] os: [linux] dev: true optional: true - /esbuild-linux-mips64le/0.14.49: - resolution: {integrity: sha512-n+rGODfm8RSum5pFIqFQVQpYBw+AztL8s6o9kfx7tjfK0yIGF6tm5HlG6aRjodiiKkH2xAiIM+U4xtQVZYU4rA==} + /esbuild-linux-mips64le/0.14.50: + resolution: {integrity: sha512-ygo31Vxn/WrmjKCHkBoutOlFG5yM9J2UhzHb0oWD9O61dGg+Hzjz9hjf5cmM7FBhAzdpOdEWHIrVOg2YAi6rTw==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] dev: true optional: true - /esbuild-linux-ppc64le/0.14.49: - resolution: {integrity: sha512-WP9zR4HX6iCBmMFH+XHHng2LmdoIeUmBpL4aL2TR8ruzXyT4dWrJ5BSbT8iNo6THN8lod6GOmYDLq/dgZLalGw==} + /esbuild-linux-ppc64le/0.14.50: + resolution: {integrity: sha512-xWCKU5UaiTUT6Wz/O7GKP9KWdfbsb7vhfgQzRfX4ahh5NZV4ozZ4+SdzYG8WxetsLy84UzLX3Pi++xpVn1OkFQ==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] dev: true optional: true - /esbuild-linux-riscv64/0.14.49: - resolution: {integrity: sha512-h66ORBz+Dg+1KgLvzTVQEA1LX4XBd1SK0Fgbhhw4akpG/YkN8pS6OzYI/7SGENiN6ao5hETRDSkVcvU9NRtkMQ==} + /esbuild-linux-riscv64/0.14.50: + resolution: {integrity: sha512-0+dsneSEihZTopoO9B6Z6K4j3uI7EdxBP7YSF5rTwUgCID+wHD3vM1gGT0m+pjCW+NOacU9kH/WE9N686FHAJg==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] dev: true optional: true - /esbuild-linux-s390x/0.14.49: - resolution: {integrity: sha512-DhrUoFVWD+XmKO1y7e4kNCqQHPs6twz6VV6Uezl/XHYGzM60rBewBF5jlZjG0nCk5W/Xy6y1xWeopkrhFFM0sQ==} + /esbuild-linux-s390x/0.14.50: + resolution: {integrity: sha512-tVjqcu8o0P9H4StwbIhL1sQYm5mWATlodKB6dpEZFkcyTI8kfIGWiWcrGmkNGH2i1kBUOsdlBafPxR3nzp3TDA==} engines: {node: '>=12'} cpu: [s390x] os: [linux] dev: true optional: true - /esbuild-netbsd-64/0.14.49: - resolution: {integrity: sha512-BXaUwFOfCy2T+hABtiPUIpWjAeWK9P8O41gR4Pg73hpzoygVGnj0nI3YK4SJhe52ELgtdgWP/ckIkbn2XaTxjQ==} + /esbuild-netbsd-64/0.14.50: + resolution: {integrity: sha512-0R/glfqAQ2q6MHDf7YJw/TulibugjizBxyPvZIcorH0Mb7vSimdHy0XF5uCba5CKt+r4wjax1mvO9lZ4jiAhEg==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] dev: true optional: true - /esbuild-openbsd-64/0.14.49: - resolution: {integrity: sha512-lP06UQeLDGmVPw9Rg437Btu6J9/BmyhdoefnQ4gDEJTtJvKtQaUcOQrhjTq455ouZN4EHFH1h28WOJVANK41kA==} + /esbuild-openbsd-64/0.14.50: + resolution: {integrity: sha512-7PAtmrR5mDOFubXIkuxYQ4bdNS6XCK8AIIHUiZxq1kL8cFIH5731jPcXQ4JNy/wbj1C9sZ8rzD8BIM80Tqk29w==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] dev: true optional: true - /esbuild-sunos-64/0.14.49: - resolution: {integrity: sha512-4c8Zowp+V3zIWje329BeLbGh6XI9c/rqARNaj5yPHdC61pHI9UNdDxT3rePPJeWcEZVKjkiAS6AP6kiITp7FSw==} + /esbuild-sunos-64/0.14.50: + resolution: {integrity: sha512-gBxNY/wyptvD7PkHIYcq7se6SQEXcSC8Y7mE0FJB+CGgssEWf6vBPfTTZ2b6BWKnmaP6P6qb7s/KRIV5T2PxsQ==} engines: {node: '>=12'} cpu: [x64] os: [sunos] dev: true optional: true - /esbuild-windows-32/0.14.49: - resolution: {integrity: sha512-q7Rb+J9yHTeKr9QTPDYkqfkEj8/kcKz9lOabDuvEXpXuIcosWCJgo5Z7h/L4r7rbtTH4a8U2FGKb6s1eeOHmJA==} + /esbuild-windows-32/0.14.50: + resolution: {integrity: sha512-MOOe6J9cqe/iW1qbIVYSAqzJFh0p2LBLhVUIWdMVnNUNjvg2/4QNX4oT4IzgDeldU+Bym9/Tn6+DxvUHJXL5Zw==} engines: {node: '>=12'} cpu: [ia32] os: [win32] dev: true optional: true - /esbuild-windows-64/0.14.49: - resolution: {integrity: sha512-+Cme7Ongv0UIUTniPqfTX6mJ8Deo7VXw9xN0yJEN1lQMHDppTNmKwAM3oGbD/Vqff+07K2gN0WfNkMohmG+dVw==} + /esbuild-windows-64/0.14.50: + resolution: {integrity: sha512-r/qE5Ex3w1jjGv/JlpPoWB365ldkppUlnizhMxJgojp907ZF1PgLTuW207kgzZcSCXyquL9qJkMsY+MRtaZ5yQ==} engines: {node: '>=12'} cpu: [x64] os: [win32] dev: true optional: true - /esbuild-windows-arm64/0.14.49: - resolution: {integrity: sha512-v+HYNAXzuANrCbbLFJ5nmO3m5y2PGZWLe3uloAkLt87aXiO2mZr3BTmacZdjwNkNEHuH3bNtN8cak+mzVjVPfA==} + /esbuild-windows-arm64/0.14.50: + resolution: {integrity: sha512-EMS4lQnsIe12ZyAinOINx7eq2mjpDdhGZZWDwPZE/yUTN9cnc2Ze/xUTYIAyaJqrqQda3LnDpADKpvLvol6ENQ==} engines: {node: '>=12'} cpu: [arm64] os: [win32] dev: true optional: true - /esbuild/0.14.49: - resolution: {integrity: sha512-/TlVHhOaq7Yz8N1OJrjqM3Auzo5wjvHFLk+T8pIue+fhnhIMpfAzsG6PLVMbFveVxqD2WOp3QHei+52IMUNmCw==} + /esbuild/0.14.50: + resolution: {integrity: sha512-SbC3k35Ih2IC6trhbMYW7hYeGdjPKf9atTKwBUHqMCYFZZ9z8zhuvfnZihsnJypl74FjiAKjBRqFkBkAd0rS/w==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - esbuild-android-64: 0.14.49 - esbuild-android-arm64: 0.14.49 - esbuild-darwin-64: 0.14.49 - esbuild-darwin-arm64: 0.14.49 - esbuild-freebsd-64: 0.14.49 - esbuild-freebsd-arm64: 0.14.49 - esbuild-linux-32: 0.14.49 - esbuild-linux-64: 0.14.49 - esbuild-linux-arm: 0.14.49 - esbuild-linux-arm64: 0.14.49 - esbuild-linux-mips64le: 0.14.49 - esbuild-linux-ppc64le: 0.14.49 - esbuild-linux-riscv64: 0.14.49 - esbuild-linux-s390x: 0.14.49 - esbuild-netbsd-64: 0.14.49 - esbuild-openbsd-64: 0.14.49 - esbuild-sunos-64: 0.14.49 - esbuild-windows-32: 0.14.49 - esbuild-windows-64: 0.14.49 - esbuild-windows-arm64: 0.14.49 + esbuild-android-64: 0.14.50 + esbuild-android-arm64: 0.14.50 + esbuild-darwin-64: 0.14.50 + esbuild-darwin-arm64: 0.14.50 + esbuild-freebsd-64: 0.14.50 + esbuild-freebsd-arm64: 0.14.50 + esbuild-linux-32: 0.14.50 + esbuild-linux-64: 0.14.50 + esbuild-linux-arm: 0.14.50 + esbuild-linux-arm64: 0.14.50 + esbuild-linux-mips64le: 0.14.50 + esbuild-linux-ppc64le: 0.14.50 + esbuild-linux-riscv64: 0.14.50 + esbuild-linux-s390x: 0.14.50 + esbuild-netbsd-64: 0.14.50 + esbuild-openbsd-64: 0.14.50 + esbuild-sunos-64: 0.14.50 + esbuild-windows-32: 0.14.50 + esbuild-windows-64: 0.14.50 + esbuild-windows-arm64: 0.14.50 dev: true /escape-string-regexp/4.0.0: @@ -1042,6 +1090,10 @@ packages: engines: {node: '>=0.10.0'} dev: true + /extend/3.0.2: + resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} + dev: true + /fast-deep-equal/3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} dev: true @@ -1237,6 +1289,74 @@ packages: function-bind: 1.1.1 dev: true + /hast-util-from-parse5/7.1.0: + resolution: {integrity: sha512-m8yhANIAccpU4K6+121KpPP55sSl9/samzQSQGpb0mTExcNh2WlvjtMwSWFhg6uqD4Rr6Nfa8N6TMypQM51rzQ==} + dependencies: + '@types/hast': 2.3.4 + '@types/parse5': 6.0.3 + '@types/unist': 2.0.6 + hastscript: 7.0.2 + property-information: 6.1.1 + vfile: 5.3.4 + vfile-location: 4.0.1 + web-namespaces: 2.0.1 + dev: true + + /hast-util-from-selector/2.0.0: + resolution: {integrity: sha512-ynzm+z7xEecWF8DvnJ5onpGIsfmXphKRsZUnWCfinKwP+fL1/2mYW1nWOVife61syQpF74j4h/57BT6e5niDwA==} + dependencies: + '@types/hast': 2.3.4 + css-selector-parser: 1.4.1 + hastscript: 7.0.2 + zwitch: 2.0.2 + dev: true + + /hast-util-is-element/2.1.2: + resolution: {integrity: sha512-thjnlGAnwP8ef/GSO1Q8BfVk2gundnc2peGQqEg2kUt/IqesiGg/5mSwN2fE7nLzy61pg88NG6xV+UrGOrx9EA==} + dependencies: + '@types/hast': 2.3.4 + '@types/unist': 2.0.6 + dev: true + + /hast-util-parse-selector/3.1.0: + resolution: {integrity: sha512-AyjlI2pTAZEOeu7GeBPZhROx0RHBnydkQIXlhnFzDi0qfXTmGUWoCYZtomHbrdrheV4VFUlPcfJ6LMF5T6sQzg==} + dependencies: + '@types/hast': 2.3.4 + dev: true + + /hast-util-to-html/8.0.3: + resolution: {integrity: sha512-/D/E5ymdPYhHpPkuTHOUkSatxr4w1ZKrZsG0Zv/3C2SRVT0JFJG53VS45AMrBtYk0wp5A7ksEhiC8QaOZM95+A==} + dependencies: + '@types/hast': 2.3.4 + ccount: 2.0.1 + comma-separated-tokens: 2.0.2 + hast-util-is-element: 2.1.2 + hast-util-whitespace: 2.0.0 + html-void-elements: 2.0.1 + property-information: 6.1.1 + space-separated-tokens: 2.0.1 + stringify-entities: 4.0.3 + unist-util-is: 5.1.1 + dev: true + + /hast-util-whitespace/2.0.0: + resolution: {integrity: sha512-Pkw+xBHuV6xFeJprJe2BBEoDV+AvQySaz3pPDRUs5PNZEMQjpXJJueqrpcHIXxnWTcAGi/UOCgVShlkY6kLoqg==} + dev: true + + /hastscript/7.0.2: + resolution: {integrity: sha512-uA8ooUY4ipaBvKcMuPehTAB/YfFLSSzCwFSwT6ltJbocFUKH/GDHLN+tflq7lSRf9H86uOuxOFkh1KgIy3Gg2g==} + dependencies: + '@types/hast': 2.3.4 + comma-separated-tokens: 2.0.2 + hast-util-parse-selector: 3.1.0 + property-information: 6.1.1 + space-separated-tokens: 2.0.1 + dev: true + + /html-void-elements/2.0.1: + resolution: {integrity: sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==} + dev: true + /https-proxy-agent/5.0.1: resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} engines: {node: '>= 6'} @@ -1287,6 +1407,11 @@ packages: binary-extensions: 2.2.0 dev: true + /is-buffer/2.0.5: + resolution: {integrity: sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==} + engines: {node: '>=4'} + dev: true + /is-core-module/2.9.0: resolution: {integrity: sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==} dependencies: @@ -1315,6 +1440,11 @@ packages: engines: {node: '>=0.12.0'} dev: true + /is-plain-obj/4.1.0: + resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==} + engines: {node: '>=12'} + dev: true + /isexe/2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true @@ -1552,6 +1682,10 @@ packages: callsites: 3.1.0 dev: true + /parse5/6.0.1: + resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==} + dev: true + /pascal-case/3.1.2: resolution: {integrity: sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==} dependencies: @@ -1617,6 +1751,10 @@ packages: hasBin: true dev: true + /property-information/6.1.1: + resolution: {integrity: sha512-hrzC564QIl0r0vy4l6MvRLhafmUowhO/O3KgVSoXIbbA2Sz4j8HGpJc6T2cubRVwMwpdiG/vKGfhT4IixmKN9w==} + dev: true + /punycode/2.1.1: resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==} engines: {node: '>=6'} @@ -1652,6 +1790,23 @@ packages: engines: {node: '>=8'} dev: true + /rehype-parse/8.0.4: + resolution: {integrity: sha512-MJJKONunHjoTh4kc3dsM1v3C9kGrrxvA3U8PxZlP2SjH8RNUSrb+lF7Y0KVaUDnGH2QZ5vAn7ulkiajM9ifuqg==} + dependencies: + '@types/hast': 2.3.4 + hast-util-from-parse5: 7.1.0 + parse5: 6.0.1 + unified: 10.1.2 + dev: true + + /rehype-stringify/9.0.3: + resolution: {integrity: sha512-kWiZ1bgyWlgOxpqD5HnxShKAdXtb2IUljn3hQAhySeak6IOQPPt6DeGnsIh4ixm7yKJWzm8TXFuC/lPfcWHJqw==} + dependencies: + '@types/hast': 2.3.4 + hast-util-to-html: 8.0.3 + unified: 10.1.2 + dev: true + /resolve-from/4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} @@ -1801,6 +1956,10 @@ packages: resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==} dev: true + /space-separated-tokens/2.0.1: + resolution: {integrity: sha512-ekwEbFp5aqSPKaqeY1PGrlGQxPNaq+Cnx4+bE2D8sciBQrHpbwoBbawqTN2+6jPs9IdWxxiUcN0K2pkczD3zmw==} + dev: true + /string-width/4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -1816,6 +1975,13 @@ packages: safe-buffer: 5.2.1 dev: true + /stringify-entities/4.0.3: + resolution: {integrity: sha512-BP9nNHMhhfcMbiuQKCqMjhDP5yBCAxsPu4pHFFzJ6Alo9dZgY4VLDPutXqIjpRiMoKdp7Av85Gr73Q5uH9k7+g==} + dependencies: + character-entities-html4: 2.1.0 + character-entities-legacy: 3.0.0 + dev: true + /strip-ansi/6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} @@ -2003,6 +2169,10 @@ packages: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} dev: true + /trough/2.1.0: + resolution: {integrity: sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==} + dev: true + /tslib/1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} dev: true @@ -2039,6 +2209,43 @@ packages: hasBin: true dev: true + /unified/10.1.2: + resolution: {integrity: sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==} + dependencies: + '@types/unist': 2.0.6 + bail: 2.0.2 + extend: 3.0.2 + is-buffer: 2.0.5 + is-plain-obj: 4.1.0 + trough: 2.1.0 + vfile: 5.3.4 + dev: true + + /unist-util-is/5.1.1: + resolution: {integrity: sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==} + dev: true + + /unist-util-stringify-position/3.0.2: + resolution: {integrity: sha512-7A6eiDCs9UtjcwZOcCpM4aPII3bAAGv13E96IkawkOAW0OhH+yRxtY0lzo8KiHpzEMfH7Q+FizUmwp8Iqy5EWg==} + dependencies: + '@types/unist': 2.0.6 + dev: true + + /unist-util-visit-parents/5.1.0: + resolution: {integrity: sha512-y+QVLcY5eR/YVpqDsLf/xh9R3Q2Y4HxkZTp7ViLDU6WtJCEcPmRzW1gpdWDCDIqIlhuPDXOgttqPlykrHYDekg==} + dependencies: + '@types/unist': 2.0.6 + unist-util-is: 5.1.1 + dev: true + + /unist-util-visit/4.1.0: + resolution: {integrity: sha512-n7lyhFKJfVZ9MnKtqbsqkQEk5P1KShj0+//V7mAcoI6bpbUjh3C/OG8HVD+pBihfh6Ovl01m8dkcv9HNqYajmQ==} + dependencies: + '@types/unist': 2.0.6 + unist-util-is: 5.1.1 + unist-util-visit-parents: 5.1.0 + dev: true + /uri-js/4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: @@ -2053,8 +2260,31 @@ packages: resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==} dev: true - /vite/3.0.2_sass@1.54.0: - resolution: {integrity: sha512-TAqydxW/w0U5AoL5AsD9DApTvGb2iNbGs3sN4u2VdT1GFkQVUfgUldt+t08TZgi23uIauh1TUOQJALduo9GXqw==} + /vfile-location/4.0.1: + resolution: {integrity: sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==} + dependencies: + '@types/unist': 2.0.6 + vfile: 5.3.4 + dev: true + + /vfile-message/3.1.2: + resolution: {integrity: sha512-QjSNP6Yxzyycd4SVOtmKKyTsSvClqBPJcd00Z0zuPj3hOIjg0rUPG6DbFGPvUKRgYyaIWLPKpuEclcuvb3H8qA==} + dependencies: + '@types/unist': 2.0.6 + unist-util-stringify-position: 3.0.2 + dev: true + + /vfile/5.3.4: + resolution: {integrity: sha512-KI+7cnst03KbEyN1+JE504zF5bJBZa+J+CrevLeyIMq0aPU681I2rQ5p4PlnQ6exFtWiUrg26QUdFMnAKR6PIw==} + dependencies: + '@types/unist': 2.0.6 + is-buffer: 2.0.5 + unist-util-stringify-position: 3.0.2 + vfile-message: 3.1.2 + dev: true + + /vite/3.0.3_sass@1.54.0: + resolution: {integrity: sha512-sDIpIcl3mv1NUaSzZwiXGEy1ZoWwwC2vkxUHY6yiDacR6zf//ZFuBJrozO62gedpE43pmxnLATNR5IYUdAEkMQ==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true peerDependencies: @@ -2072,7 +2302,7 @@ packages: terser: optional: true dependencies: - esbuild: 0.14.49 + esbuild: 0.14.50 postcss: 8.4.14 resolve: 1.22.1 rollup: 2.77.0 @@ -2081,6 +2311,10 @@ packages: fsevents: 2.3.2 dev: true + /web-namespaces/2.0.1: + resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==} + dev: true + /webidl-conversions/3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} dev: true @@ -2126,3 +2360,7 @@ packages: /yallist/4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} dev: true + + /zwitch/2.0.2: + resolution: {integrity: sha512-JZxotl7SxAJH0j7dN4pxsTV6ZLXoLdGME+PsjkL/DaBrVryK9kTGq06GfKrwcSOqypP+fdXGoCHE36b99fWVoA==} + dev: true diff --git a/src/lib/components/ResponsiveHero.svelte b/src/lib/components/ResponsiveHero.svelte new file mode 100644 index 0000000..f480b97 --- /dev/null +++ b/src/lib/components/ResponsiveHero.svelte @@ -0,0 +1,23 @@ + + +{#if background} + +{:else} + +{/if} diff --git a/src/lib/content/postProcessor.ts b/src/lib/content/postProcessor.ts new file mode 100644 index 0000000..0497d3c --- /dev/null +++ b/src/lib/content/postProcessor.ts @@ -0,0 +1,70 @@ + +import { unified } from "unified"; +import type { Plugin } from "unified"; +import parse from "rehype-parse"; +import stringify from "rehype-stringify"; +import { visit } from 'unist-util-visit' +import { fromSelector } from 'hast-util-from-selector'; +import { generateSizesString, generateSrcsetString } from "./srcset"; + +const sizes = [300, 600, 1000, 1500, 2000]; + +const embedSrcs = [ + /'*player.vimeo.com.*/, + /.*youtube.com.*/, + /.*youtube-nocookie.com.*/, + /.*kickstarter.com.*video.html.*/, +]; + +const processEmbed = (parent: any, node: any) => { + const wrapper = fromSelector('div'); + wrapper.children = [node]; + + const width = node.properties.width; + const height = node.properties.height; + const aspect = height / width; + wrapper.properties = { + class: ['fluid-width-video-wrapper'], + style: `padding-top: ${aspect * 100}%` + }; + node.properties.height = null; + node.properties.width = null; + + parent.children = parent.children.filter((x: any) => x != node); + parent.children.unshift(wrapper); +} + +export const postProcessor: Plugin = () => { + return (tree) => { + visit(tree, 'element', (node: any, i: number, parent: any) => { + // Responsive + if (node.tagName == 'img') { + const src = node.properties.src; + const srcsetString = generateSrcsetString(src); + const sizesString = generateSizesString(); + node.properties.srcset = srcsetString; + node.properties.sizes = `${sizesString}`; + } + // Embeds + if (node.tagName == 'iframe') { + embedSrcs.forEach(x => { + if (node.properties.src.match(x)) { + processEmbed(parent, node); + } + }); + } + if (node.tagName == 'object' || node.tagName == 'embed') { + processEmbed(parent, node); + } + }) + } +} +export const processPostHtml = async (postHtml: string) => { + const processor = unified() + .use(parse) + .use(postProcessor) + .use(stringify); + + const result = await processor.process(postHtml); + return result.toString(); +} \ No newline at end of file diff --git a/src/lib/content/srcset.ts b/src/lib/content/srcset.ts new file mode 100644 index 0000000..e1c1c86 --- /dev/null +++ b/src/lib/content/srcset.ts @@ -0,0 +1,15 @@ + +const sizes = [300, 600, 1000, 1500, 2000]; + +export const generateSrcsetString = (src: string) => { + const srcsetString = sizes.map(x => { + const source = src.replace(`/content/images/`, `/content/images/size/w${x}/`) + return `${source} ${x}w`; + }).join(', '); + return srcsetString; +} + +export const generateSizesString = () => { + const sizesString = `(min-width: 768px) 640px, (min-width: 1024px) 768px, 100vw`; + return sizesString; +} \ No newline at end of file diff --git a/src/routes/[tag]/[slug].svelte b/src/routes/[tag]/[slug].svelte index 7b95306..172aee3 100644 --- a/src/routes/[tag]/[slug].svelte +++ b/src/routes/[tag]/[slug].svelte @@ -8,6 +8,8 @@ error: new Error('Post not found') }; } + const newHtml = await processPostHtml(post.html ?? ''); + post.html = newHtml; const prevPost = await browsePrevPost(post); const nextPost = await browseNextPost(post); const relatedPost = await browseRelatedPost(post.primary_tag?.slug, post.id); @@ -24,7 +26,6 @@ @@ -71,7 +62,8 @@ - + + diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index e8e395f..73235d4 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -62,3 +62,21 @@ + +