typedoc 0.25.2 → 0.25.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/lib/application.js +9 -2
  2. package/dist/lib/converter/comments/declarationReference.js +14 -14
  3. package/dist/lib/converter/comments/discovery.js +3 -1
  4. package/dist/lib/converter/comments/parser.js +56 -13
  5. package/dist/lib/converter/factories/index-signature.js +1 -0
  6. package/dist/lib/converter/plugins/TypePlugin.js +4 -1
  7. package/dist/lib/converter/symbols.js +24 -14
  8. package/dist/lib/converter/types.js +15 -13
  9. package/dist/lib/converter/utils/repository.js +4 -4
  10. package/dist/lib/converter/utils/symbols.js +5 -0
  11. package/dist/lib/models/reflections/ReflectionSymbolId.d.ts +9 -0
  12. package/dist/lib/models/reflections/ReflectionSymbolId.js +28 -11
  13. package/dist/lib/models/reflections/abstract.js +257 -200
  14. package/dist/lib/models/types.js +21 -21
  15. package/dist/lib/output/themes/MarkedPlugin.js +16 -9
  16. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +14 -3
  17. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +10 -0
  18. package/dist/lib/output/themes/default/partials/comment.js +8 -3
  19. package/dist/lib/output/themes/default/partials/footer.js +1 -1
  20. package/dist/lib/output/themes/default/partials/member.signatures.js +2 -1
  21. package/dist/lib/output/themes/default/partials/member.sources.js +25 -11
  22. package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +4 -0
  23. package/dist/lib/output/themes/default/partials/reflectionPreview.js +21 -0
  24. package/dist/lib/output/themes/default/partials/type.d.ts +3 -1
  25. package/dist/lib/output/themes/default/partials/type.js +27 -24
  26. package/dist/lib/output/themes/default/templates/reflection.js +2 -1
  27. package/dist/lib/utils/general.d.ts +1 -0
  28. package/dist/lib/utils/general.js +11 -1
  29. package/dist/lib/utils/jsx.js +4 -3
  30. package/dist/lib/utils/options/declaration.d.ts +1 -0
  31. package/dist/lib/utils/options/declaration.js +2 -2
  32. package/dist/lib/utils/options/options.js +6 -5
  33. package/dist/lib/utils/options/sources/typedoc.js +20 -15
  34. package/dist/lib/utils/sort.d.ts +1 -1
  35. package/dist/lib/utils/sort.js +4 -0
  36. package/package.json +6 -4
  37. package/static/style.css +11 -0
@@ -1,10 +1,45 @@
1
1
  "use strict";
2
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
3
+ var useValue = arguments.length > 2;
4
+ for (var i = 0; i < initializers.length; i++) {
5
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
6
+ }
7
+ return useValue ? value : void 0;
8
+ };
9
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
10
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
11
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
12
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
14
+ var _, done = false;
15
+ for (var i = decorators.length - 1; i >= 0; i--) {
16
+ var context = {};
17
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
18
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
19
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
20
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
21
+ if (kind === "accessor") {
22
+ if (result === void 0) continue;
23
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
24
+ if (_ = accept(result.get)) descriptor.get = _;
25
+ if (_ = accept(result.set)) descriptor.set = _;
26
+ if (_ = accept(result.init)) initializers.unshift(_);
27
+ }
28
+ else if (_ = accept(result)) {
29
+ if (kind === "field") initializers.unshift(_);
30
+ else descriptor[key] = _;
31
+ }
32
+ }
33
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
34
+ done = true;
35
+ };
2
36
  Object.defineProperty(exports, "__esModule", { value: true });
3
37
  exports.Reflection = exports.TraverseProperty = exports.ReflectionFlags = exports.ReflectionFlag = exports.resetReflectionID = void 0;
4
38
  const assert_1 = require("assert");
5
39
  const comment_1 = require("../comments/comment");
6
40
  const utils_1 = require("./utils");
7
41
  const kind_1 = require("./kind");
42
+ const general_1 = require("../../utils/general");
8
43
  /**
9
44
  * Current reflection id.
10
45
  */
@@ -207,214 +242,236 @@ var TraverseProperty;
207
242
  * contains a list of all children grouped and sorted for rendering.
208
243
  * @category Reflections
209
244
  */
210
- class Reflection {
211
- get project() {
212
- if (this.isProject())
213
- return this;
214
- (0, assert_1.ok)(this.parent, "Tried to get the project on a reflection not in a project");
215
- return this.parent.project;
216
- }
217
- constructor(name, kind, parent) {
218
- this.flags = new ReflectionFlags();
219
- this.id = REFLECTION_ID++;
220
- this.parent = parent;
221
- this.name = name;
222
- this.kind = kind;
223
- // If our parent is external, we are too.
224
- if (parent?.flags.isExternal) {
225
- this.setFlag(ReflectionFlag.External);
226
- }
227
- }
228
- /**
229
- * Test whether this reflection is of the given kind.
230
- */
231
- kindOf(kind) {
232
- const kindArray = Array.isArray(kind) ? kind : [kind];
233
- return kindArray.some((kind) => (this.kind & kind) !== 0);
234
- }
235
- /**
236
- * Return the full name of this reflection. Intended for use in debugging. For log messages
237
- * intended to be displayed to the user for them to fix, prefer {@link getFriendlyFullName} instead.
238
- *
239
- * The full name contains the name of this reflection and the names of all parent reflections.
240
- *
241
- * @param separator Separator used to join the names of the reflections.
242
- * @returns The full name of this reflection.
243
- */
244
- getFullName(separator = ".") {
245
- if (this.parent && !this.parent.isProject()) {
246
- return this.parent.getFullName(separator) + separator + this.name;
247
- }
248
- else {
249
- return this.name;
250
- }
251
- }
252
- /**
253
- * Return the full name of this reflection, with signature names dropped if possible without
254
- * introducing ambiguity in the name.
255
- */
256
- getFriendlyFullName() {
257
- if (this.parent && !this.parent.isProject()) {
258
- if (this.kindOf(kind_1.ReflectionKind.ConstructorSignature |
259
- kind_1.ReflectionKind.CallSignature |
260
- kind_1.ReflectionKind.GetSignature |
261
- kind_1.ReflectionKind.SetSignature)) {
262
- return this.parent.getFriendlyFullName();
245
+ let Reflection = (() => {
246
+ var _a;
247
+ let _instanceExtraInitializers = [];
248
+ let _parent_decorators;
249
+ let _parent_initializers = [];
250
+ return _a = class Reflection {
251
+ get project() {
252
+ if (this.isProject())
253
+ return this;
254
+ (0, assert_1.ok)(this.parent, "Tried to get the project on a reflection not in a project");
255
+ return this.parent.project;
263
256
  }
264
- return this.parent.getFriendlyFullName() + "." + this.name;
265
- }
266
- else {
267
- return this.name;
268
- }
269
- }
270
- /**
271
- * Set a flag on this reflection.
272
- */
273
- setFlag(flag, value = true) {
274
- this.flags.setFlag(flag, value);
275
- }
276
- /**
277
- * Return an url safe alias for this reflection.
278
- */
279
- getAlias() {
280
- if (!this._alias) {
281
- let alias = this.name.replace(/\W/g, "_");
282
- if (alias === "") {
283
- alias = "reflection-" + this.id;
284
- }
285
- // NTFS/ExFAT use uppercase, so we will too. It probably won't matter
286
- // in this case since names will generally be valid identifiers, but to be safe...
287
- const upperAlias = alias.toUpperCase();
288
- let target = this;
289
- while (target.parent && !target.hasOwnDocument) {
290
- target = target.parent;
257
+ constructor(name, kind, parent) {
258
+ /**
259
+ * Unique id of this reflection.
260
+ */
261
+ this.id = (__runInitializers(this, _instanceExtraInitializers), void 0);
262
+ this.flags = new ReflectionFlags();
263
+ /**
264
+ * The reflection this reflection is a child of.
265
+ */
266
+ this.parent = __runInitializers(this, _parent_initializers, void 0);
267
+ this.id = REFLECTION_ID++;
268
+ this.parent = parent;
269
+ this.name = name;
270
+ this.kind = kind;
271
+ // If our parent is external, we are too.
272
+ if (parent?.flags.isExternal) {
273
+ this.setFlag(ReflectionFlag.External);
274
+ }
291
275
  }
292
- target._aliases ||= new Map();
293
- let suffix = "";
294
- if (!target._aliases.has(upperAlias)) {
295
- target._aliases.set(upperAlias, 1);
276
+ /**
277
+ * Test whether this reflection is of the given kind.
278
+ */
279
+ kindOf(kind) {
280
+ const kindArray = Array.isArray(kind) ? kind : [kind];
281
+ return kindArray.some((kind) => (this.kind & kind) !== 0);
296
282
  }
297
- else {
298
- const count = target._aliases.get(upperAlias);
299
- suffix = "-" + count.toString();
300
- target._aliases.set(upperAlias, count + 1);
283
+ /**
284
+ * Return the full name of this reflection. Intended for use in debugging. For log messages
285
+ * intended to be displayed to the user for them to fix, prefer {@link getFriendlyFullName} instead.
286
+ *
287
+ * The full name contains the name of this reflection and the names of all parent reflections.
288
+ *
289
+ * @param separator Separator used to join the names of the reflections.
290
+ * @returns The full name of this reflection.
291
+ */
292
+ getFullName(separator = ".") {
293
+ if (this.parent && !this.parent.isProject()) {
294
+ return this.parent.getFullName(separator) + separator + this.name;
295
+ }
296
+ else {
297
+ return this.name;
298
+ }
301
299
  }
302
- alias += suffix;
303
- this._alias = alias;
304
- }
305
- return this._alias;
306
- }
307
- /**
308
- * Has this reflection a visible comment?
309
- *
310
- * @returns TRUE when this reflection has a visible comment.
311
- */
312
- hasComment() {
313
- return this.comment ? this.comment.hasVisibleComponent() : false;
314
- }
315
- hasGetterOrSetter() {
316
- return false;
317
- }
318
- /**
319
- * Return a child by its name.
320
- *
321
- * @param names The name hierarchy of the child to look for.
322
- * @returns The found child or undefined.
323
- */
324
- getChildByName(arg) {
325
- const names = Array.isArray(arg)
326
- ? arg
327
- : (0, utils_1.splitUnquotedString)(arg, ".");
328
- const name = names[0];
329
- let result;
330
- this.traverse((child) => {
331
- if (child.name === name) {
332
- if (names.length <= 1) {
333
- result = child;
300
+ /**
301
+ * Return the full name of this reflection, with signature names dropped if possible without
302
+ * introducing ambiguity in the name.
303
+ */
304
+ getFriendlyFullName() {
305
+ if (this.parent && !this.parent.isProject()) {
306
+ if (this.kindOf(kind_1.ReflectionKind.ConstructorSignature |
307
+ kind_1.ReflectionKind.CallSignature |
308
+ kind_1.ReflectionKind.GetSignature |
309
+ kind_1.ReflectionKind.SetSignature)) {
310
+ return this.parent.getFriendlyFullName();
311
+ }
312
+ return this.parent.getFriendlyFullName() + "." + this.name;
334
313
  }
335
314
  else {
336
- result = child.getChildByName(names.slice(1));
315
+ return this.name;
316
+ }
317
+ }
318
+ /**
319
+ * Set a flag on this reflection.
320
+ */
321
+ setFlag(flag, value = true) {
322
+ this.flags.setFlag(flag, value);
323
+ }
324
+ /**
325
+ * Return an url safe alias for this reflection.
326
+ */
327
+ getAlias() {
328
+ if (!this._alias) {
329
+ let alias = this.name.replace(/\W/g, "_");
330
+ if (alias === "") {
331
+ alias = "reflection-" + this.id;
332
+ }
333
+ // NTFS/ExFAT use uppercase, so we will too. It probably won't matter
334
+ // in this case since names will generally be valid identifiers, but to be safe...
335
+ const upperAlias = alias.toUpperCase();
336
+ let target = this;
337
+ while (target.parent && !target.hasOwnDocument) {
338
+ target = target.parent;
339
+ }
340
+ target._aliases ||= new Map();
341
+ let suffix = "";
342
+ if (!target._aliases.has(upperAlias)) {
343
+ target._aliases.set(upperAlias, 1);
344
+ }
345
+ else {
346
+ const count = target._aliases.get(upperAlias);
347
+ suffix = "-" + count.toString();
348
+ target._aliases.set(upperAlias, count + 1);
349
+ }
350
+ alias += suffix;
351
+ this._alias = alias;
337
352
  }
353
+ return this._alias;
354
+ }
355
+ /**
356
+ * Has this reflection a visible comment?
357
+ *
358
+ * @returns TRUE when this reflection has a visible comment.
359
+ */
360
+ hasComment() {
361
+ return this.comment ? this.comment.hasVisibleComponent() : false;
362
+ }
363
+ hasGetterOrSetter() {
338
364
  return false;
339
365
  }
340
- return true;
341
- });
342
- return result;
343
- }
344
- /**
345
- * Return whether this reflection is the root / project reflection.
346
- */
347
- isProject() {
348
- return false;
349
- }
350
- isDeclaration() {
351
- return false;
352
- }
353
- /**
354
- * Check if this reflection or any of its parents have been marked with the `@deprecated` tag.
355
- */
356
- isDeprecated() {
357
- let signaturesDeprecated = false;
358
- this.visit({
359
- declaration(decl) {
360
- if (decl.signatures &&
361
- decl.signatures.every((sig) => sig.comment?.getTag("@deprecated"))) {
362
- signaturesDeprecated = true;
366
+ /**
367
+ * Return a child by its name.
368
+ *
369
+ * @param names The name hierarchy of the child to look for.
370
+ * @returns The found child or undefined.
371
+ */
372
+ getChildByName(arg) {
373
+ const names = Array.isArray(arg)
374
+ ? arg
375
+ : (0, utils_1.splitUnquotedString)(arg, ".");
376
+ const name = names[0];
377
+ let result;
378
+ this.traverse((child) => {
379
+ if (child.name === name) {
380
+ if (names.length <= 1) {
381
+ result = child;
382
+ }
383
+ else {
384
+ result = child.getChildByName(names.slice(1));
385
+ }
386
+ return false;
387
+ }
388
+ return true;
389
+ });
390
+ return result;
391
+ }
392
+ /**
393
+ * Return whether this reflection is the root / project reflection.
394
+ */
395
+ isProject() {
396
+ return false;
397
+ }
398
+ isDeclaration() {
399
+ return false;
400
+ }
401
+ /**
402
+ * Check if this reflection or any of its parents have been marked with the `@deprecated` tag.
403
+ */
404
+ isDeprecated() {
405
+ let signaturesDeprecated = false;
406
+ this.visit({
407
+ declaration(decl) {
408
+ if (decl.signatures &&
409
+ decl.signatures.every((sig) => sig.comment?.getTag("@deprecated"))) {
410
+ signaturesDeprecated = true;
411
+ }
412
+ },
413
+ });
414
+ if (signaturesDeprecated || this.comment?.getTag("@deprecated")) {
415
+ return true;
363
416
  }
364
- },
365
- });
366
- if (signaturesDeprecated || this.comment?.getTag("@deprecated")) {
367
- return true;
368
- }
369
- return this.parent?.isDeprecated() ?? false;
370
- }
371
- visit(visitor) {
372
- visitor[this.variant]?.(this);
373
- }
374
- /**
375
- * Return a string representation of this reflection.
376
- */
377
- toString() {
378
- return kind_1.ReflectionKind[this.kind] + " " + this.name;
379
- }
380
- /**
381
- * Return a string representation of this reflection and all of its children.
382
- *
383
- * @param indent Used internally to indent child reflections.
384
- */
385
- toStringHierarchy(indent = "") {
386
- const lines = [indent + this.toString()];
387
- indent += " ";
388
- this.traverse((child) => {
389
- lines.push(child.toStringHierarchy(indent));
390
- return true;
391
- });
392
- return lines.join("\n");
393
- }
394
- toObject(serializer) {
395
- return {
396
- id: this.id,
397
- name: this.name,
398
- variant: this.variant,
399
- kind: this.kind,
400
- flags: this.flags.toObject(),
401
- comment: this.comment && !this.comment.isEmpty()
402
- ? serializer.toObject(this.comment)
403
- : undefined,
404
- };
405
- }
406
- fromObject(de, obj) {
407
- // DO NOT copy id from obj. When deserializing reflections
408
- // they should be given new ids since they belong to a different project.
409
- this.name = obj.name;
410
- // Skip copying variant, we know it's already the correct value because the deserializer
411
- // will construct the correct class type.
412
- this.kind = obj.kind;
413
- this.flags.fromObject(obj.flags);
414
- // Parent is set during construction, so we don't need to do it here.
415
- this.comment = de.revive(obj.comment, () => new comment_1.Comment());
416
- // url, anchor, hasOwnDocument, _alias, _aliases are set during rendering and only relevant during render.
417
- // It doesn't make sense to serialize them to json, or restore them.
418
- }
419
- }
417
+ return this.parent?.isDeprecated() ?? false;
418
+ }
419
+ visit(visitor) {
420
+ visitor[this.variant]?.(this);
421
+ }
422
+ /**
423
+ * Return a string representation of this reflection.
424
+ */
425
+ toString() {
426
+ return kind_1.ReflectionKind[this.kind] + " " + this.name;
427
+ }
428
+ /**
429
+ * Return a string representation of this reflection and all of its children.
430
+ *
431
+ * @param indent Used internally to indent child reflections.
432
+ */
433
+ toStringHierarchy(indent = "") {
434
+ const lines = [indent + this.toString()];
435
+ indent += " ";
436
+ this.traverse((child) => {
437
+ lines.push(child.toStringHierarchy(indent));
438
+ return true;
439
+ });
440
+ return lines.join("\n");
441
+ }
442
+ toObject(serializer) {
443
+ return {
444
+ id: this.id,
445
+ name: this.name,
446
+ variant: this.variant,
447
+ kind: this.kind,
448
+ flags: this.flags.toObject(),
449
+ comment: this.comment && !this.comment.isEmpty()
450
+ ? serializer.toObject(this.comment)
451
+ : undefined,
452
+ };
453
+ }
454
+ fromObject(de, obj) {
455
+ // DO NOT copy id from obj. When deserializing reflections
456
+ // they should be given new ids since they belong to a different project.
457
+ this.name = obj.name;
458
+ // Skip copying variant, we know it's already the correct value because the deserializer
459
+ // will construct the correct class type.
460
+ this.kind = obj.kind;
461
+ this.flags.fromObject(obj.flags);
462
+ // Parent is set during construction, so we don't need to do it here.
463
+ this.comment = de.revive(obj.comment, () => new comment_1.Comment());
464
+ // url, anchor, hasOwnDocument, _alias, _aliases are set during rendering and only relevant during render.
465
+ // It doesn't make sense to serialize them to json, or restore them.
466
+ }
467
+ },
468
+ (() => {
469
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
470
+ _parent_decorators = [general_1.NonEnumerable // So that it doesn't show up in console.log
471
+ ];
472
+ __esDecorate(null, null, _parent_decorators, { kind: "field", name: "parent", static: false, private: false, access: { has: obj => "parent" in obj, get: obj => obj.parent, set: (obj, value) => { obj.parent = value; } }, metadata: _metadata }, _parent_initializers, _instanceExtraInitializers);
473
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
474
+ })(),
475
+ _a;
476
+ })();
420
477
  exports.Reflection = Reflection;
@@ -151,27 +151,27 @@ exports.makeRecursiveVisitor = makeRecursiveVisitor;
151
151
  */
152
152
  exports.TypeContext = {
153
153
  none: "none",
154
- templateLiteralElement: "templateLiteralElement",
155
- arrayElement: "arrayElement",
156
- indexedAccessElement: "indexedAccessElement",
157
- conditionalCheck: "conditionalCheck",
158
- conditionalExtends: "conditionalExtends",
159
- conditionalTrue: "conditionalTrue",
160
- conditionalFalse: "conditionalFalse",
161
- indexedIndex: "indexedIndex",
162
- indexedObject: "indexedObject",
163
- inferredConstraint: "inferredConstraint",
164
- intersectionElement: "intersectionElement",
165
- mappedName: "mappedName",
166
- mappedParameter: "mappedParameter",
167
- mappedTemplate: "mappedTemplate",
168
- optionalElement: "optionalElement",
169
- predicateTarget: "predicateTarget",
170
- queryTypeTarget: "queryTypeTarget",
171
- typeOperatorTarget: "typeOperatorTarget",
172
- referenceTypeArgument: "referenceTypeArgument",
173
- restElement: "restElement",
174
- tupleElement: "tupleElement",
154
+ templateLiteralElement: "templateLiteralElement", // `${here}`
155
+ arrayElement: "arrayElement", // here[]
156
+ indexedAccessElement: "indexedAccessElement", // {}[here]
157
+ conditionalCheck: "conditionalCheck", // here extends 1 ? 2 : 3
158
+ conditionalExtends: "conditionalExtends", // 1 extends here ? 2 : 3
159
+ conditionalTrue: "conditionalTrue", // 1 extends 2 ? here : 3
160
+ conditionalFalse: "conditionalFalse", // 1 extends 2 ? 3 : here
161
+ indexedIndex: "indexedIndex", // {}[here]
162
+ indexedObject: "indexedObject", // here[1]
163
+ inferredConstraint: "inferredConstraint", // 1 extends infer X extends here ? 1 : 2
164
+ intersectionElement: "intersectionElement", // here & 1
165
+ mappedName: "mappedName", // { [k in string as here]: 1 }
166
+ mappedParameter: "mappedParameter", // { [k in here]: 1 }
167
+ mappedTemplate: "mappedTemplate", // { [k in string]: here }
168
+ optionalElement: "optionalElement", // [here?]
169
+ predicateTarget: "predicateTarget", // (): X is here
170
+ queryTypeTarget: "queryTypeTarget", // typeof here, can only ever be a ReferenceType
171
+ typeOperatorTarget: "typeOperatorTarget", // keyof here
172
+ referenceTypeArgument: "referenceTypeArgument", // X<here>
173
+ restElement: "restElement", // [...here]
174
+ tupleElement: "tupleElement", // [here]
175
175
  unionElement: "unionElement", // here | 1
176
176
  };
177
177
  /**
@@ -203,25 +203,21 @@ output file :
203
203
  Marked.marked.setOptions(this.createMarkedOptions());
204
204
  delete this.includes;
205
205
  if (this.includeSource) {
206
- if (fs.existsSync(this.includeSource) &&
207
- fs.statSync(this.includeSource).isDirectory()) {
206
+ if (fs.existsSync(this.includeSource) && fs.statSync(this.includeSource).isDirectory()) {
208
207
  this.includes = this.includeSource;
209
208
  }
210
209
  else {
211
- this.application.logger.warn("Could not find provided includes directory: " +
212
- this.includeSource);
210
+ this.application.logger.warn("Could not find provided includes directory: " + this.includeSource);
213
211
  }
214
212
  }
215
213
  if (this.mediaSource) {
216
- if (fs.existsSync(this.mediaSource) &&
217
- fs.statSync(this.mediaSource).isDirectory()) {
214
+ if (fs.existsSync(this.mediaSource) && fs.statSync(this.mediaSource).isDirectory()) {
218
215
  this.mediaDirectory = Path.join(event.outputDirectory, "media");
219
216
  (0, utils_1.copySync)(this.mediaSource, this.mediaDirectory);
220
217
  }
221
218
  else {
222
219
  this.mediaDirectory = undefined;
223
- this.application.logger.warn("Could not find provided media directory: " +
224
- this.mediaSource);
220
+ this.application.logger.warn("Could not find provided media directory: " + this.mediaSource);
225
221
  }
226
222
  }
227
223
  }
@@ -236,6 +232,12 @@ output file :
236
232
  markedOptions.highlight ??= (text, lang) => this.getHighlighted(text, lang);
237
233
  if (!markedOptions.renderer) {
238
234
  markedOptions.renderer = new Marked.Renderer();
235
+ markedOptions.renderer.link = (href, title, text) => {
236
+ // Prefix the #anchor links `#md:`.
237
+ const target = href?.replace(/^#(?:md:)?(.+)/, "#md:$1") || undefined;
238
+ return (0, utils_1.renderElement)(utils_1.JSX.createElement("a", { href: target, title: title || undefined },
239
+ utils_1.JSX.createElement(utils_1.JSX.Raw, { html: text })));
240
+ };
239
241
  markedOptions.renderer.heading = (text, level, _, slugger) => {
240
242
  const slug = slugger.slug(text);
241
243
  // Prefix the slug with an extra `md:` to prevent conflicts with TypeDoc's anchors.
@@ -244,7 +246,12 @@ output file :
244
246
  text: (0, html_1.getTextContent)(text),
245
247
  level,
246
248
  });
247
- return `<a id="md:${slug}" class="tsd-anchor"></a><h${level}><a href="#md:${slug}">${text}</a></h${level}>`;
249
+ const H = `h${level}`;
250
+ return (0, utils_1.renderElement)(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
251
+ utils_1.JSX.createElement("a", { id: `md:${slug}`, class: "tsd-anchor" }),
252
+ utils_1.JSX.createElement(H, null,
253
+ utils_1.JSX.createElement("a", { href: `#md:${slug}` },
254
+ utils_1.JSX.createElement(utils_1.JSX.Raw, { html: text })))));
248
255
  };
249
256
  markedOptions.renderer.code = renderCode;
250
257
  }
@@ -23,6 +23,15 @@ export declare class DefaultThemeRenderContext {
23
23
  reflectionTemplate: (props: PageEvent<import("../../../models").ContainerReflection>) => JSX.Element;
24
24
  indexTemplate: (props: PageEvent<import("../../../models").ProjectReflection>) => JSX.Element;
25
25
  defaultLayout: (template: import("../..").RenderTemplate<PageEvent<Reflection>>, props: PageEvent<Reflection>) => JSX.Element;
26
+ /**
27
+ * Rendered just after the description for a reflection.
28
+ * This can be used to render a shortened type display of a reflection that the
29
+ * rest of the page expands on.
30
+ *
31
+ * Note: Will not be called for variables/type aliases, as they are summarized
32
+ * by their type declaration, which is already rendered by {@link DefaultThemeRenderContext.memberDeclaration}
33
+ */
34
+ reflectionPreview: (props: Reflection) => JSX.Element | undefined;
26
35
  analytics: () => JSX.Element | undefined;
27
36
  breadcrumb: (props: Reflection) => JSX.Element | undefined;
28
37
  commentSummary: (props: Reflection) => JSX.Element | undefined;
@@ -36,10 +45,10 @@ export declare class DefaultThemeRenderContext {
36
45
  memberDeclaration: (props: DeclarationReflection) => JSX.Element;
37
46
  memberGetterSetter: (props: DeclarationReflection) => JSX.Element;
38
47
  memberReference: (props: import("../../../models").ReferenceReflection) => JSX.Element;
39
- memberSignatureBody: (r_0: import("../../../models").SignatureReflection, r_1?: {
48
+ memberSignatureBody: (props: import("../../../models").SignatureReflection, r_1?: {
40
49
  hideSources?: boolean | undefined;
41
50
  } | undefined) => JSX.Element;
42
- memberSignatureTitle: (r_0: import("../../../models").SignatureReflection, r_1?: {
51
+ memberSignatureTitle: (props: import("../../../models").SignatureReflection, r_1?: {
43
52
  hideName?: boolean | undefined;
44
53
  arrowStyle?: boolean | undefined;
45
54
  } | undefined) => JSX.Element;
@@ -55,7 +64,9 @@ export declare class DefaultThemeRenderContext {
55
64
  pageNavigation: (props: PageEvent<Reflection>) => JSX.Element;
56
65
  parameter: (props: DeclarationReflection) => JSX.Element;
57
66
  toolbar: (props: PageEvent<Reflection>) => JSX.Element;
58
- type: (type: import("../../../models").Type | undefined) => JSX.Element;
67
+ type: (type: import("../../../models").Type | undefined, options?: {
68
+ topLevelLinks: boolean;
69
+ } | undefined) => JSX.Element;
59
70
  typeAndParent: (props: import("../../../models").Type) => JSX.Element;
60
71
  typeParameters: (typeParameters: import("../../../models").TypeParameterReflection[]) => JSX.Element;
61
72
  }