style: add highlight hover animation to navigation and footer

- add dynamic accessible labels to heading anchors
- update theme toggle button svg
This commit is contained in:
radishzzz 2025-05-13 23:33:09 +01:00
parent 2d80d7effd
commit 610c86db0d
21 changed files with 131 additions and 108 deletions

View file

@ -1,3 +1,4 @@
import type { Element } from 'hast'
import mdx from '@astrojs/mdx'
import partytown from '@astrojs/partytown'
import sitemap from '@astrojs/sitemap'
@ -9,6 +10,7 @@ import rehypeKatex from 'rehype-katex'
import rehypeSlug from 'rehype-slug'
import remarkDirective from 'remark-directive'
import remarkMath from 'remark-math'
import { visit } from 'unist-util-visit'
import UnoCSS from 'unocss/astro'
import { themeConfig } from './src/config'
import { langMap } from './src/i18n/config'
@ -98,9 +100,17 @@ export default defineConfig({
},
],
},
properties: {
className: ['heading-anchor-link'],
ariaLabel: 'Link to this section',
properties: (el: Element) => {
let text = ''
visit(el, 'text', (textNode) => {
text += textNode.value
})
return {
className: ['heading-anchor-link'],
ariaLabel: text
? `Link to ${text.replace(/["']/g, char => char === '"' ? '"' : ''')}`
: undefined,
}
},
},
],