typedoc 0.26.6 → 0.26.7
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.
- package/dist/lib/converter/comments/linkResolver.d.ts +1 -1
- package/dist/lib/converter/comments/linkResolver.js +5 -0
- package/dist/lib/converter/factories/signature.js +6 -2
- package/dist/lib/converter/plugins/CommentPlugin.js +14 -3
- package/dist/lib/internationalization/translatable.d.ts +3 -0
- package/dist/lib/internationalization/translatable.js +3 -0
- package/dist/lib/models/reflections/declaration.js +2 -0
- package/dist/lib/models/reflections/signature.js +2 -0
- package/dist/lib/output/events.d.ts +3 -1
- package/dist/lib/output/events.js +9 -5
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +2 -2
- package/dist/lib/output/plugins/AssetsPlugin.js +19 -3
- package/dist/lib/output/renderer.d.ts +2 -4
- package/dist/lib/output/renderer.js +2 -4
- package/dist/lib/output/themes/MarkedPlugin.d.ts +1 -0
- package/dist/lib/output/themes/MarkedPlugin.js +21 -2
- package/dist/lib/output/themes/default/DefaultTheme.js +3 -0
- package/dist/lib/output/themes/default/layouts/default.js +1 -0
- package/dist/lib/utils/options/declaration.d.ts +3 -0
- package/dist/lib/utils/options/sources/typedoc.js +13 -1
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +1 -0
- package/dist/lib/utils/sort.js +2 -2
- package/dist/lib/validation/links.js +1 -1
- package/package.json +12 -12
- package/tsdoc.json +4 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Comment, type CommentDisplayPart,
|
|
1
|
+
import { type Comment, type CommentDisplayPart, Reflection, ReflectionSymbolId } from "../../models";
|
|
2
2
|
import { type DeclarationReference } from "./declarationReference";
|
|
3
3
|
export type ExternalResolveResult = {
|
|
4
4
|
target: string;
|
|
@@ -36,6 +36,11 @@ function processPart(reflection, part, externalResolver, options) {
|
|
|
36
36
|
return part;
|
|
37
37
|
}
|
|
38
38
|
function resolveLinkTag(reflection, part, externalResolver, options) {
|
|
39
|
+
// This tag may have already been resolved to if we are running in packages mode
|
|
40
|
+
// or when reading in a JSON file. #2680.
|
|
41
|
+
if (typeof part.target === "string" || part.target instanceof models_1.Reflection) {
|
|
42
|
+
return part;
|
|
43
|
+
}
|
|
39
44
|
let defaultDisplayText = "";
|
|
40
45
|
let pos = 0;
|
|
41
46
|
const end = part.text.length;
|
|
@@ -100,6 +100,10 @@ function createConstructSignatureWithType(context, signature, classType) {
|
|
|
100
100
|
context.converter.trigger(converter_events_1.ConverterEvents.CREATE_SIGNATURE, context, sigRef, declaration, signature);
|
|
101
101
|
}
|
|
102
102
|
function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
103
|
+
// #2698 if `satisfies` is used to imply a this parameter, we might have
|
|
104
|
+
// more parameters than parameter nodes and need to shift the parameterNode
|
|
105
|
+
// access index. Very ugly, but it does the job.
|
|
106
|
+
const parameterNodeOffset = parameterNodes?.length !== parameters.length ? -1 : 0;
|
|
103
107
|
return parameters.map((param, i) => {
|
|
104
108
|
const declaration = param.valueDeclaration;
|
|
105
109
|
(0, assert_1.default)(!declaration ||
|
|
@@ -139,7 +143,7 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
|
139
143
|
if (isOptional) {
|
|
140
144
|
paramRefl.type = (0, reflections_1.removeUndefined)(paramRefl.type);
|
|
141
145
|
}
|
|
142
|
-
paramRefl.defaultValue = (0, convert_expression_1.convertDefaultValue)(parameterNodes?.[i]);
|
|
146
|
+
paramRefl.defaultValue = (0, convert_expression_1.convertDefaultValue)(parameterNodes?.[i + parameterNodeOffset]);
|
|
143
147
|
paramRefl.setFlag(models_1.ReflectionFlag.Optional, isOptional);
|
|
144
148
|
// If we have no declaration, then this is an implicitly defined parameter in JS land
|
|
145
149
|
// because the method body uses `arguments`... which is always a rest argument
|
|
@@ -151,7 +155,7 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
|
151
155
|
typescript_1.default.isJSDocVariadicType(declaration.typeExpression.type);
|
|
152
156
|
}
|
|
153
157
|
paramRefl.setFlag(models_1.ReflectionFlag.Rest, isRest);
|
|
154
|
-
checkForDestructuredParameterDefaults(paramRefl, parameterNodes?.[i]);
|
|
158
|
+
checkForDestructuredParameterDefaults(paramRefl, parameterNodes?.[i + parameterNodeOffset]);
|
|
155
159
|
return paramRefl;
|
|
156
160
|
});
|
|
157
161
|
}
|
|
@@ -237,6 +237,15 @@ let CommentPlugin = (() => {
|
|
|
237
237
|
if (reflection.kindOf(models_1.ReflectionKind.Interface)) {
|
|
238
238
|
comment.removeModifier("@interface");
|
|
239
239
|
}
|
|
240
|
+
if (comment.hasModifier("@abstract")) {
|
|
241
|
+
if (reflection.kindOf(models_1.ReflectionKind.SomeSignature)) {
|
|
242
|
+
reflection.parent.setFlag(models_1.ReflectionFlag.Abstract);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
reflection.setFlag(models_1.ReflectionFlag.Abstract);
|
|
246
|
+
}
|
|
247
|
+
comment.removeModifier("@abstract");
|
|
248
|
+
}
|
|
240
249
|
if (comment.hasModifier("@private")) {
|
|
241
250
|
reflection.setFlag(models_1.ReflectionFlag.Private);
|
|
242
251
|
if (reflection.kindOf(models_1.ReflectionKind.CallSignature)) {
|
|
@@ -406,12 +415,14 @@ let CommentPlugin = (() => {
|
|
|
406
415
|
reflection.comment.removeModifier("@hideconstructor");
|
|
407
416
|
}
|
|
408
417
|
}
|
|
409
|
-
if (reflection instanceof models_1.DeclarationReflection
|
|
410
|
-
|
|
418
|
+
if ((reflection instanceof models_1.DeclarationReflection ||
|
|
419
|
+
reflection instanceof models_1.ParameterReflection) &&
|
|
420
|
+
reflection.comment) {
|
|
421
|
+
let sigs = [];
|
|
411
422
|
if (reflection.type instanceof models_1.ReflectionType) {
|
|
412
423
|
sigs = reflection.type.declaration.getNonIndexSignatures();
|
|
413
424
|
}
|
|
414
|
-
else {
|
|
425
|
+
else if (reflection instanceof models_1.DeclarationReflection) {
|
|
415
426
|
sigs = reflection.getNonIndexSignatures();
|
|
416
427
|
}
|
|
417
428
|
// For variables and properties, the symbol might own the comment but we might also
|
|
@@ -76,6 +76,7 @@ export declare const translatable: {
|
|
|
76
76
|
readonly disable_git_set_and_git_revision_used: "disableGit is set and sourceLinkTemplate contains {gitRevision}, which will be replaced with an empty string as no revision was provided";
|
|
77
77
|
readonly git_remote_0_not_valid: "The provided git remote \"{0}\" was not valid. Source links will be broken";
|
|
78
78
|
readonly custom_css_file_0_does_not_exist: "Custom CSS file at {0} does not exist";
|
|
79
|
+
readonly custom_js_file_0_does_not_exist: "Custom JavaScript file at {0} does not exist";
|
|
79
80
|
readonly unsupported_highlight_language_0_not_highlighted_in_comment_for_1: "Unsupported highlight language {0} will not be highlighted in comment for {1}";
|
|
80
81
|
readonly unloaded_language_0_not_highlighted_in_comment_for_1: "Code block with language {0} will not be highlighted in comment for {1} as it was not included in the highlightLanguages option";
|
|
81
82
|
readonly yaml_frontmatter_not_an_object: "Expected YAML frontmatter to be an object";
|
|
@@ -144,6 +145,7 @@ export declare const translatable: {
|
|
|
144
145
|
readonly help_darkHighlightTheme: "Specify the code highlighting theme in dark mode";
|
|
145
146
|
readonly help_highlightLanguages: "Specify the languages which will be loaded to highlight code when rendering";
|
|
146
147
|
readonly help_customCss: "Path to a custom CSS file to for the theme to import";
|
|
148
|
+
readonly help_customJs: "Path to a custom JS file to import";
|
|
147
149
|
readonly help_markdownItOptions: "Specify the options passed to markdown-it, the Markdown parser used by TypeDoc";
|
|
148
150
|
readonly help_markdownItLoader: "Specify a callback to be called when loading the markdown-it instance. Will be passed the instance of the parser which TypeDoc will use";
|
|
149
151
|
readonly help_maxTypeConversionDepth: "Set the maximum depth of types to be converted";
|
|
@@ -159,6 +161,7 @@ export declare const translatable: {
|
|
|
159
161
|
readonly help_readme: "Path to the readme file that should be displayed on the index page. Pass `none` to disable the index page and start the documentation on the globals page";
|
|
160
162
|
readonly help_cname: "Set the CNAME file text, it's useful for custom domains on GitHub Pages";
|
|
161
163
|
readonly help_sourceLinkExternal: "Specifies that source links should be treated as external links to be opened in a new tab";
|
|
164
|
+
readonly help_markdownLinkExternal: "Specifies that http[s]:// links in comments and markdown files should be treated as external links to be opened in a new tab";
|
|
162
165
|
readonly help_githubPages: "Generate a .nojekyll file to prevent 404 errors in GitHub Pages. Defaults to `true`";
|
|
163
166
|
readonly help_hostedBaseUrl: "Specify a base URL to be used in generating a sitemap.xml in our output folder and canonical links. If not specified, no sitemap will be generated";
|
|
164
167
|
readonly help_useHostedBaseUrlForAbsoluteLinks: "If set, TypeDoc will produce absolute links to pages on your site using the hostedBaseUrl option";
|
|
@@ -88,6 +88,7 @@ exports.translatable = {
|
|
|
88
88
|
git_remote_0_not_valid: `The provided git remote "{0}" was not valid. Source links will be broken`,
|
|
89
89
|
// output plugins
|
|
90
90
|
custom_css_file_0_does_not_exist: `Custom CSS file at {0} does not exist`,
|
|
91
|
+
custom_js_file_0_does_not_exist: `Custom JavaScript file at {0} does not exist`,
|
|
91
92
|
unsupported_highlight_language_0_not_highlighted_in_comment_for_1: `Unsupported highlight language {0} will not be highlighted in comment for {1}`,
|
|
92
93
|
unloaded_language_0_not_highlighted_in_comment_for_1: `Code block with language {0} will not be highlighted in comment for {1} as it was not included in the highlightLanguages option`,
|
|
93
94
|
yaml_frontmatter_not_an_object: `Expected YAML frontmatter to be an object`,
|
|
@@ -162,6 +163,7 @@ exports.translatable = {
|
|
|
162
163
|
help_darkHighlightTheme: "Specify the code highlighting theme in dark mode",
|
|
163
164
|
help_highlightLanguages: "Specify the languages which will be loaded to highlight code when rendering",
|
|
164
165
|
help_customCss: "Path to a custom CSS file to for the theme to import",
|
|
166
|
+
help_customJs: "Path to a custom JS file to import",
|
|
165
167
|
help_markdownItOptions: "Specify the options passed to markdown-it, the Markdown parser used by TypeDoc",
|
|
166
168
|
help_markdownItLoader: "Specify a callback to be called when loading the markdown-it instance. Will be passed the instance of the parser which TypeDoc will use",
|
|
167
169
|
help_maxTypeConversionDepth: "Set the maximum depth of types to be converted",
|
|
@@ -177,6 +179,7 @@ exports.translatable = {
|
|
|
177
179
|
help_readme: "Path to the readme file that should be displayed on the index page. Pass `none` to disable the index page and start the documentation on the globals page",
|
|
178
180
|
help_cname: "Set the CNAME file text, it's useful for custom domains on GitHub Pages",
|
|
179
181
|
help_sourceLinkExternal: "Specifies that source links should be treated as external links to be opened in a new tab",
|
|
182
|
+
help_markdownLinkExternal: "Specifies that http[s]:// links in comments and markdown files should be treated as external links to be opened in a new tab",
|
|
180
183
|
help_githubPages: "Generate a .nojekyll file to prevent 404 errors in GitHub Pages. Defaults to `true`",
|
|
181
184
|
help_hostedBaseUrl: "Specify a base URL to be used in generating a sitemap.xml in our output folder and canonical links. If not specified, no sitemap will be generated",
|
|
182
185
|
help_useHostedBaseUrlForAbsoluteLinks: "If set, TypeDoc will produce absolute links to pages on your site using the hostedBaseUrl option",
|
|
@@ -150,8 +150,10 @@ class DeclarationReflection extends container_1.ContainerReflection {
|
|
|
150
150
|
this.type = de.revive(obj.type, (t) => de.constructType(t));
|
|
151
151
|
this.signatures = de.reviveMany(obj.signatures, (r) => de.constructReflection(r));
|
|
152
152
|
// TypeDoc 0.25, remove check with 0.28.
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
153
154
|
if (obj.indexSignature) {
|
|
154
155
|
this.indexSignatures = [
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
155
157
|
de.revive(obj.indexSignature, (r) => de.constructReflection(r)),
|
|
156
158
|
];
|
|
157
159
|
}
|
|
@@ -61,7 +61,9 @@ class SignatureReflection extends abstract_1.Reflection {
|
|
|
61
61
|
fromObject(de, obj) {
|
|
62
62
|
super.fromObject(de, obj);
|
|
63
63
|
this.sources = de.reviveMany(obj.sources, (t) => new file_1.SourceReference(t.fileName, t.line, t.character));
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
64
65
|
if (obj.typeParameter) {
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
65
67
|
this.typeParameters = de.reviveMany(obj.typeParameter, (t) => de.constructReflection(t));
|
|
66
68
|
}
|
|
67
69
|
else {
|
|
@@ -57,7 +57,7 @@ export interface PageHeading {
|
|
|
57
57
|
* @see {@link Renderer.EVENT_BEGIN_PAGE}
|
|
58
58
|
* @see {@link Renderer.EVENT_END_PAGE}
|
|
59
59
|
*/
|
|
60
|
-
export declare class PageEvent<out Model = unknown>
|
|
60
|
+
export declare class PageEvent<out Model = unknown> {
|
|
61
61
|
/**
|
|
62
62
|
* The project the renderer is currently processing.
|
|
63
63
|
*/
|
|
@@ -107,6 +107,8 @@ export declare class PageEvent<out Model = unknown> extends Event {
|
|
|
107
107
|
* @event
|
|
108
108
|
*/
|
|
109
109
|
static readonly END = "endPage";
|
|
110
|
+
constructor(model: Model);
|
|
111
|
+
/** @deprecated use the single constructor arg instead, will be removed in 0.27 */
|
|
110
112
|
constructor(name: string, model: Model);
|
|
111
113
|
}
|
|
112
114
|
/**
|
|
@@ -45,7 +45,7 @@ class RendererEvent {
|
|
|
45
45
|
* @returns A newly created {@link PageEvent} instance.
|
|
46
46
|
*/
|
|
47
47
|
createPageEvent(mapping) {
|
|
48
|
-
const event = new PageEvent(
|
|
48
|
+
const event = new PageEvent(mapping.model);
|
|
49
49
|
event.project = this.project;
|
|
50
50
|
event.url = mapping.url;
|
|
51
51
|
event.filename = Path.join(this.outputDirectory, mapping.url);
|
|
@@ -70,7 +70,7 @@ RendererEvent.END = "endRender";
|
|
|
70
70
|
* @see {@link Renderer.EVENT_BEGIN_PAGE}
|
|
71
71
|
* @see {@link Renderer.EVENT_END_PAGE}
|
|
72
72
|
*/
|
|
73
|
-
class PageEvent
|
|
73
|
+
class PageEvent {
|
|
74
74
|
/**
|
|
75
75
|
* Start a new section of the page. Sections are collapsible within
|
|
76
76
|
* the "On This Page" sidebar.
|
|
@@ -82,8 +82,7 @@ class PageEvent extends Event {
|
|
|
82
82
|
headings: this.pageHeadings,
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
constructor(
|
|
86
|
-
super(name);
|
|
85
|
+
constructor(nameOrModel, model) {
|
|
87
86
|
/**
|
|
88
87
|
* Links to content within this page that should be rendered in the page navigation.
|
|
89
88
|
* This is built when rendering the document content.
|
|
@@ -98,7 +97,12 @@ class PageEvent extends Event {
|
|
|
98
97
|
headings: this.pageHeadings,
|
|
99
98
|
},
|
|
100
99
|
];
|
|
101
|
-
|
|
100
|
+
if (typeof nameOrModel === "string") {
|
|
101
|
+
this.model = model;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this.model = nameOrModel;
|
|
105
|
+
}
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
exports.PageEvent = PageEvent;
|
|
@@ -4,8 +4,8 @@ import { RendererComponent } from "../components";
|
|
|
4
4
|
* source folder to the output directory.
|
|
5
5
|
*/
|
|
6
6
|
export declare class AssetsPlugin extends RendererComponent {
|
|
7
|
-
|
|
8
|
-
accessor
|
|
7
|
+
private accessor customCss;
|
|
8
|
+
private accessor customJs;
|
|
9
9
|
getTranslatedStrings(): {
|
|
10
10
|
copy: import("../../internationalization").TranslatedString;
|
|
11
11
|
copied: import("../../internationalization").TranslatedString;
|
|
@@ -63,7 +63,7 @@ const path_1 = require("path");
|
|
|
63
63
|
* source folder to the output directory.
|
|
64
64
|
*/
|
|
65
65
|
let AssetsPlugin = (() => {
|
|
66
|
-
var _AssetsPlugin_customCss_accessor_storage;
|
|
66
|
+
var _AssetsPlugin_customCss_accessor_storage, _AssetsPlugin_customJs_accessor_storage;
|
|
67
67
|
let _classDecorators = [(0, components_1.Component)({ name: "assets" })];
|
|
68
68
|
let _classDescriptor;
|
|
69
69
|
let _classExtraInitializers = [];
|
|
@@ -72,10 +72,14 @@ let AssetsPlugin = (() => {
|
|
|
72
72
|
let _customCss_decorators;
|
|
73
73
|
let _customCss_initializers = [];
|
|
74
74
|
let _customCss_extraInitializers = [];
|
|
75
|
+
let _customJs_decorators;
|
|
76
|
+
let _customJs_initializers = [];
|
|
77
|
+
let _customJs_extraInitializers = [];
|
|
75
78
|
var AssetsPlugin = _classThis = class extends _classSuper {
|
|
76
|
-
/** @internal */
|
|
77
79
|
get customCss() { return __classPrivateFieldGet(this, _AssetsPlugin_customCss_accessor_storage, "f"); }
|
|
78
80
|
set customCss(value) { __classPrivateFieldSet(this, _AssetsPlugin_customCss_accessor_storage, value, "f"); }
|
|
81
|
+
get customJs() { return __classPrivateFieldGet(this, _AssetsPlugin_customJs_accessor_storage, "f"); }
|
|
82
|
+
set customJs(value) { __classPrivateFieldSet(this, _AssetsPlugin_customJs_accessor_storage, value, "f"); }
|
|
79
83
|
getTranslatedStrings() {
|
|
80
84
|
return {
|
|
81
85
|
copy: this.application.i18n.theme_copy(),
|
|
@@ -100,6 +104,14 @@ let AssetsPlugin = (() => {
|
|
|
100
104
|
this.application.logger.error(this.application.i18n.custom_css_file_0_does_not_exist(this.customCss));
|
|
101
105
|
}
|
|
102
106
|
}
|
|
107
|
+
if (this.customJs) {
|
|
108
|
+
if ((0, fs_2.existsSync)(this.customJs)) {
|
|
109
|
+
(0, fs_1.copySync)(this.customJs, (0, path_1.join)(dest, "custom.js"));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
this.application.logger.error(this.application.i18n.custom_js_file_0_does_not_exist(this.customJs));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
103
115
|
}
|
|
104
116
|
/**
|
|
105
117
|
* Triggered before the renderer starts rendering a project.
|
|
@@ -128,15 +140,19 @@ let AssetsPlugin = (() => {
|
|
|
128
140
|
constructor() {
|
|
129
141
|
super(...arguments);
|
|
130
142
|
_AssetsPlugin_customCss_accessor_storage.set(this, __runInitializers(this, _customCss_initializers, void 0));
|
|
131
|
-
__runInitializers(this, _customCss_extraInitializers);
|
|
143
|
+
_AssetsPlugin_customJs_accessor_storage.set(this, (__runInitializers(this, _customCss_extraInitializers), __runInitializers(this, _customJs_initializers, void 0)));
|
|
144
|
+
__runInitializers(this, _customJs_extraInitializers);
|
|
132
145
|
}
|
|
133
146
|
};
|
|
134
147
|
_AssetsPlugin_customCss_accessor_storage = new WeakMap();
|
|
148
|
+
_AssetsPlugin_customJs_accessor_storage = new WeakMap();
|
|
135
149
|
__setFunctionName(_classThis, "AssetsPlugin");
|
|
136
150
|
(() => {
|
|
137
151
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
138
152
|
_customCss_decorators = [(0, utils_1.Option)("customCss")];
|
|
153
|
+
_customJs_decorators = [(0, utils_1.Option)("customJs")];
|
|
139
154
|
__esDecorate(_classThis, null, _customCss_decorators, { kind: "accessor", name: "customCss", static: false, private: false, access: { has: obj => "customCss" in obj, get: obj => obj.customCss, set: (obj, value) => { obj.customCss = value; } }, metadata: _metadata }, _customCss_initializers, _customCss_extraInitializers);
|
|
155
|
+
__esDecorate(_classThis, null, _customJs_decorators, { kind: "accessor", name: "customJs", static: false, private: false, access: { has: obj => "customJs" in obj, get: obj => obj.customJs, set: (obj, value) => { obj.customJs = value; } }, metadata: _metadata }, _customJs_initializers, _customJs_extraInitializers);
|
|
140
156
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
141
157
|
AssetsPlugin = _classThis = _classDescriptor.value;
|
|
142
158
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -100,13 +100,11 @@ export interface RendererEvents {
|
|
|
100
100
|
*
|
|
101
101
|
* * {@link Renderer.EVENT_BEGIN_PAGE}<br>
|
|
102
102
|
* Triggered before a document will be rendered. The listener receives an instance of
|
|
103
|
-
* {@link PageEvent}.
|
|
104
|
-
* document can be canceled.
|
|
103
|
+
* {@link PageEvent}.
|
|
105
104
|
*
|
|
106
105
|
* * {@link Renderer.EVENT_END_PAGE}<br>
|
|
107
106
|
* Triggered after a document has been rendered, just before it is written to disc. The
|
|
108
|
-
* listener receives an instance of {@link PageEvent}.
|
|
109
|
-
* {@link PageEvent.preventDefault} the the document will not be saved to disc.
|
|
107
|
+
* listener receives an instance of {@link PageEvent}.
|
|
110
108
|
*
|
|
111
109
|
* * {@link Renderer.EVENT_END}<br>
|
|
112
110
|
* Triggered after the renderer has written all documents. The listener receives
|
|
@@ -108,13 +108,11 @@ const jsx_1 = require("../utils/jsx");
|
|
|
108
108
|
*
|
|
109
109
|
* * {@link Renderer.EVENT_BEGIN_PAGE}<br>
|
|
110
110
|
* Triggered before a document will be rendered. The listener receives an instance of
|
|
111
|
-
* {@link PageEvent}.
|
|
112
|
-
* document can be canceled.
|
|
111
|
+
* {@link PageEvent}.
|
|
113
112
|
*
|
|
114
113
|
* * {@link Renderer.EVENT_END_PAGE}<br>
|
|
115
114
|
* Triggered after a document has been rendered, just before it is written to disc. The
|
|
116
|
-
* listener receives an instance of {@link PageEvent}.
|
|
117
|
-
* {@link PageEvent.preventDefault} the the document will not be saved to disc.
|
|
115
|
+
* listener receives an instance of {@link PageEvent}.
|
|
118
116
|
*
|
|
119
117
|
* * {@link Renderer.EVENT_END}<br>
|
|
120
118
|
* Triggered after the renderer has written all documents. The listener receives
|
|
@@ -11,6 +11,7 @@ export declare class MarkedPlugin extends ContextAwareRendererComponent {
|
|
|
11
11
|
accessor lightTheme: BundledTheme;
|
|
12
12
|
accessor darkTheme: BundledTheme;
|
|
13
13
|
accessor markdownItOptions: Record<string, unknown>;
|
|
14
|
+
accessor markdownLinkExternal: boolean;
|
|
14
15
|
private parser?;
|
|
15
16
|
/**
|
|
16
17
|
* This needing to be here really feels hacky... probably some nicer way to do this.
|
|
@@ -75,7 +75,7 @@ function getDefaultSlugger(logger) {
|
|
|
75
75
|
* @internal
|
|
76
76
|
*/
|
|
77
77
|
let MarkedPlugin = (() => {
|
|
78
|
-
var _MarkedPlugin_lightTheme_accessor_storage, _MarkedPlugin_darkTheme_accessor_storage, _MarkedPlugin_markdownItOptions_accessor_storage;
|
|
78
|
+
var _MarkedPlugin_lightTheme_accessor_storage, _MarkedPlugin_darkTheme_accessor_storage, _MarkedPlugin_markdownItOptions_accessor_storage, _MarkedPlugin_markdownLinkExternal_accessor_storage;
|
|
79
79
|
let _classDecorators = [(0, components_1.Component)({ name: "marked" })];
|
|
80
80
|
let _classDescriptor;
|
|
81
81
|
let _classExtraInitializers = [];
|
|
@@ -90,13 +90,17 @@ let MarkedPlugin = (() => {
|
|
|
90
90
|
let _markdownItOptions_decorators;
|
|
91
91
|
let _markdownItOptions_initializers = [];
|
|
92
92
|
let _markdownItOptions_extraInitializers = [];
|
|
93
|
+
let _markdownLinkExternal_decorators;
|
|
94
|
+
let _markdownLinkExternal_initializers = [];
|
|
95
|
+
let _markdownLinkExternal_extraInitializers = [];
|
|
93
96
|
var MarkedPlugin = _classThis = class extends _classSuper {
|
|
94
97
|
constructor() {
|
|
95
98
|
super(...arguments);
|
|
96
99
|
_MarkedPlugin_lightTheme_accessor_storage.set(this, __runInitializers(this, _lightTheme_initializers, void 0));
|
|
97
100
|
_MarkedPlugin_darkTheme_accessor_storage.set(this, (__runInitializers(this, _lightTheme_extraInitializers), __runInitializers(this, _darkTheme_initializers, void 0)));
|
|
98
101
|
_MarkedPlugin_markdownItOptions_accessor_storage.set(this, (__runInitializers(this, _darkTheme_extraInitializers), __runInitializers(this, _markdownItOptions_initializers, void 0)));
|
|
99
|
-
this
|
|
102
|
+
_MarkedPlugin_markdownLinkExternal_accessor_storage.set(this, (__runInitializers(this, _markdownItOptions_extraInitializers), __runInitializers(this, _markdownLinkExternal_initializers, void 0)));
|
|
103
|
+
this.parser = __runInitializers(this, _markdownLinkExternal_extraInitializers);
|
|
100
104
|
/**
|
|
101
105
|
* This needing to be here really feels hacky... probably some nicer way to do this.
|
|
102
106
|
* Revisit when adding support for arbitrary pages in 0.26.
|
|
@@ -110,6 +114,8 @@ let MarkedPlugin = (() => {
|
|
|
110
114
|
set darkTheme(value) { __classPrivateFieldSet(this, _MarkedPlugin_darkTheme_accessor_storage, value, "f"); }
|
|
111
115
|
get markdownItOptions() { return __classPrivateFieldGet(this, _MarkedPlugin_markdownItOptions_accessor_storage, "f"); }
|
|
112
116
|
set markdownItOptions(value) { __classPrivateFieldSet(this, _MarkedPlugin_markdownItOptions_accessor_storage, value, "f"); }
|
|
117
|
+
get markdownLinkExternal() { return __classPrivateFieldGet(this, _MarkedPlugin_markdownLinkExternal_accessor_storage, "f"); }
|
|
118
|
+
set markdownLinkExternal(value) { __classPrivateFieldSet(this, _MarkedPlugin_markdownLinkExternal_accessor_storage, value, "f"); }
|
|
113
119
|
/**
|
|
114
120
|
* Create a new MarkedPlugin instance.
|
|
115
121
|
*/
|
|
@@ -290,6 +296,16 @@ let MarkedPlugin = (() => {
|
|
|
290
296
|
const token = tokens[idx];
|
|
291
297
|
const href = token.attrGet("href")?.replace(/^#(?:md:)?(.+)/, "#md:$1");
|
|
292
298
|
if (href) {
|
|
299
|
+
// Note: This doesn't catch @link tags to reflections as those
|
|
300
|
+
// will be relative links. This will likely have to change with
|
|
301
|
+
// the introduction of support for customized routers whenever
|
|
302
|
+
// that becomes a real thing.
|
|
303
|
+
if (this.markdownLinkExternal && /https?:\/\//i.test(href)) {
|
|
304
|
+
token.attrSet("target", "_blank");
|
|
305
|
+
const classes = token.attrGet("class")?.split(" ") || [];
|
|
306
|
+
classes.push("external");
|
|
307
|
+
token.attrSet("class", classes.join(" "));
|
|
308
|
+
}
|
|
293
309
|
token.attrSet("href", href);
|
|
294
310
|
}
|
|
295
311
|
return self.renderToken(tokens, idx, options);
|
|
@@ -307,15 +323,18 @@ let MarkedPlugin = (() => {
|
|
|
307
323
|
_MarkedPlugin_lightTheme_accessor_storage = new WeakMap();
|
|
308
324
|
_MarkedPlugin_darkTheme_accessor_storage = new WeakMap();
|
|
309
325
|
_MarkedPlugin_markdownItOptions_accessor_storage = new WeakMap();
|
|
326
|
+
_MarkedPlugin_markdownLinkExternal_accessor_storage = new WeakMap();
|
|
310
327
|
__setFunctionName(_classThis, "MarkedPlugin");
|
|
311
328
|
(() => {
|
|
312
329
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
313
330
|
_lightTheme_decorators = [(0, utils_1.Option)("lightHighlightTheme")];
|
|
314
331
|
_darkTheme_decorators = [(0, utils_1.Option)("darkHighlightTheme")];
|
|
315
332
|
_markdownItOptions_decorators = [(0, utils_1.Option)("markdownItOptions")];
|
|
333
|
+
_markdownLinkExternal_decorators = [(0, utils_1.Option)("markdownLinkExternal")];
|
|
316
334
|
__esDecorate(_classThis, null, _lightTheme_decorators, { kind: "accessor", name: "lightTheme", static: false, private: false, access: { has: obj => "lightTheme" in obj, get: obj => obj.lightTheme, set: (obj, value) => { obj.lightTheme = value; } }, metadata: _metadata }, _lightTheme_initializers, _lightTheme_extraInitializers);
|
|
317
335
|
__esDecorate(_classThis, null, _darkTheme_decorators, { kind: "accessor", name: "darkTheme", static: false, private: false, access: { has: obj => "darkTheme" in obj, get: obj => obj.darkTheme, set: (obj, value) => { obj.darkTheme = value; } }, metadata: _metadata }, _darkTheme_initializers, _darkTheme_extraInitializers);
|
|
318
336
|
__esDecorate(_classThis, null, _markdownItOptions_decorators, { kind: "accessor", name: "markdownItOptions", static: false, private: false, access: { has: obj => "markdownItOptions" in obj, get: obj => obj.markdownItOptions, set: (obj, value) => { obj.markdownItOptions = value; } }, metadata: _metadata }, _markdownItOptions_initializers, _markdownItOptions_extraInitializers);
|
|
337
|
+
__esDecorate(_classThis, null, _markdownLinkExternal_decorators, { kind: "accessor", name: "markdownLinkExternal", static: false, private: false, access: { has: obj => "markdownLinkExternal" in obj, get: obj => obj.markdownLinkExternal, set: (obj, value) => { obj.markdownLinkExternal = value; } }, metadata: _metadata }, _markdownLinkExternal_initializers, _markdownLinkExternal_extraInitializers);
|
|
319
338
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
320
339
|
MarkedPlugin = _classThis = _classDescriptor.value;
|
|
321
340
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -258,6 +258,9 @@ class DefaultTheme extends theme_1.Theme {
|
|
|
258
258
|
children,
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
|
+
if (opts.excludeReferences && element instanceof models_1.ReferenceReflection) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
261
264
|
return {
|
|
262
265
|
text: (0, lib_1.getDisplayName)(element),
|
|
263
266
|
path: element.url,
|
|
@@ -17,6 +17,7 @@ const defaultLayout = (context, template, props) => (utils_1.JSX.createElement("
|
|
|
17
17
|
utils_1.JSX.createElement("link", { rel: "stylesheet", href: context.relativeURL("assets/highlight.css", true) }),
|
|
18
18
|
context.options.getValue("customCss") && (utils_1.JSX.createElement("link", { rel: "stylesheet", href: context.relativeURL("assets/custom.css", true) })),
|
|
19
19
|
utils_1.JSX.createElement("script", { defer: true, src: context.relativeURL("assets/main.js", true) }),
|
|
20
|
+
context.options.getValue("customJs") && (utils_1.JSX.createElement("script", { defer: true, src: context.relativeURL("assets/custom.js", true) })),
|
|
20
21
|
utils_1.JSX.createElement("script", { async: true, src: context.relativeURL("assets/icons.js", true), id: "tsd-icons-script" }),
|
|
21
22
|
utils_1.JSX.createElement("script", { async: true, src: context.relativeURL("assets/search.js", true), id: "tsd-search-script" }),
|
|
22
23
|
utils_1.JSX.createElement("script", { async: true, src: context.relativeURL("assets/navigation.js", true), id: "tsd-nav-script" }),
|
|
@@ -85,6 +85,7 @@ export interface TypeDocOptionMap {
|
|
|
85
85
|
disableSources: boolean;
|
|
86
86
|
sourceLinkTemplate: string;
|
|
87
87
|
sourceLinkExternal: boolean;
|
|
88
|
+
markdownLinkExternal: boolean;
|
|
88
89
|
disableGit: boolean;
|
|
89
90
|
gitRevision: string;
|
|
90
91
|
gitRemote: string;
|
|
@@ -98,6 +99,7 @@ export interface TypeDocOptionMap {
|
|
|
98
99
|
darkHighlightTheme: ShikiTheme;
|
|
99
100
|
highlightLanguages: string[];
|
|
100
101
|
customCss: string;
|
|
102
|
+
customJs: string;
|
|
101
103
|
markdownItOptions: ManuallyValidatedOption<Record<string, unknown>>;
|
|
102
104
|
/**
|
|
103
105
|
* Will be called when TypeDoc is setting up the markdown parser to use to render markdown.
|
|
@@ -142,6 +144,7 @@ export interface TypeDocOptionMap {
|
|
|
142
144
|
includeGroups: boolean;
|
|
143
145
|
includeFolders: boolean;
|
|
144
146
|
compactFolders: boolean;
|
|
147
|
+
excludeReferences: boolean;
|
|
145
148
|
};
|
|
146
149
|
visibilityFilters: ManuallyValidatedOption<{
|
|
147
150
|
protected?: boolean;
|
|
@@ -298,6 +298,11 @@ function addTypeDocOptions(options) {
|
|
|
298
298
|
help: (i18n) => i18n.help_customCss(),
|
|
299
299
|
type: declaration_1.ParameterType.Path,
|
|
300
300
|
});
|
|
301
|
+
options.addDeclaration({
|
|
302
|
+
name: "customJs",
|
|
303
|
+
help: (i18n) => i18n.help_customJs(),
|
|
304
|
+
type: declaration_1.ParameterType.Path,
|
|
305
|
+
});
|
|
301
306
|
options.addDeclaration({
|
|
302
307
|
name: "markdownItOptions",
|
|
303
308
|
help: (i18n) => i18n.help_markdownItOptions(),
|
|
@@ -393,6 +398,12 @@ function addTypeDocOptions(options) {
|
|
|
393
398
|
help: (i18n) => i18n.help_sourceLinkExternal(),
|
|
394
399
|
type: declaration_1.ParameterType.Boolean,
|
|
395
400
|
});
|
|
401
|
+
options.addDeclaration({
|
|
402
|
+
name: "markdownLinkExternal",
|
|
403
|
+
help: (i18n) => i18n.help_markdownLinkExternal(),
|
|
404
|
+
type: declaration_1.ParameterType.Boolean,
|
|
405
|
+
defaultValue: true,
|
|
406
|
+
});
|
|
396
407
|
options.addDeclaration({
|
|
397
408
|
name: "githubPages",
|
|
398
409
|
help: (i18n) => i18n.help_githubPages(),
|
|
@@ -403,7 +414,7 @@ function addTypeDocOptions(options) {
|
|
|
403
414
|
name: "hostedBaseUrl",
|
|
404
415
|
help: (i18n) => i18n.help_hostedBaseUrl(),
|
|
405
416
|
validate(value, i18n) {
|
|
406
|
-
if (!/https
|
|
417
|
+
if (!/https?:\/\//i.test(value)) {
|
|
407
418
|
throw new Error(i18n.hostedBaseUrl_must_start_with_http());
|
|
408
419
|
}
|
|
409
420
|
},
|
|
@@ -502,6 +513,7 @@ function addTypeDocOptions(options) {
|
|
|
502
513
|
includeGroups: false,
|
|
503
514
|
includeFolders: true,
|
|
504
515
|
compactFolders: true,
|
|
516
|
+
excludeReferences: false,
|
|
505
517
|
},
|
|
506
518
|
});
|
|
507
519
|
options.addDeclaration({
|
|
@@ -3,4 +3,4 @@ export declare const blockTags: readonly ["@defaultValue", "@deprecated", "@exam
|
|
|
3
3
|
export declare const tsdocInlineTags: readonly ["@link", "@inheritDoc", "@label"];
|
|
4
4
|
export declare const inlineTags: readonly ["@link", "@inheritDoc", "@label", "@linkcode", "@linkplain"];
|
|
5
5
|
export declare const tsdocModifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@public", "@readonly", "@sealed", "@virtual"];
|
|
6
|
-
export declare const modifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@public", "@readonly", "@sealed", "@virtual", "@class", "@enum", "@event", "@hidden", "@hideCategories", "@hideconstructor", "@hideGroups", "@ignore", "@interface", "@namespace", "@overload", "@private", "@protected", "@showCategories", "@showGroups"];
|
|
6
|
+
export declare const modifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@public", "@readonly", "@sealed", "@virtual", "@abstract", "@class", "@enum", "@event", "@hidden", "@hideCategories", "@hideconstructor", "@hideGroups", "@ignore", "@interface", "@namespace", "@overload", "@private", "@protected", "@showCategories", "@showGroups"];
|
package/dist/lib/utils/sort.js
CHANGED
|
@@ -46,14 +46,14 @@ const sorts = {
|
|
|
46
46
|
return false;
|
|
47
47
|
},
|
|
48
48
|
alphabetical(a, b) {
|
|
49
|
-
return a.name <
|
|
49
|
+
return a.name.localeCompare(b.name) < 0;
|
|
50
50
|
},
|
|
51
51
|
"alphabetical-ignoring-documents"(a, b) {
|
|
52
52
|
if (a.kindOf(kind_1.ReflectionKind.Document) ||
|
|
53
53
|
b.kindOf(kind_1.ReflectionKind.Document)) {
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
|
-
return a.name <
|
|
56
|
+
return a.name.localeCompare(b.name) < 0;
|
|
57
57
|
},
|
|
58
58
|
"enum-value-ascending"(a, b) {
|
|
59
59
|
if (a.kind == kind_1.ReflectionKind.EnumMember &&
|
|
@@ -8,7 +8,7 @@ function getBrokenPartLinks(parts) {
|
|
|
8
8
|
for (const part of parts) {
|
|
9
9
|
if (part.kind === "inline-tag" &&
|
|
10
10
|
linkTags.includes(part.tag) &&
|
|
11
|
-
!part.target) {
|
|
11
|
+
(!part.target || part.target instanceof models_1.ReflectionSymbolId)) {
|
|
12
12
|
links.push(part.text.trim());
|
|
13
13
|
}
|
|
14
14
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typedoc",
|
|
3
3
|
"description": "Create api documentation for TypeScript projects.",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.7",
|
|
5
5
|
"homepage": "https://typedoc.org",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dist/index.js",
|
|
@@ -27,27 +27,27 @@
|
|
|
27
27
|
"lunr": "^2.3.9",
|
|
28
28
|
"markdown-it": "^14.1.0",
|
|
29
29
|
"minimatch": "^9.0.5",
|
|
30
|
-
"shiki": "^1.
|
|
31
|
-
"yaml": "^2.
|
|
30
|
+
"shiki": "^1.16.2",
|
|
31
|
+
"yaml": "^2.5.1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x"
|
|
34
|
+
"typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/lunr": "^2.3.7",
|
|
38
|
-
"@types/markdown-it": "^14.1.
|
|
38
|
+
"@types/markdown-it": "^14.1.2",
|
|
39
39
|
"@types/mocha": "^10.0.7",
|
|
40
40
|
"@types/node": "18",
|
|
41
41
|
"@typestrong/fs-fixture-builder": "github:TypeStrong/fs-fixture-builder#34113409e3a171e68ce5e2b55461ef5c35591cfe",
|
|
42
42
|
"c8": "^10.1.2",
|
|
43
|
-
"esbuild": "^0.
|
|
44
|
-
"eslint": "^9.
|
|
45
|
-
"mocha": "^10.
|
|
46
|
-
"prettier": "3.3.
|
|
47
|
-
"puppeteer": "^
|
|
43
|
+
"esbuild": "^0.23.1",
|
|
44
|
+
"eslint": "^9.9.1",
|
|
45
|
+
"mocha": "^10.7.3",
|
|
46
|
+
"prettier": "3.3.3",
|
|
47
|
+
"puppeteer": "^23.3.0",
|
|
48
48
|
"ts-node": "^10.9.2",
|
|
49
|
-
"typescript": "5.
|
|
50
|
-
"typescript-eslint": "^8.0
|
|
49
|
+
"typescript": "5.6.1-rc",
|
|
50
|
+
"typescript-eslint": "^8.4.0"
|
|
51
51
|
},
|
|
52
52
|
"files": [
|
|
53
53
|
"/bin",
|