Skip to content

Commit

Permalink
make headings clickable links
Browse files Browse the repository at this point in the history
  • Loading branch information
Vendicated committed Jun 30, 2024
1 parent 11f92a4 commit d1479fe
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
18 changes: 16 additions & 2 deletions astro.config.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import starlightLinksValidator from "starlight-links-validator";
import { rehypeHeadingIds } from "@astrojs/markdown-remark";
import rehypeAutolinkHeadings from "rehype-autolink-headings";

// https://astro.build/config
export default defineConfig({
Expand All @@ -21,7 +23,7 @@ export default defineConfig({
github: "https://github.com/Vencord",
discord: "https://vencord.dev/discord"
},
customCss: ["./src/style/custom.css"],
customCss: ["./src/style/custom.css", "./src/style/headingLinks.css"],
lastUpdated: true,
sidebar: [
{
Expand All @@ -38,5 +40,17 @@ export default defineConfig({
}
]
})
]
],

markdown: {
rehypePlugins: [
rehypeHeadingIds,
[
rehypeAutolinkHeadings,
{
behavior: "wrap"
}
]
]
}
});
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
},
"dependencies": {
"@astrojs/check": "^0.7.0",
"@astrojs/markdown-remark": "^5.1.1",
"@astrojs/starlight": "^0.24.4",
"astro": "^4.10.2",
"rehype-autolink-headings": "^7.1.0",
"sharp": "^0.32.5",
"starlight-links-validator": "^0.9.0",
"typescript": "^5.5.2"
Expand Down
25 changes: 25 additions & 0 deletions pnpm-lock.yaml

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

8 changes: 8 additions & 0 deletions src/style/headingLinks.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.sl-markdown-content :is(h1, h2, h3, h4, h5, h6) > a {
color: var(--sl-color-white);
text-decoration: none;
}

.sl-markdown-content :is(h1, h2, h3, h4, h5, h6) > a:hover {
text-decoration: underline;
}

0 comments on commit d1479fe

Please sign in to comment.