Skip to content

Commit e4fafa0

Browse files
committed
enable wikilink
1 parent 37a1fa7 commit e4fafa0

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

astro.config.mjs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { rehypeHeadingIds } from '@astrojs/markdown-remark';
2-
// import remarkWikiLink from "@braindb/remark-wiki-link";
2+
import remarkWikiLink from "@braindb/remark-wiki-link";
33
import expressiveCode from 'astro-expressive-code';
44
import icon from 'astro-icon';
55
import { defineConfig } from 'astro/config';
@@ -89,33 +89,33 @@ export default defineConfig({
8989
markdown: {
9090
remarkPlugins: [
9191
remarkMath,
92-
// [
93-
// remarkWikiLink,
94-
// {
95-
// linkTemplate: ({ slug, alias }) => {
96-
// let normalizedSlug = (slug || '')
97-
// .replace(/^\/\//, '')
98-
// .replace(/^src\/content\//, '')
99-
// .replace(/^\/+/, '')
100-
// .replace(/\.(md|mdx)$/, '')
101-
// .replace(/\/index$/, '')
92+
[
93+
remarkWikiLink,
94+
{
95+
linkTemplate: ({ slug, alias }) => {
96+
let normalizedSlug = (slug || '')
97+
.replace(/^\/\//, '')
98+
.replace(/^src\/content\//, '')
99+
.replace(/^\/+/, '')
100+
.replace(/\.(md|mdx)$/, '')
101+
.replace(/\/index$/, '')
102102

103-
// return {
104-
// hName: 'a',
105-
// hProperties: {
106-
// href: `/${normalizedSlug}`,
107-
// class: 'inner-link not-prose'
108-
// },
109-
// hChildren: [
110-
// {
111-
// type: 'text',
112-
// value: alias || normalizedSlug || ''
113-
// }
114-
// ]
115-
// }
116-
// }
117-
// }
118-
// ],
103+
return {
104+
hName: 'a',
105+
hProperties: {
106+
href: `/${normalizedSlug}`,
107+
class: 'inner-link not-prose'
108+
},
109+
hChildren: [
110+
{
111+
type: 'text',
112+
value: alias || normalizedSlug || ''
113+
}
114+
]
115+
}
116+
}
117+
}
118+
],
119119
remarkBreaks,
120120
remarkMermaid,
121121
// remarkAiNotice

0 commit comments

Comments
 (0)