Skip to content

Commit 4e60398

Browse files
authored
Revert "add anchor links to headings" (#305)
Reverts #303 For some reason tables are broken.
1 parent 5d79f39 commit 4e60398

4 files changed

Lines changed: 122 additions & 242 deletions

File tree

astro.config.mjs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,6 @@ import image from "@astrojs/image";
66
import mdx from "@astrojs/mdx";
77

88
import sitemap from "@astrojs/sitemap";
9-
import rehypeAutolinkHeadings from "rehype-autolink-headings";
10-
import { h } from 'hastscript';
11-
12-
const AnchorLinkIcon = h(
13-
'svg',
14-
{
15-
width: 16,
16-
height: 16,
17-
version: 1.1,
18-
viewBox: '0 0 16 16',
19-
xlmns: 'http://www.w3.org/2000/svg',
20-
},
21-
h('path', {
22-
fillRule: 'evenodd',
23-
fill: 'currentcolor',
24-
d: 'M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z',
25-
})
26-
);
279

2810
// https://astro.build/config
2911
export default defineConfig({
@@ -41,29 +23,5 @@ export default defineConfig({
4123
shikiConfig: {
4224
theme: 'dracula-soft',
4325
},
44-
rehypePlugins: [
45-
[
46-
rehypeAutolinkHeadings,
47-
{
48-
properties: {
49-
class: 'anchorLink',
50-
},
51-
behavior: 'before',
52-
group: ({ tagName }) =>
53-
h(`div.headingWrapper.level-${tagName}.flex.flex-row.items-baseline.prose-a:mr-4`, {
54-
tabIndex: -1,
55-
}),
56-
content: () => [
57-
h(
58-
`span.anchor-icon.align-baseline`,
59-
{
60-
ariaHidden: 'true',
61-
},
62-
AnchorLinkIcon
63-
),
64-
],
65-
},
66-
],
67-
],
6826
},
6927
});

0 commit comments

Comments
 (0)