Conversation
- Adds unique html id slugs to heading elements. - Extracts these headings and turns them into a table of contents with links to the headings.
| @@ -0,0 +1,18 @@ | |||
| import GithubSlugger from 'github-slugger'; | |||
There was a problem hiding this comment.
Placing this script and export the resetHtmlIdSlugger in the astro file caused the compiler not to be able to find slugger. Extracting it to this file solves that issue. But the new problem is that now this script isn't really scoped to the provider anymore.
May need to use a different mechanism, like https://docs.astro.build/en/recipes/sharing-state/ ?
There was a problem hiding this comment.
Or maybe we could use an actual context with this library: https://withastro-utils.github.io/docs/guides/context/
| slugger.reset(); | ||
| }; | ||
|
|
||
| export const htmlIdSlug = ({ id, html }: { id?: string; html: string }) => { |
There was a problem hiding this comment.
should add test coverage for these methods
|
Implementation is blocked as the Help wanted: can we render the blocks using a different method? Or should we abandon this feature? Update: resolving this with |
However, this problem remains: ``` [ERROR] [vite] x Build failed in 1.25s [commonjs--resolver] [plugin vite:resolve] Cannot bundle Node.js built-in "node:path" imported from "node_modules/astro/dist/core/config/schema.js". Consider disabling ssr.noExternal or remove the built-in dependency. ```
Changes
Result:
Associated issue
N/A
How to test
Checklist