Skip to content

Commit fff32ef

Browse files
committed
Render links to the current page
Resolves #2934
1 parent 42af237 commit fff32ef

File tree

12 files changed

+69
-29
lines changed

12 files changed

+69
-29
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ title: Changelog
77
### Bug Fixes
88

99
- `@inline` now functions when referencing tuple types, #2932.
10+
- `@link` links to the current page are now rendered, #2934.
1011

1112
## v0.28.2 (2025-04-07)
1213

src/lib/output/themes/MarkedPlugin.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ export class MarkedPlugin extends ContextAwareRendererComponent {
195195
);
196196
}
197197
}
198+
199+
// If the url goes to this page, render as `#`
200+
// to go to the top of the page.
201+
if (url == "") {
202+
url = "#";
203+
}
198204
}
199205

200206
if (useHtml) {

src/test/converter2/renderer/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ export class ModifiersClass {
6868
readonly read = 4;
6969
/** @deprecated */
7070
dep = 5;
71+
72+
/** #2934 same page link {@linkcode ModifiersClass} */
73+
constructor() {}
7174
}
7275

7376
/**

src/test/converter2/typedoc.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
"sourceLinkTemplate": "{path}",
1616
"excludeExternals": true,
1717
"tsconfig": "tsconfig.json",
18-
"validation": true,
18+
"validation": {
19+
"invalidLink": true,
20+
"notDocumented": false,
21+
"notExported": true,
22+
"rewrittenLink": true,
23+
"unusedMergeModuleWith": true
24+
},
1925
"skipErrorChecking": true,
2026
"externalSymbolLinkMappings": {
2127
// used by {@link !Promise}

src/test/renderer/specs/classes/ModifiersClass.json

+35-11
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,42 @@
202202
]
203203
},
204204
{
205-
"div.tsd-description": {
206-
"h4.tsd-returns-title": [
207-
"Returns ",
208-
{
209-
"tag": "a.tsd-signature-type.tsd-kind-class",
210-
"props": {
211-
"href": ""
212-
},
213-
"children": "ModifiersClass"
205+
"div.tsd-description": [
206+
{
207+
"div.tsd-comment.tsd-typography": "<p>#2934 same page link <a href=\"#\" class=\"tsd-kind-class\"><code>ModifiersClass</code></a></p>\n"
208+
},
209+
{
210+
"h4.tsd-returns-title": [
211+
"Returns ",
212+
{
213+
"tag": "a.tsd-signature-type.tsd-kind-class",
214+
"props": {
215+
"href": ""
216+
},
217+
"children": "ModifiersClass"
218+
}
219+
]
220+
},
221+
{
222+
"div.tsd-comment.tsd-typography": []
223+
},
224+
{
225+
"aside.tsd-sources": {
226+
"ul": {
227+
"li": [
228+
"Defined in ",
229+
{
230+
"tag": "a",
231+
"props": {
232+
"href": "index.ts"
233+
},
234+
"children": "index.ts:73"
235+
}
236+
]
237+
}
214238
}
215-
]
216-
}
239+
}
240+
]
217241
}
218242
]
219243
}

src/test/renderer/specs/enums/Enumeration.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"props": {
6262
"href": "index.ts"
6363
},
64-
"children": "index.ts:77"
64+
"children": "index.ts:80"
6565
}
6666
]
6767
}
@@ -180,7 +180,7 @@
180180
"props": {
181181
"href": "index.ts"
182182
},
183-
"children": "index.ts:79"
183+
"children": "index.ts:82"
184184
}
185185
]
186186
}
@@ -234,7 +234,7 @@
234234
"props": {
235235
"href": "index.ts"
236236
},
237-
"children": "index.ts:81"
237+
"children": "index.ts:84"
238238
}
239239
]
240240
}

src/test/renderer/specs/functions/box.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
"props": {
198198
"href": "index.ts"
199199
},
200-
"children": "index.ts:110"
200+
"children": "index.ts:113"
201201
}
202202
]
203203
}

src/test/renderer/specs/interfaces/DisabledGroups.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"props": {
102102
"href": "index.ts"
103103
},
104-
"children": "index.ts:129"
104+
"children": "index.ts:132"
105105
}
106106
]
107107
}
@@ -194,7 +194,7 @@
194194
"props": {
195195
"href": "index.ts"
196196
},
197-
"children": "index.ts:130"
197+
"children": "index.ts:133"
198198
}
199199
]
200200
}
@@ -265,7 +265,7 @@
265265
"props": {
266266
"href": "index.ts"
267267
},
268-
"children": "index.ts:131"
268+
"children": "index.ts:134"
269269
}
270270
]
271271
}

src/test/renderer/specs/interfaces/NoneCategory.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
"props": {
120120
"href": "index.ts"
121121
},
122-
"children": "index.ts:114"
122+
"children": "index.ts:117"
123123
}
124124
]
125125
}
@@ -248,7 +248,7 @@
248248
"props": {
249249
"href": "index.ts"
250250
},
251-
"children": "index.ts:119"
251+
"children": "index.ts:122"
252252
}
253253
]
254254
}
@@ -316,7 +316,7 @@
316316
"props": {
317317
"href": "index.ts"
318318
},
319-
"children": "index.ts:116"
319+
"children": "index.ts:119"
320320
}
321321
]
322322
}
@@ -383,7 +383,7 @@
383383
"props": {
384384
"href": "index.ts"
385385
},
386-
"children": "index.ts:117"
386+
"children": "index.ts:120"
387387
}
388388
]
389389
}

src/test/renderer/specs/interfaces/NoneGroup.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"props": {
9999
"href": "index.ts"
100100
},
101-
"children": "index.ts:122"
101+
"children": "index.ts:125"
102102
}
103103
]
104104
}
@@ -206,7 +206,7 @@
206206
"props": {
207207
"href": "index.ts"
208208
},
209-
"children": "index.ts:124"
209+
"children": "index.ts:127"
210210
}
211211
]
212212
}
@@ -271,7 +271,7 @@
271271
"props": {
272272
"href": "index.ts"
273273
},
274-
"children": "index.ts:125"
274+
"children": "index.ts:128"
275275
}
276276
]
277277
}

src/test/renderer/specs/types/Nested.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
"props": {
182182
"href": "index.ts"
183183
},
184-
"children": "index.ts:85"
184+
"children": "index.ts:88"
185185
}
186186
]
187187
}
@@ -491,7 +491,7 @@
491491
"props": {
492492
"href": "index.ts"
493493
},
494-
"children": "index.ts:86"
494+
"children": "index.ts:89"
495495
}
496496
]
497497
}

src/test/renderer/specs/types/UnionComments.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"props": {
8989
"href": "index.ts"
9090
},
91-
"children": "index.ts:99"
91+
"children": "index.ts:102"
9292
}
9393
]
9494
}

0 commit comments

Comments
 (0)