Skip to content

Commit ed1f3e9

Browse files
committed
fix(core): expose isDeprecated flag to navigation category items
1 parent d090aa3 commit ed1f3e9

File tree

6 files changed

+132
-19
lines changed

6 files changed

+132
-19
lines changed

.changeset/perfect-coins-switch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'typedoc-plugin-markdown': patch
3+
---
4+
5+
- Expose isDeprecated flag to navigation category items.

packages/typedoc-plugin-markdown/src/theme/base/navigation-builder.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ export class NavigationBuilder {
253253
title: child.name,
254254
kind: child.kind,
255255
path: child.url,
256+
isDeprecated: child.isDeprecated(),
256257
...(children && { children }),
257258
};
258259
});

packages/typedoc-plugin-markdown/test/fixtures/config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ const config = {
365365
entryPoints: [
366366
'/navigation/module-1/index.ts',
367367
'/navigation/module-2/index.ts',
368+
'/navigation/module-3/index.ts',
368369
],
369370
commonOptions: {
370371
hidePageHeader: true,

packages/typedoc-plugin-markdown/test/fixtures/src/navigation/module-1/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
/**
1010
* @category Category 1
11+
*
12+
* @deprecated
1113
*/
1214
export interface SomeInterface1 {}
1315

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @group Group 3
3+
*
4+
* @module Module3
5+
*/
6+
7+
/**
8+
* @category Category1
9+
*/
10+
export interface SomeInterfaceA {}
11+
12+
/**
13+
* @category Category2
14+
*
15+
* @deprecated
16+
*/
17+
export interface SomeInterfaceB {}

packages/typedoc-plugin-markdown/test/specs/__snapshots__/navigation.spec.ts.snap

Lines changed: 106 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,26 @@ exports[`Navigation should get with and without groups and categories: (Output F
10921092
"isDeprecated": false
10931093
}
10941094
]
1095+
},
1096+
{
1097+
"title": "Module3",
1098+
"kind": 2,
1099+
"path": "Module3/README.md",
1100+
"isDeprecated": false,
1101+
"children": [
1102+
{
1103+
"title": "SomeInterfaceA",
1104+
"kind": 256,
1105+
"path": "Module3/interfaces/SomeInterfaceA.md",
1106+
"isDeprecated": false
1107+
},
1108+
{
1109+
"title": "SomeInterfaceB",
1110+
"kind": 256,
1111+
"path": "Module3/interfaces/SomeInterfaceB.md",
1112+
"isDeprecated": true
1113+
}
1114+
]
10951115
}
10961116
]"
10971117
`;
@@ -1113,12 +1133,14 @@ exports[`Navigation should get with and without groups and categories: (Output F
11131133
{
11141134
"title": "SomeInterface1",
11151135
"kind": 256,
1116-
"path": "Module1/interfaces/SomeInterface1.md"
1136+
"path": "Module1/interfaces/SomeInterface1.md",
1137+
"isDeprecated": true
11171138
},
11181139
{
11191140
"title": "SomeInterface2",
11201141
"kind": 256,
1121-
"path": "Module1/interfaces/SomeInterface2.md"
1142+
"path": "Module1/interfaces/SomeInterface2.md",
1143+
"isDeprecated": true
11221144
}
11231145
]
11241146
},
@@ -1128,7 +1150,8 @@ exports[`Navigation should get with and without groups and categories: (Output F
11281150
{
11291151
"title": "SomeInterface3",
11301152
"kind": 256,
1131-
"path": "Module1/interfaces/SomeInterface3.md"
1153+
"path": "Module1/interfaces/SomeInterface3.md",
1154+
"isDeprecated": true
11321155
}
11331156
]
11341157
}
@@ -1159,6 +1182,41 @@ exports[`Navigation should get with and without groups and categories: (Output F
11591182
]
11601183
}
11611184
]
1185+
},
1186+
{
1187+
"title": "Group 3",
1188+
"children": [
1189+
{
1190+
"title": "Module3",
1191+
"kind": 2,
1192+
"path": "Module3/README.md",
1193+
"isDeprecated": false,
1194+
"children": [
1195+
{
1196+
"title": "Category1",
1197+
"children": [
1198+
{
1199+
"title": "SomeInterfaceA",
1200+
"kind": 256,
1201+
"path": "Module3/interfaces/SomeInterfaceA.md",
1202+
"isDeprecated": false
1203+
}
1204+
]
1205+
},
1206+
{
1207+
"title": "Category2",
1208+
"children": [
1209+
{
1210+
"title": "SomeInterfaceB",
1211+
"kind": 256,
1212+
"path": "Module3/interfaces/SomeInterfaceB.md",
1213+
"isDeprecated": true
1214+
}
1215+
]
1216+
}
1217+
]
1218+
}
1219+
]
11621220
}
11631221
]"
11641222
`;
@@ -1176,6 +1234,12 @@ exports[`Navigation should get with and without groups and categories: (Output F
11761234
"kind": 2,
11771235
"path": "Module2.md",
11781236
"isDeprecated": false
1237+
},
1238+
{
1239+
"title": "Module3",
1240+
"kind": 2,
1241+
"path": "Module3.md",
1242+
"isDeprecated": false
11791243
}
11801244
]"
11811245
`;
@@ -1203,6 +1267,17 @@ exports[`Navigation should get with and without groups and categories: (Output F
12031267
"isDeprecated": false
12041268
}
12051269
]
1270+
},
1271+
{
1272+
"title": "Group 3",
1273+
"children": [
1274+
{
1275+
"title": "Module3",
1276+
"kind": 2,
1277+
"path": "Module3.md",
1278+
"isDeprecated": false
1279+
}
1280+
]
12061281
}
12071282
]"
12081283
`;
@@ -2718,13 +2793,13 @@ exports[`Navigation should gets Navigation Json for modules with parts: (Output
27182793
"title": "ClassA",
27192794
"kind": 128,
27202795
"path": "namespace/classes/ClassA.md",
2721-
"isDeprecated": false
2796+
"isDeprecated": true
27222797
},
27232798
{
27242799
"title": "ClassB",
27252800
"kind": 128,
27262801
"path": "namespace/classes/ClassB.md",
2727-
"isDeprecated": false
2802+
"isDeprecated": true
27282803
}
27292804
]
27302805
},
@@ -3213,13 +3288,13 @@ exports[`Navigation should gets Navigation Json for modules with parts: (Output
32133288
"title": "ClassA",
32143289
"kind": 128,
32153290
"path": "@scope.namespace.Class.ClassA.md",
3216-
"isDeprecated": false
3291+
"isDeprecated": true
32173292
},
32183293
{
32193294
"title": "ClassB",
32203295
"kind": 128,
32213296
"path": "@scope.namespace.Class.ClassB.md",
3222-
"isDeprecated": false
3297+
"isDeprecated": true
32233298
}
32243299
]
32253300
},
@@ -4235,22 +4310,26 @@ exports[`Navigation should gets Navigation Json for multiple entry points: (Outp
42354310
{
42364311
"title": "CategoryAEnum1",
42374312
"kind": 8,
4238-
"path": "has-categories/enumerations/CategoryAEnum1.md"
4313+
"path": "has-categories/enumerations/CategoryAEnum1.md",
4314+
"isDeprecated": false
42394315
},
42404316
{
42414317
"title": "CategoryAEnum2",
42424318
"kind": 8,
4243-
"path": "has-categories/enumerations/CategoryAEnum2.md"
4319+
"path": "has-categories/enumerations/CategoryAEnum2.md",
4320+
"isDeprecated": false
42444321
},
42454322
{
42464323
"title": "CategoryAInterface1",
42474324
"kind": 256,
4248-
"path": "has-categories/interfaces/CategoryAInterface1.md"
4325+
"path": "has-categories/interfaces/CategoryAInterface1.md",
4326+
"isDeprecated": false
42494327
},
42504328
{
42514329
"title": "CategoryAInterface2",
42524330
"kind": 256,
4253-
"path": "has-categories/interfaces/CategoryAInterface2.md"
4331+
"path": "has-categories/interfaces/CategoryAInterface2.md",
4332+
"isDeprecated": false
42544333
}
42554334
]
42564335
},
@@ -4260,22 +4339,26 @@ exports[`Navigation should gets Navigation Json for multiple entry points: (Outp
42604339
{
42614340
"title": "CategoryBEnum1",
42624341
"kind": 8,
4263-
"path": "has-categories/enumerations/CategoryBEnum1.md"
4342+
"path": "has-categories/enumerations/CategoryBEnum1.md",
4343+
"isDeprecated": false
42644344
},
42654345
{
42664346
"title": "CategoryBEnum2",
42674347
"kind": 8,
4268-
"path": "has-categories/enumerations/CategoryBEnum2.md"
4348+
"path": "has-categories/enumerations/CategoryBEnum2.md",
4349+
"isDeprecated": false
42694350
},
42704351
{
42714352
"title": "CategoryBInterface1",
42724353
"kind": 256,
4273-
"path": "has-categories/interfaces/CategoryBInterface1.md"
4354+
"path": "has-categories/interfaces/CategoryBInterface1.md",
4355+
"isDeprecated": false
42744356
},
42754357
{
42764358
"title": "CategoryBInterface2",
42774359
"kind": 256,
4278-
"path": "has-categories/interfaces/CategoryBInterface2.md"
4360+
"path": "has-categories/interfaces/CategoryBInterface2.md",
4361+
"isDeprecated": false
42794362
}
42804363
]
42814364
},
@@ -4285,7 +4368,8 @@ exports[`Navigation should gets Navigation Json for multiple entry points: (Outp
42854368
{
42864369
"title": "CategoryCInterface1",
42874370
"kind": 256,
4288-
"path": "has-categories/interfaces/CategoryCInterface1.md"
4371+
"path": "has-categories/interfaces/CategoryCInterface1.md",
4372+
"isDeprecated": false
42894373
}
42904374
]
42914375
},
@@ -4295,17 +4379,20 @@ exports[`Navigation should gets Navigation Json for multiple entry points: (Outp
42954379
{
42964380
"title": "UnCategorizedEnum",
42974381
"kind": 8,
4298-
"path": "has-categories/enumerations/UnCategorizedEnum.md"
4382+
"path": "has-categories/enumerations/UnCategorizedEnum.md",
4383+
"isDeprecated": false
42994384
},
43004385
{
43014386
"title": "CategoryCInterface2",
43024387
"kind": 256,
4303-
"path": "has-categories/interfaces/CategoryCInterface2.md"
4388+
"path": "has-categories/interfaces/CategoryCInterface2.md",
4389+
"isDeprecated": false
43044390
},
43054391
{
43064392
"title": "UnCategorizedInterace",
43074393
"kind": 256,
4308-
"path": "has-categories/interfaces/UnCategorizedInterace.md"
4394+
"path": "has-categories/interfaces/UnCategorizedInterace.md",
4395+
"isDeprecated": false
43094396
}
43104397
]
43114398
}

0 commit comments

Comments
 (0)