Skip to content

Commit d38857e

Browse files
committed
docs: fix links
1 parent 769b3a6 commit d38857e

File tree

7 files changed

+67
-90
lines changed

7 files changed

+67
-90
lines changed

docs/.vitepress/config.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@ export default defineConfig({
1818

1919
markdown: {
2020
theme: {
21-
dark: 'dracula-soft',
22-
light: 'vitesse-light',
21+
dark: 'one-dark-pro',
22+
light: 'github-light',
2323
},
2424

2525
attrs: {
2626
leftDelimiter: '%{',
2727
rightDelimiter: '}%',
2828
},
29+
30+
anchor: {
31+
slugify: (s: string) => s.replace(/\s+/g, '-'),
32+
},
2933
},
3034

3135
head: [

docs/nuxt/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ If you are using SSR with any auth related feature, you will need to create a [s
6969

7070
In local development it's more convenient to put the `service-account.json` file alongside other files and refer to its path in the environment variable:
7171

72-
```dotenv
72+
```text
7373
GOOGLE_APPLICATION_CREDENTIALS=service-account.json
7474
```
7575

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"prettier": "^2.8.8",
103103
"semver": "^7.5.4",
104104
"typedoc": "^0.24.8",
105-
"typedoc-plugin-markdown": "^3.15.3",
105+
"typedoc-plugin-markdown": "^3.15.4",
106106
"typescript": "~5.1.6",
107107
"unbuild": "^1.2.1",
108108
"vitepress": "1.0.0-beta.7",

playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"npm-run-all": "^4.1.5",
2727
"typescript": "~5.1.6",
2828
"unplugin-vue-router": "^0.6.4",
29-
"vite": "^4.4.3",
29+
"vite": "^4.4.8",
3030
"vue-tsc": "^1.8.4"
3131
}
3232
}

pnpm-lock.yaml

Lines changed: 56 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/run-typedoc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ createTypeDocApp({
66
tsconfig: path.resolve(__dirname, './typedoc.tsconfig.json'),
77
// entryPointStrategy: 'packages',
88
githubPages: false,
9-
disableSources: true,
9+
disableSources: true, // some links are in node_modules and it's ugly
1010
plugin: ['typedoc-plugin-markdown'],
1111
entryPoints: [path.resolve(__dirname, '../src/index.ts')],
1212
}).build()

scripts/typedoc-markdown.cjs

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ exports.createTypeDocApp = function createTypeDocApp(config = {}) {
3434
/** @type {'build' | 'serve'} */
3535
let targetMode = 'build'
3636

37-
const slugify = (s) => s.replaceAll(' ', '-')
38-
// encodeURIComponent(String(s).trim().toLowerCase().replace(/\s+/g, '-'))
39-
4037
app.renderer.on(
4138
PageEvent.END,
4239
/**
@@ -46,56 +43,10 @@ exports.createTypeDocApp = function createTypeDocApp(config = {}) {
4643
(page) => {
4744
if (page.url !== 'index.md' && page.contents) {
4845
page.contents = prependYAML(page.contents, {
49-
sidebar: 'auto',
5046
// TODO: figure out a way to point to the source files?
5147
editLink: false,
52-
sidebarDepth: 3,
5348
})
5449
}
55-
56-
// avoid duplicated id titles
57-
if (page.contents) {
58-
const lines = page.contents.split('\n')
59-
const titleStack = []
60-
let currentLevel = 0
61-
const TITLE_LEVEL = /^#+/
62-
const existingIds = new Map()
63-
for (let i = 0; i < lines.length; i++) {
64-
const line = lines[i]
65-
if (!line.startsWith('#')) continue
66-
const level = line.match(TITLE_LEVEL)?.[0].length
67-
if (level == null) continue
68-
69-
// remove extra levels
70-
if (level <= currentLevel) {
71-
titleStack.splice(level - 1)
72-
}
73-
// add the current title
74-
titleStack.push(line.slice(level).trim())
75-
currentLevel = level
76-
77-
// no need to add ids to h1
78-
if (level < 2) continue
79-
80-
// ignore the root level (h1) to match the sidebar
81-
const slugifiedTitle = slugify(titleStack.slice(1).join('-'))
82-
// ensure the link is valid vuejs/router#1743
83-
.replaceAll('\\', '')
84-
let id
85-
if (existingIds.has(slugifiedTitle)) {
86-
const current = existingIds.get(slugifiedTitle)
87-
existingIds.set(slugifiedTitle, current + 1)
88-
id = ` %{#${slugifiedTitle}_${current + 1}}%`
89-
} else {
90-
existingIds.set(slugifiedTitle, 0)
91-
id = ` %{#${slugifiedTitle}}%`
92-
}
93-
const newLine = line + id
94-
lines.splice(i, 1, newLine)
95-
}
96-
97-
page.contents = lines.join('\n')
98-
}
9950
}
10051
)
10152

@@ -113,15 +64,12 @@ exports.createTypeDocApp = function createTypeDocApp(config = {}) {
11364
}
11465
await app.bootstrapWithPlugins(options)
11566
const project = app.convert()
116-
if (!project) {
117-
throw new Error('Failed to convert')
118-
}
11967
return handleProject(project)
12068
}
12169

12270
/**
12371
*
124-
* @param {import('typedoc').ProjectReflection} project
72+
* @param {import('typedoc').ProjectReflection | undefined} project
12573
*/
12674
async function handleProject(project) {
12775
if (project) {

0 commit comments

Comments
 (0)