Updated blog post definition

This commit is contained in:
Anton Pogrebnjak
2025-02-09 01:12:55 +01:00
parent 76cb1c417a
commit a3e299f175
6 changed files with 300 additions and 113 deletions

View File

@@ -1,10 +1,16 @@
// @ts-check // @ts-check
import { defineConfig } from 'astro/config'; import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx'; import mdx from '@astrojs/mdx';
import remarkMath from 'remark-math'
import rehypeKatex from 'rehype-katex'
import sitemap from '@astrojs/sitemap'; import sitemap from '@astrojs/sitemap';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
site: 'https://pantonius.dev', site: 'https://pantonius.dev',
markdown: {
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex]
},
integrations: [mdx(), sitemap()], integrations: [mdx(), sitemap()],
}); });

297
package-lock.json generated
View File

@@ -7,10 +7,12 @@
"": { "": {
"version": "0.0.1", "version": "0.0.1",
"dependencies": { "dependencies": {
"@astrojs/mdx": "^4.0.3", "@astrojs/mdx": "^4.0.8",
"@astrojs/rss": "^4.0.10", "@astrojs/rss": "^4.0.10",
"@astrojs/sitemap": "^3.2.1", "@astrojs/sitemap": "^3.2.1",
"astro": "^5.0.3" "astro": "^5.0.3",
"rehype-katex": "^7.0.1",
"remark-math": "^6.0.0"
} }
}, },
"node_modules/@astrojs/compiler": { "node_modules/@astrojs/compiler": {
@@ -53,17 +55,17 @@
} }
}, },
"node_modules/@astrojs/mdx": { "node_modules/@astrojs/mdx": {
"version": "4.0.3", "version": "4.0.8",
"resolved": "https://registry.npmjs.org/@astrojs/mdx/-/mdx-4.0.3.tgz", "resolved": "https://registry.npmjs.org/@astrojs/mdx/-/mdx-4.0.8.tgz",
"integrity": "sha512-8HcuyNG/KgYUAQWVzKFkboXcTOBCW6aQ0WK0Er/iSmVSF0y3yimg4/3QSt+Twv9dogpwIHL+E8iBJKqieFv4+g==", "integrity": "sha512-/aiLr2yQ55W9AbpyOgfMtFXk7g2t7XoWdC2Avps/NqxAx4aYONDLneX43D79QwgqdjFhin7o3cIPp/vVppMbaA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@astrojs/markdown-remark": "6.0.1", "@astrojs/markdown-remark": "6.1.0",
"@mdx-js/mdx": "^3.1.0", "@mdx-js/mdx": "^3.1.0",
"acorn": "^8.14.0", "acorn": "^8.14.0",
"es-module-lexer": "^1.5.4", "es-module-lexer": "^1.6.0",
"estree-util-visit": "^2.0.0", "estree-util-visit": "^2.0.0",
"hast-util-to-html": "^9.0.3", "hast-util-to-html": "^9.0.4",
"kleur": "^4.1.5", "kleur": "^4.1.5",
"rehype-raw": "^7.0.0", "rehype-raw": "^7.0.0",
"remark-gfm": "^4.0.0", "remark-gfm": "^4.0.0",
@@ -80,9 +82,9 @@
} }
}, },
"node_modules/@astrojs/mdx/node_modules/@astrojs/markdown-remark": { "node_modules/@astrojs/mdx/node_modules/@astrojs/markdown-remark": {
"version": "6.0.1", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-6.0.1.tgz", "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-6.1.0.tgz",
"integrity": "sha512-CTSYijj25NfxgZi15TU3CwPwgyD1/7yA3FcdcNmB9p94nydupiUbrIiq3IqeTp2m5kCVzxbPZeC7fTwEOaNyGw==", "integrity": "sha512-emZNNSTPGgPc3V399Cazpp5+snogjaF04ocOSQn9vy3Kw/eIC4vTQjXOrWDEoSEy+AwPDZX9bQ4wd3bxhpmGgQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@astrojs/prism": "3.2.0", "@astrojs/prism": "3.2.0",
@@ -98,7 +100,8 @@
"remark-parse": "^11.0.0", "remark-parse": "^11.0.0",
"remark-rehype": "^11.1.1", "remark-rehype": "^11.1.1",
"remark-smartypants": "^3.0.2", "remark-smartypants": "^3.0.2",
"shiki": "^1.23.1", "shiki": "^1.29.1",
"smol-toml": "^1.3.1",
"unified": "^11.0.5", "unified": "^11.0.5",
"unist-util-remove-position": "^5.0.0", "unist-util-remove-position": "^5.0.0",
"unist-util-visit": "^5.0.0", "unist-util-visit": "^5.0.0",
@@ -1317,54 +1320,72 @@
] ]
}, },
"node_modules/@shikijs/core": { "node_modules/@shikijs/core": {
"version": "1.24.0", "version": "1.29.2",
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.24.0.tgz", "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.29.2.tgz",
"integrity": "sha512-6pvdH0KoahMzr6689yh0QJ3rCgF4j1XsXRHNEeEN6M4xJTfQ6QPWrmHzIddotg+xPJUPEPzYzYCKzpYyhTI6Gw==", "integrity": "sha512-vju0lY9r27jJfOY4Z7+Rt/nIOjzJpZ3y+nYpqtUZInVoXQ/TJZcfGnNOGnKjFdVZb8qexiCuSlZRKcGfhhTTZQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@shikijs/engine-javascript": "1.24.0", "@shikijs/engine-javascript": "1.29.2",
"@shikijs/engine-oniguruma": "1.24.0", "@shikijs/engine-oniguruma": "1.29.2",
"@shikijs/types": "1.24.0", "@shikijs/types": "1.29.2",
"@shikijs/vscode-textmate": "^9.3.0", "@shikijs/vscode-textmate": "^10.0.1",
"@types/hast": "^3.0.4", "@types/hast": "^3.0.4",
"hast-util-to-html": "^9.0.3" "hast-util-to-html": "^9.0.4"
} }
}, },
"node_modules/@shikijs/engine-javascript": { "node_modules/@shikijs/engine-javascript": {
"version": "1.24.0", "version": "1.29.2",
"resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.24.0.tgz", "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.29.2.tgz",
"integrity": "sha512-ZA6sCeSsF3Mnlxxr+4wGEJ9Tto4RHmfIS7ox8KIAbH0MTVUkw3roHPHZN+LlJMOHJJOVupe6tvuAzRpN8qK1vA==", "integrity": "sha512-iNEZv4IrLYPv64Q6k7EPpOCE/nuvGiKl7zxdq0WFuRPF5PAE9PRo2JGq/d8crLusM59BRemJ4eOqrFrC4wiQ+A==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@shikijs/types": "1.24.0", "@shikijs/types": "1.29.2",
"@shikijs/vscode-textmate": "^9.3.0", "@shikijs/vscode-textmate": "^10.0.1",
"oniguruma-to-es": "0.7.0" "oniguruma-to-es": "^2.2.0"
} }
}, },
"node_modules/@shikijs/engine-oniguruma": { "node_modules/@shikijs/engine-oniguruma": {
"version": "1.24.0", "version": "1.29.2",
"resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.24.0.tgz", "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.29.2.tgz",
"integrity": "sha512-Eua0qNOL73Y82lGA4GF5P+G2+VXX9XnuUxkiUuwcxQPH4wom+tE39kZpBFXfUuwNYxHSkrSxpB1p4kyRW0moSg==", "integrity": "sha512-7iiOx3SG8+g1MnlzZVDYiaeHe7Ez2Kf2HrJzdmGwkRisT7r4rak0e655AcM/tF9JG/kg5fMNYlLLKglbN7gBqA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@shikijs/types": "1.24.0", "@shikijs/types": "1.29.2",
"@shikijs/vscode-textmate": "^9.3.0" "@shikijs/vscode-textmate": "^10.0.1"
}
},
"node_modules/@shikijs/langs": {
"version": "1.29.2",
"resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-1.29.2.tgz",
"integrity": "sha512-FIBA7N3LZ+223U7cJDUYd5shmciFQlYkFXlkKVaHsCPgfVLiO+e12FmQE6Tf9vuyEsFe3dIl8qGWKXgEHL9wmQ==",
"license": "MIT",
"dependencies": {
"@shikijs/types": "1.29.2"
}
},
"node_modules/@shikijs/themes": {
"version": "1.29.2",
"resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-1.29.2.tgz",
"integrity": "sha512-i9TNZlsq4uoyqSbluIcZkmPL9Bfi3djVxRnofUHwvx/h6SRW3cwgBC5SML7vsDcWyukY0eCzVN980rqP6qNl9g==",
"license": "MIT",
"dependencies": {
"@shikijs/types": "1.29.2"
} }
}, },
"node_modules/@shikijs/types": { "node_modules/@shikijs/types": {
"version": "1.24.0", "version": "1.29.2",
"resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.24.0.tgz", "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.29.2.tgz",
"integrity": "sha512-aptbEuq1Pk88DMlCe+FzXNnBZ17LCiLIGWAeCWhoFDzia5Q5Krx3DgnULLiouSdd6+LUM39XwXGppqYE0Ghtug==", "integrity": "sha512-VJjK0eIijTZf0QSTODEXCqinjBn0joAHQ+aPSBzrv4O2d/QSbsMw+ZeSRx03kV34Hy7NzUvV/7NqfYGRLrASmw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@shikijs/vscode-textmate": "^9.3.0", "@shikijs/vscode-textmate": "^10.0.1",
"@types/hast": "^3.0.4" "@types/hast": "^3.0.4"
} }
}, },
"node_modules/@shikijs/vscode-textmate": { "node_modules/@shikijs/vscode-textmate": {
"version": "9.3.0", "version": "10.0.1",
"resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-9.3.0.tgz", "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.1.tgz",
"integrity": "sha512-jn7/7ky30idSkd/O5yDBfAnVt+JJpepofP/POZ1iMOxK59cOfqIgg/Dj0eFsjOTMw+4ycJN0uhZH/Eb0bs/EUA==", "integrity": "sha512-fTIQwLF+Qhuws31iw7Ncl1R3HUDtGwIipiJ9iU+UsDUwMhegFcQKQHd51nZjb7CArq0MvON8rbgCGQYWHUKAdg==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/acorn": { "node_modules/@types/acorn": {
@@ -1415,6 +1436,12 @@
"@types/unist": "*" "@types/unist": "*"
} }
}, },
"node_modules/@types/katex": {
"version": "0.16.7",
"resolved": "https://registry.npmjs.org/@types/katex/-/katex-0.16.7.tgz",
"integrity": "sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==",
"license": "MIT"
},
"node_modules/@types/mdast": { "node_modules/@types/mdast": {
"version": "4.0.4", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz",
@@ -1921,6 +1948,15 @@
"url": "https://github.com/sponsors/wooorm" "url": "https://github.com/sponsors/wooorm"
} }
}, },
"node_modules/commander": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz",
"integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==",
"license": "MIT",
"engines": {
"node": ">= 12"
}
},
"node_modules/common-ancestor-path": { "node_modules/common-ancestor-path": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz",
@@ -2077,9 +2113,9 @@
} }
}, },
"node_modules/es-module-lexer": { "node_modules/es-module-lexer": {
"version": "1.5.4", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.6.0.tgz",
"integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", "integrity": "sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/esast-util-from-estree": { "node_modules/esast-util-from-estree": {
@@ -2433,6 +2469,21 @@
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/hast-util-from-dom": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/hast-util-from-dom/-/hast-util-from-dom-5.0.1.tgz",
"integrity": "sha512-N+LqofjR2zuzTjCPzyDUdSshy4Ma6li7p/c3pA78uTwzFgENbgbUrm2ugwsOdcjI1muO+o6Dgzp9p8WHtn/39Q==",
"license": "ISC",
"dependencies": {
"@types/hast": "^3.0.0",
"hastscript": "^9.0.0",
"web-namespaces": "^2.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/hast-util-from-html": { "node_modules/hast-util-from-html": {
"version": "2.0.3", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/hast-util-from-html/-/hast-util-from-html-2.0.3.tgz", "resolved": "https://registry.npmjs.org/hast-util-from-html/-/hast-util-from-html-2.0.3.tgz",
@@ -2451,6 +2502,22 @@
"url": "https://opencollective.com/unified" "url": "https://opencollective.com/unified"
} }
}, },
"node_modules/hast-util-from-html-isomorphic": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/hast-util-from-html-isomorphic/-/hast-util-from-html-isomorphic-2.0.0.tgz",
"integrity": "sha512-zJfpXq44yff2hmE0XmwEOzdWin5xwH+QIhMLOScpX91e/NSGPsAzNCvLQDIEPyO2TXi+lBmU6hjLIhV8MwP2kw==",
"license": "MIT",
"dependencies": {
"@types/hast": "^3.0.0",
"hast-util-from-dom": "^5.0.0",
"hast-util-from-html": "^2.0.0",
"unist-util-remove-position": "^5.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/hast-util-from-parse5": { "node_modules/hast-util-from-parse5": {
"version": "8.0.2", "version": "8.0.2",
"resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-8.0.2.tgz", "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-8.0.2.tgz",
@@ -2566,9 +2633,9 @@
} }
}, },
"node_modules/hast-util-to-html": { "node_modules/hast-util-to-html": {
"version": "9.0.3", "version": "9.0.4",
"resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.3.tgz", "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.4.tgz",
"integrity": "sha512-M17uBDzMJ9RPCqLMO92gNNUDuBSq10a25SDBI08iCCxmorf4Yy6sYHK57n9WAbRAAaU+DuR4W6GN9K4DFZesYg==", "integrity": "sha512-wxQzXtdbhiwGAUKrnQJXlOPmHnEehzphwkK7aluUPQ+lEc1xefC8pblMgpp2w5ldBTEfveRIrADcrhGIWrlTDA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@types/hast": "^3.0.0", "@types/hast": "^3.0.0",
@@ -2880,6 +2947,22 @@
"js-yaml": "bin/js-yaml.js" "js-yaml": "bin/js-yaml.js"
} }
}, },
"node_modules/katex": {
"version": "0.16.21",
"resolved": "https://registry.npmjs.org/katex/-/katex-0.16.21.tgz",
"integrity": "sha512-XvqR7FgOHtWupfMiigNzmh+MgUVmDGU2kXZm899ZkPfcuoPuFxyHmXsgATDpFZDAXCI8tvinaVcDo8PIIJSo4A==",
"funding": [
"https://opencollective.com/katex",
"https://github.com/sponsors/katex"
],
"license": "MIT",
"dependencies": {
"commander": "^8.3.0"
},
"bin": {
"katex": "cli.js"
}
},
"node_modules/kleur": { "node_modules/kleur": {
"version": "4.1.5", "version": "4.1.5",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz",
@@ -3146,6 +3229,25 @@
"url": "https://opencollective.com/unified" "url": "https://opencollective.com/unified"
} }
}, },
"node_modules/mdast-util-math": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/mdast-util-math/-/mdast-util-math-3.0.0.tgz",
"integrity": "sha512-Tl9GBNeG/AhJnQM221bJR2HPvLOSnLE/T9cJI9tlc6zwQk2nPk/4f0cHkOdEixQPC/j8UtKDdITswvLAy1OZ1w==",
"license": "MIT",
"dependencies": {
"@types/hast": "^3.0.0",
"@types/mdast": "^4.0.0",
"devlop": "^1.0.0",
"longest-streak": "^3.0.0",
"mdast-util-from-markdown": "^2.0.0",
"mdast-util-to-markdown": "^2.1.0",
"unist-util-remove-position": "^5.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/mdast-util-mdx": { "node_modules/mdast-util-mdx": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz", "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz",
@@ -3491,6 +3593,25 @@
"url": "https://opencollective.com/unified" "url": "https://opencollective.com/unified"
} }
}, },
"node_modules/micromark-extension-math": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/micromark-extension-math/-/micromark-extension-math-3.1.0.tgz",
"integrity": "sha512-lvEqd+fHjATVs+2v/8kg9i5Q0AP2k85H0WUOwpIVvUML8BapsMvh1XAogmQjOCsLpoKRCVQqEkQBB3NhVBcsOg==",
"license": "MIT",
"dependencies": {
"@types/katex": "^0.16.0",
"devlop": "^1.0.0",
"katex": "^0.16.0",
"micromark-factory-space": "^2.0.0",
"micromark-util-character": "^2.0.0",
"micromark-util-symbol": "^2.0.0",
"micromark-util-types": "^2.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/micromark-extension-mdx-expression": { "node_modules/micromark-extension-mdx-expression": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.0.tgz", "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.0.tgz",
@@ -4101,14 +4222,14 @@
} }
}, },
"node_modules/oniguruma-to-es": { "node_modules/oniguruma-to-es": {
"version": "0.7.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-0.7.0.tgz", "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-2.3.0.tgz",
"integrity": "sha512-HRaRh09cE0gRS3+wi2zxekB+I5L8C/gN60S+vb11eADHUaB/q4u8wGGOX3GvwvitG8ixaeycZfeoyruKQzUgNg==", "integrity": "sha512-bwALDxriqfKGfUufKGGepCzu9x7nJQuoRoAFp4AnwehhC2crqrDIAP/uN2qdlsAvSMpeRC3+Yzhqc7hLmle5+g==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"emoji-regex-xs": "^1.0.0", "emoji-regex-xs": "^1.0.0",
"regex": "^5.0.2", "regex": "^5.1.1",
"regex-recursion": "^4.3.0" "regex-recursion": "^5.1.1"
} }
}, },
"node_modules/p-limit": { "node_modules/p-limit": {
@@ -4462,20 +4583,21 @@
} }
}, },
"node_modules/regex": { "node_modules/regex": {
"version": "5.0.2", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/regex/-/regex-5.0.2.tgz", "resolved": "https://registry.npmjs.org/regex/-/regex-5.1.1.tgz",
"integrity": "sha512-/pczGbKIQgfTMRV0XjABvc5RzLqQmwqxLHdQao2RTXPk+pmTXB2P0IaUHYdYyk412YLwUIkaeMd5T+RzVgTqnQ==", "integrity": "sha512-dN5I359AVGPnwzJm2jN1k0W9LPZ+ePvoOeVMMfqIMFz53sSwXkxaJoxr50ptnsC771lK95BnTrVSZxq0b9yCGw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"regex-utilities": "^2.3.0" "regex-utilities": "^2.3.0"
} }
}, },
"node_modules/regex-recursion": { "node_modules/regex-recursion": {
"version": "4.3.0", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-4.3.0.tgz", "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-5.1.1.tgz",
"integrity": "sha512-5LcLnizwjcQ2ALfOj95MjcatxyqF5RPySx9yT+PaXu3Gox2vyAtLDjHB8NTJLtMGkvyau6nI3CfpwFCjPUIs/A==", "integrity": "sha512-ae7SBCbzVNrIjgSbh7wMznPcQel1DNlDtzensnFxpiNpXt1U2ju/bHugH422r+4LAVS1FpW1YCwilmnNsjum9w==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"regex": "^5.1.1",
"regex-utilities": "^2.3.0" "regex-utilities": "^2.3.0"
} }
}, },
@@ -4501,6 +4623,25 @@
"url": "https://opencollective.com/unified" "url": "https://opencollective.com/unified"
} }
}, },
"node_modules/rehype-katex": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/rehype-katex/-/rehype-katex-7.0.1.tgz",
"integrity": "sha512-OiM2wrZ/wuhKkigASodFoo8wimG3H12LWQaH8qSPVJn9apWKFSH3YOCtbKpBorTVw/eI7cuT21XBbvwEswbIOA==",
"license": "MIT",
"dependencies": {
"@types/hast": "^3.0.0",
"@types/katex": "^0.16.0",
"hast-util-from-html-isomorphic": "^2.0.0",
"hast-util-to-text": "^4.0.0",
"katex": "^0.16.0",
"unist-util-visit-parents": "^6.0.0",
"vfile": "^6.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/rehype-parse": { "node_modules/rehype-parse": {
"version": "9.0.1", "version": "9.0.1",
"resolved": "https://registry.npmjs.org/rehype-parse/-/rehype-parse-9.0.1.tgz", "resolved": "https://registry.npmjs.org/rehype-parse/-/rehype-parse-9.0.1.tgz",
@@ -4579,6 +4720,22 @@
"url": "https://opencollective.com/unified" "url": "https://opencollective.com/unified"
} }
}, },
"node_modules/remark-math": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/remark-math/-/remark-math-6.0.0.tgz",
"integrity": "sha512-MMqgnP74Igy+S3WwnhQ7kqGlEerTETXMvJhrUzDikVZ2/uogJCb+WHUg97hK9/jcfc0dkD73s3LN8zU49cTEtA==",
"license": "MIT",
"dependencies": {
"@types/mdast": "^4.0.0",
"mdast-util-math": "^3.0.0",
"micromark-extension-math": "^3.0.0",
"unified": "^11.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/remark-mdx": { "node_modules/remark-mdx": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.1.0.tgz", "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.1.0.tgz",
@@ -4847,16 +5004,18 @@
} }
}, },
"node_modules/shiki": { "node_modules/shiki": {
"version": "1.24.0", "version": "1.29.2",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-1.24.0.tgz", "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.29.2.tgz",
"integrity": "sha512-qIneep7QRwxRd5oiHb8jaRzH15V/S8F3saCXOdjwRLgozZJr5x2yeBhQtqkO3FSzQDwYEFAYuifg4oHjpDghrg==", "integrity": "sha512-njXuliz/cP+67jU2hukkxCNuH1yUi4QfdZZY+sMr5PPrIyXSu5iTb/qYC4BiWWB0vZ+7TbdvYUCeL23zpwCfbg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@shikijs/core": "1.24.0", "@shikijs/core": "1.29.2",
"@shikijs/engine-javascript": "1.24.0", "@shikijs/engine-javascript": "1.29.2",
"@shikijs/engine-oniguruma": "1.24.0", "@shikijs/engine-oniguruma": "1.29.2",
"@shikijs/types": "1.24.0", "@shikijs/langs": "1.29.2",
"@shikijs/vscode-textmate": "^9.3.0", "@shikijs/themes": "1.29.2",
"@shikijs/types": "1.29.2",
"@shikijs/vscode-textmate": "^10.0.1",
"@types/hast": "^3.0.4" "@types/hast": "^3.0.4"
} }
}, },
@@ -4901,6 +5060,18 @@
"integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==", "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/smol-toml": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.3.1.tgz",
"integrity": "sha512-tEYNll18pPKHroYSmLLrksq233j021G0giwW7P3D24jC54pQ5W5BXMsQ/Mvw1OJCmEYDgY+lrzT+3nNUtoNfXQ==",
"license": "BSD-3-Clause",
"engines": {
"node": ">= 18"
},
"funding": {
"url": "https://github.com/sponsors/cyyynthia"
}
},
"node_modules/source-map": { "node_modules/source-map": {
"version": "0.7.4", "version": "0.7.4",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz",

View File

@@ -9,9 +9,11 @@
"astro": "astro" "astro": "astro"
}, },
"dependencies": { "dependencies": {
"@astrojs/mdx": "^4.0.3", "@astrojs/mdx": "^4.0.8",
"@astrojs/rss": "^4.0.10", "@astrojs/rss": "^4.0.10",
"@astrojs/sitemap": "^3.2.1", "@astrojs/sitemap": "^3.2.1",
"astro": "^5.0.3" "astro": "^5.0.3",
"rehype-katex": "^7.0.1",
"remark-math": "^6.0.0"
} }
} }

View File

@@ -1,61 +1,69 @@
import type { InferEntrySchema, RenderedContent } from "astro:content"; import type { InferEntrySchema, RenderedContent } from "astro:content";
export type CollectionPost = { export type CollectionPost = {
id: string; id: string;
body?: string; body?: string;
collection: "blog" | "projects"; collection: "blog" | "projects";
data: InferEntrySchema<"blog"> | InferEntrySchema<"projects">; data: InferEntrySchema<"blog"> | InferEntrySchema<"projects">;
rendered?: RenderedContent; rendered?: RenderedContent;
filePath?: string; filePath?: string;
digest?: string;
deferredRender?: boolean;
}; };
export const isCollectionPost = (post: any): post is CollectionPost => { export const isCollectionPost = (post: any): post is CollectionPost => {
return post.collection === "blog" || post.collection === "projects"; return post.collection === "blog" || post.collection === "projects";
} }
export type Post = { export type Post = {
id: string; id: string;
title: string; title: string;
heroImage?: string; heroImage?: string;
pubDate: Date; pubDate: Date;
updatedDate?: Date; updatedDate?: Date;
description: string; description: string;
rendered?: RenderedContent; rendered?: RenderedContent;
filePath?: string; filePath?: string;
body?: string; body?: string;
collection: "blog" | "projects"; digest?: string;
deferredRender?: boolean;
collection: "blog" | "projects";
}; };
export const convertPost = (post: CollectionPost): Post => { export const convertPost = (post: CollectionPost): Post => {
return { return {
id: post.id, id: post.id,
title: post.data.title, title: post.data.title,
heroImage: post.data.heroImage, heroImage: post.data.heroImage,
pubDate: new Date(post.data.pubDate), pubDate: new Date(post.data.pubDate),
updatedDate: post.data.updatedDate ? new Date(post.data.updatedDate) : undefined, updatedDate: post.data.updatedDate ? new Date(post.data.updatedDate) : undefined,
description: post.data.description, description: post.data.description,
rendered: post.rendered, rendered: post.rendered,
filePath: post.filePath, filePath: post.filePath,
body: post.body, body: post.body,
collection: post.collection digest: post.digest,
}; deferredRender: post.deferredRender,
collection: post.collection
};
} }
export const convertCollectionPost = (post: Post): CollectionPost => { export const convertCollectionPost = (post: Post): CollectionPost => {
return { return {
id: post.id, id: post.id,
collection: post.collection, collection: post.collection,
data: { data: {
title: post.title, title: post.title,
heroImage: post.heroImage, heroImage: post.heroImage,
pubDate: post.pubDate, pubDate: post.pubDate,
updatedDate: post.updatedDate, updatedDate: post.updatedDate,
description: post.description description: post.description
}, },
rendered: post.rendered, rendered: post.rendered,
filePath: post.filePath, filePath: post.filePath,
body: post.body body: post.body,
}; digest: post.digest,
} deferredRender: post.deferredRender
};
}

View File

@@ -1,5 +1,5 @@
--- ---
import { type CollectionEntry, getCollection } from 'astro:content'; import { getCollection } from 'astro:content';
import BlogPost from '../../layouts/BlogPost.astro'; import BlogPost from '../../layouts/BlogPost.astro';
import { render } from 'astro:content'; import { render } from 'astro:content';
import { convertCollectionPost, convertPost, type Post } from '../../models/Post'; import { convertCollectionPost, convertPost, type Post } from '../../models/Post';
@@ -11,7 +11,7 @@ export async function getStaticPaths() {
props: post, props: post,
})); }));
} }
type Props = CollectionEntry<'blog'>; type Props = Post;
const post: Post = Astro.props; const post: Post = Astro.props;
const { Content } = await render(convertCollectionPost(post)); const { Content } = await render(convertCollectionPost(post));

View File

@@ -1,5 +1,5 @@
--- ---
import { type CollectionEntry, getCollection } from 'astro:content'; import { getCollection } from 'astro:content';
import BlogPost from '../../layouts/BlogPost.astro'; import BlogPost from '../../layouts/BlogPost.astro';
import { render } from 'astro:content'; import { render } from 'astro:content';
import { convertCollectionPost, convertPost, type Post } from '../../models/Post'; import { convertCollectionPost, convertPost, type Post } from '../../models/Post';
@@ -11,7 +11,7 @@ export async function getStaticPaths() {
props: post, props: post,
})); }));
} }
type Props = CollectionEntry<'projects'>; type Props = Post;
const post: Post = Astro.props; const post: Post = Astro.props;
const { Content } = await render(convertCollectionPost(post)); const { Content } = await render(convertCollectionPost(post));