diff --git a/my-astro-site/astro.config.mjs b/my-astro-site/astro.config.mjs index d9187b0..dba831b 100644 --- a/my-astro-site/astro.config.mjs +++ b/my-astro-site/astro.config.mjs @@ -1,15 +1,20 @@ import { defineConfig } from "astro/config"; import serviceWorker from 'astro-service-worker'; + import Icons from 'unplugin-icons/vite'; import IconsResolver from 'unplugin-icons/resolver'; import AutoImport from 'unplugin-auto-import/vite'; + import solid from "@astrojs/solid-js"; import tailwind from "@astrojs/tailwind"; import sitemap from "@astrojs/sitemap"; + import { outDir } from "./shared.config.js"; import compress from "astro-compress"; +import { h } from "hastscript"; + // https://astro.build/config export default defineConfig({ outDir, @@ -19,6 +24,17 @@ export default defineConfig({ }, site: "https://bundlejs.com", markdown: { + rehypePlugins: [ + [ + "rehype-autolink-headings", + { + behavior: "append", + content: [h("i.material-symbols-rounded", { "aria-hidden": "true" }, "insert_link")], + test: ['h2', 'h3', 'h4', 'h5', 'h6'] + }, + ], + ["rehype-external-links", { target: "_blank", rel: ["noopener"] }] + ], // remarkPlugins: [], shikiConfig: { // Choose from Shiki's built-in themes (or add your own) diff --git a/my-astro-site/package.json b/my-astro-site/package.json index 7e02c67..2331ad8 100644 --- a/my-astro-site/package.json +++ b/my-astro-site/package.json @@ -17,6 +17,8 @@ "astro-compress": "^0.0.6", "astro-icon": "^0.7.1", "astro-service-worker": "^0.1.2", + "hastscript": "^7.0.2", + "rehype-autolink-headings": "^6.1.1", "rehype-external-links": "^1.0.1", "sass": "^1.52.1", "solid-js": "^1.3.6", diff --git a/my-astro-site/pnpm-lock.yaml b/my-astro-site/pnpm-lock.yaml index 8cd1831..0ae44fa 100644 --- a/my-astro-site/pnpm-lock.yaml +++ b/my-astro-site/pnpm-lock.yaml @@ -11,6 +11,8 @@ specifiers: astro-compress: ^0.0.6 astro-icon: ^0.7.1 astro-service-worker: ^0.1.2 + hastscript: ^7.0.2 + rehype-autolink-headings: ^6.1.1 rehype-external-links: ^1.0.1 sass: ^1.52.1 solid-js: ^1.3.6 @@ -30,6 +32,8 @@ devDependencies: astro-compress: 0.0.6 astro-icon: 0.7.1 astro-service-worker: 0.1.2 + hastscript: 7.0.2 + rehype-autolink-headings: 6.1.1 rehype-external-links: 1.0.1 sass: 1.52.1 solid-js: 1.4.3 @@ -3093,6 +3097,16 @@ packages: web-namespaces: 2.0.1 dev: true + /hast-util-has-property/2.0.0: + resolution: {integrity: sha512-4Qf++8o5v14us4Muv3HRj+Er6wTNGA/N9uCaZMty4JWvyFKLdhULrv4KE1b65AthsSO9TXSZnjuxS8ecIyhb0w==} + dev: true + + /hast-util-heading-rank/2.1.0: + resolution: {integrity: sha512-w+Rw20Q/iWp2Bcnr6uTrYU6/ftZLbHKhvc8nM26VIWpDqDMlku2iXUVTeOlsdoih/UKQhY7PHQ+vZ0Aqq8bxtQ==} + dependencies: + '@types/hast': 2.3.4 + dev: true + /hast-util-is-element/2.1.2: resolution: {integrity: sha512-thjnlGAnwP8ef/GSO1Q8BfVk2gundnc2peGQqEg2kUt/IqesiGg/5mSwN2fE7nLzy61pg88NG6xV+UrGOrx9EA==} dependencies: @@ -4693,6 +4707,18 @@ packages: jsesc: 0.5.0 dev: true + /rehype-autolink-headings/6.1.1: + resolution: {integrity: sha512-NMYzZIsHM3sA14nC5rAFuUPIOfg+DFmf9EY1YMhaNlB7+3kK/ZlE6kqPfuxr1tsJ1XWkTrMtMoyHosU70d35mA==} + dependencies: + '@types/hast': 2.3.4 + extend: 3.0.2 + hast-util-has-property: 2.0.0 + hast-util-heading-rank: 2.1.0 + hast-util-is-element: 2.1.2 + unified: 10.1.2 + unist-util-visit: 4.1.0 + dev: true + /rehype-external-links/1.0.1: resolution: {integrity: sha512-SrMMtIO2tPLWDfvibhECAn9cuEMW6Fi40ZVK2UQSPTnDEv3LraLzGVyKGb/vrDlUy4RCYTcmm0rq/ss9nPqrsw==} dependencies: diff --git a/my-astro-site/src/components/Footer.astro b/my-astro-site/src/components/Footer.astro index 509a457..f41e13f 100644 --- a/my-astro-site/src/components/Footer.astro +++ b/my-astro-site/src/components/Footer.astro @@ -5,7 +5,6 @@ import Container from "./Container.astro"; import { ThemeSwitch } from "./ThemeSwitch"; import Button from "./Button"; - ---