Skip to content

Commit 7cea0d6

Browse files
feat(config): create anchor links for headings (#74)
This makes it easier to e.g. reference particular atuin config keys in the documentation. Preview: ![Screenshot 2024-08-18 at 12-19-40 Syncing dotfiles Atuin Docs](https://github.com/user-attachments/assets/d31d85cd-d33e-4140-a46c-e9acd875bef3)
1 parent c08b284 commit 7cea0d6

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

astro.config.mjs

+19
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
import { defineConfig } from 'astro/config';
22
import starlightLinksValidator from 'starlight-links-validator'
33
import starlight from '@astrojs/starlight';
4+
import rehypeSlug from 'rehype-slug';
5+
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
46

57
// https://astro.build/config
68
export default defineConfig({
79
site: "https://docs.atuin.sh",
10+
markdown: {
11+
rehypePlugins: [
12+
rehypeSlug,
13+
[
14+
rehypeAutolinkHeadings,
15+
{
16+
behavior: 'wrap',
17+
headingProperties: {
18+
className: ['anchor'],
19+
},
20+
properties: {
21+
className: ['anchor-link'],
22+
},
23+
}
24+
]
25+
]
26+
},
827
integrations: [
928
starlight({
1029
plugins: [starlightLinksValidator()],

package-lock.json

+63
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"@astrojs/check": "^0.5.6",
1414
"@astrojs/starlight": "^0.20.1",
1515
"astro": "^4.4.6",
16+
"rehype-autolink-headings": "^7.1.0",
17+
"rehype-slug": "^6.0.0",
1618
"sharp": "^0.33.2",
1719
"starlight-links-validator": "^0.5.3",
1820
"typescript": "^5.3.3"

0 commit comments

Comments
 (0)