diff --git a/website/astro.config.mjs b/website/astro.config.mjs index f18ae37a..873712b1 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -5,11 +5,24 @@ import react from '@astrojs/react'; // https://astro.build/config import mdx from '@astrojs/mdx'; +import remarkToc from 'remark-toc'; +import rehypeSlug from 'rehype-slug'; +import rehypeAutolinkHeadings from 'rehype-autolink-headings'; + // https://astro.build/config // https://astro.build/config import tailwind from '@astrojs/tailwind'; +const options = { + // See https://mdxjs.com/advanced/plugins + remarkPlugins: [ + remarkToc, + // E.g. `remark-frontmatter` + ], + rehypePlugins: [rehypeSlug, rehypeAutolinkHeadings], +}; + // https://astro.build/config export default defineConfig({ integrations: [ @@ -17,7 +30,7 @@ export default defineConfig({ preact(), // Enable React for the Algolia search component. react(), - mdx(), + mdx(options), tailwind(), ], site: `https://strudel.tidalcycles.org`, diff --git a/website/package.json b/website/package.json index 47d39d07..7319cce3 100644 --- a/website/package.json +++ b/website/package.json @@ -30,7 +30,10 @@ "tailwindcss": "^3.2.4", "@heroicons/react": "^2.0.13", "@supabase/supabase-js": "^1.35.3", - "nanoid": "^4.0.0" + "nanoid": "^4.0.0", + "rehype-autolink-headings": "^6.1.1", + "rehype-slug": "^5.0.1", + "remark-toc": "^8.0.1" }, "devDependencies": { "html-escaper": "^3.0.3" diff --git a/website/src/components/Header/Header.astro b/website/src/components/Header/Header.astro index c7f672c8..a84b1a8e 100644 --- a/website/src/components/Header/Header.astro +++ b/website/src/components/Header/Header.astro @@ -15,7 +15,7 @@ const { currentPage } = Astro.props as Props; // const lang = getLanguageFromURL(currentPage); --- -