Skip to content

Commit

Permalink
feat(config): create anchor links for headings (#74)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
tranzystorekk authored Aug 18, 2024
1 parent c08b284 commit 7cea0d6
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
19 changes: 19 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
import { defineConfig } from 'astro/config';
import starlightLinksValidator from 'starlight-links-validator'
import starlight from '@astrojs/starlight';
import rehypeSlug from 'rehype-slug';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';

// https://astro.build/config
export default defineConfig({
site: "https://docs.atuin.sh",
markdown: {
rehypePlugins: [
rehypeSlug,
[
rehypeAutolinkHeadings,
{
behavior: 'wrap',
headingProperties: {
className: ['anchor'],
},
properties: {
className: ['anchor-link'],
},
}
]
]
},
integrations: [
starlight({
plugins: [starlightLinksValidator()],
Expand Down
63 changes: 63 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"@astrojs/check": "^0.5.6",
"@astrojs/starlight": "^0.20.1",
"astro": "^4.4.6",
"rehype-autolink-headings": "^7.1.0",
"rehype-slug": "^6.0.0",
"sharp": "^0.33.2",
"starlight-links-validator": "^0.5.3",
"typescript": "^5.3.3"
Expand Down

0 comments on commit 7cea0d6

Please sign in to comment.