diff --git a/astro.config.mjs b/astro.config.mjs index 1e5509c6..925d5262 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,15 +1,22 @@ import { defineConfig } from 'astro/config'; import tailwind from '@astrojs/tailwind'; - +import remarkSectionize from 'remark-sectionize'; import expressiveCode from 'astro-expressive-code'; /** @type {import('astro-expressive-code').AstroExpressiveCodeOptions} */ const astroExpressiveCodeOptions = { - themes: ['material-theme-ocean'], + themes: ['material-theme-ocean', 'material-theme-palenight'], }; // https://astro.build/config export default defineConfig({ - integrations: [tailwind(), expressiveCode(astroExpressiveCodeOptions)], + markdown: { + remarkPlugins: [remarkSectionize], + }, + integrations: [ + tailwind({ + applyBaseStyles: false, + }), + expressiveCode(astroExpressiveCodeOptions), + ], }); - diff --git a/package-lock.json b/package-lock.json index e101e61d..3a023331 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,8 @@ "dependencies": { "@astrojs/tailwind": "^5.0.3", "astro": "^4.0.6", - "astro-expressive-code": "^0.30.1" + "astro-expressive-code": "^0.30.1", + "remark-sectionize": "^2.0.0" }, "devDependencies": { "@tailwindcss/typography": "^0.5.10", @@ -5617,6 +5618,59 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-sectionize": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/remark-sectionize/-/remark-sectionize-2.0.0.tgz", + "integrity": "sha512-B+sCNNQroXybxX5Gwu9xbkjFIgK6vHMwbgPM/CEzQTP2ODxUiBsQRBjoSC6XR+yPOkgHvXV83HWCNA8IZuvJKg==", + "dependencies": { + "unist-util-find-after": "^4.0.1", + "unist-util-visit": "^4.1.2" + } + }, + "node_modules/remark-sectionize/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/remark-sectionize/node_modules/unist-util-is": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", + "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-sectionize/node_modules/unist-util-visit": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.2.tgz", + "integrity": "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0", + "unist-util-visit-parents": "^5.1.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-sectionize/node_modules/unist-util-visit-parents": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz", + "integrity": "sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark-smartypants": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/remark-smartypants/-/remark-smartypants-2.0.0.tgz", @@ -6771,6 +6825,36 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/unist-util-find-after": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/unist-util-find-after/-/unist-util-find-after-4.0.1.tgz", + "integrity": "sha512-QO/PuPMm2ERxC6vFXEPtmAutOopy5PknD+Oq64gGwxKtk4xwo9Z97t9Av1obPmGU0IyTa6EKYUfTrK2QJS3Ozw==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-find-after/node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" + }, + "node_modules/unist-util-find-after/node_modules/unist-util-is": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.2.1.tgz", + "integrity": "sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/unist-util-is": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", diff --git a/package.json b/package.json index 00819702..d079bfa5 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "dependencies": { "@astrojs/tailwind": "^5.0.3", "astro": "^4.0.6", - "astro-expressive-code": "^0.30.1" + "astro-expressive-code": "^0.30.1", + "remark-sectionize": "^2.0.0" }, "devDependencies": { "@tailwindcss/typography": "^0.5.10", diff --git a/src/components/BlogIndex.astro b/src/components/BlogIndex.astro index ddd5feac..11435aee 100644 --- a/src/components/BlogIndex.astro +++ b/src/components/BlogIndex.astro @@ -1,24 +1,25 @@ --- const allPosts = await Astro.glob('../pages/posts/*.md'); -const { styles = '' } = Astro.props; +const { class: className } = Astro.props; let displayPosts = Astro.props.postCount ? allPosts.slice(-Astro.props.postCount) : allPosts; --- -