diff --git a/astro.config.ts b/astro.config.ts index b7193cf..95964f8 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -13,6 +13,7 @@ import rehypePrettyCode from 'rehype-pretty-code' // import sectionize from '@hbsnow/rehype-sectionize' import remarkEmoji from 'remark-emoji' import remarkMath from 'remark-math' +import remarkSectionize from 'remark-sectionize' import remarkToc from 'remark-toc' import { pluginCollapsibleSections } from '@expressive-code/plugin-collapsible-sections' @@ -102,6 +103,6 @@ export default defineConfig({ }, ], ], - remarkPlugins: [remarkToc, remarkMath, remarkEmoji], + remarkPlugins: [remarkToc, remarkMath, remarkEmoji, remarkSectionize], }, }) diff --git a/package-lock.json b/package-lock.json index 0606e24..29fce4c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "astro-erudite", "version": "1.3.0", + "hasInstallScript": true, "dependencies": { "@astrojs/check": "^0.9.4", "@astrojs/markdown-remark": "^6.3.1", @@ -44,6 +45,7 @@ "rehype-pretty-code": "^0.14.1", "remark-emoji": "^5.0.1", "remark-math": "^6.0.0", + "remark-sectionize": "^2.1.0", "remark-toc": "^9.0.0", "tailwind-merge": "^3.0.1", "tailwindcss": "^4.0.7", @@ -9137,6 +9139,72 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-sectionize": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/remark-sectionize/-/remark-sectionize-2.1.0.tgz", + "integrity": "sha512-R/pHt1RLYrEqrbwOVXx8HnvvwOg+mxg8pE4kIWpIYE3/CuZhU8/PAx/0y1BbHWUA0jmTLTeWpUlDrS/B0pyd0g==", + "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.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==" + }, + "node_modules/remark-sectionize/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/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": "3.0.2", "resolved": "https://registry.npmjs.org/remark-smartypants/-/remark-smartypants-3.0.2.tgz", diff --git a/package.json b/package.json index 8f5506b..dd3f7dc 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "@astrojs/sitemap": "^3.3.0", "@expressive-code/plugin-collapsible-sections": "^0.40.2", "@expressive-code/plugin-line-numbers": "^0.40.2", - "@hbsnow/rehype-sectionize": "^1.0.7", "@iconify-json/lucide": "^1.2.26", "@radix-ui/react-avatar": "^1.1.3", "@radix-ui/react-dropdown-menu": "^2.1.6", @@ -30,7 +29,6 @@ "@radix-ui/react-separator": "^1.1.2", "@radix-ui/react-slot": "^1.1.2", "@rehype-pretty/transformers": "^0.13.2", - "@shikijs/transformers": "^1.29.2", "@tailwindcss/vite": "^4.0.7", "@types/react": "19.0.0", "@types/react-dom": "19.0.0", @@ -49,6 +47,7 @@ "rehype-pretty-code": "^0.14.1", "remark-emoji": "^5.0.1", "remark-math": "^6.0.0", + "remark-sectionize": "^2.1.0", "remark-toc": "^9.0.0", "tailwind-merge": "^3.0.1", "tailwindcss": "^4.0.7", diff --git a/src/components/TableOfContents.astro b/src/components/TableOfContents.astro index 31ba042..0075a41 100644 --- a/src/components/TableOfContents.astro +++ b/src/components/TableOfContents.astro @@ -63,7 +63,7 @@ function buildToc(headings: Heading[]): Heading[] {