typedoc 0.26.11 → 0.27.0-beta.1
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/bin/package.json +3 -0
- package/bin/typedoc +1 -1
- package/dist/index.d.ts +23 -13
- package/dist/index.js +22 -81
- package/dist/lib/application-events.js +1 -4
- package/dist/lib/application.d.ts +26 -16
- package/dist/lib/application.js +222 -242
- package/dist/lib/cli.js +3 -40
- package/dist/lib/converter/comments/blockLexer.d.ts +1 -1
- package/dist/lib/converter/comments/blockLexer.js +24 -30
- package/dist/lib/converter/comments/declarationReference.js +10 -21
- package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +2 -2
- package/dist/lib/converter/comments/declarationReferenceResolver.js +40 -36
- package/dist/lib/converter/comments/discovery.d.ts +4 -4
- package/dist/lib/converter/comments/discovery.js +154 -172
- package/dist/lib/converter/comments/index.d.ts +4 -4
- package/dist/lib/converter/comments/index.js +39 -50
- package/dist/lib/converter/comments/lexer.d.ts +1 -1
- package/dist/lib/converter/comments/lexer.js +2 -5
- package/dist/lib/converter/comments/lineLexer.d.ts +1 -1
- package/dist/lib/converter/comments/lineLexer.js +12 -15
- package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
- package/dist/lib/converter/comments/linkResolver.js +14 -21
- package/dist/lib/converter/comments/parser.d.ts +6 -6
- package/dist/lib/converter/comments/parser.js +69 -96
- package/dist/lib/converter/comments/rawLexer.d.ts +1 -1
- package/dist/lib/converter/comments/rawLexer.js +13 -16
- package/dist/lib/converter/comments/tagName.js +1 -4
- package/dist/lib/converter/comments/textParser.d.ts +4 -4
- package/dist/lib/converter/comments/textParser.js +28 -30
- package/dist/lib/converter/components.d.ts +2 -3
- package/dist/lib/converter/components.js +2 -7
- package/dist/lib/converter/context.d.ts +9 -9
- package/dist/lib/converter/context.js +54 -44
- package/dist/lib/converter/convert-expression.js +16 -23
- package/dist/lib/converter/converter-events.d.ts +1 -0
- package/dist/lib/converter/converter-events.js +2 -4
- package/dist/lib/converter/converter.d.ts +16 -13
- package/dist/lib/converter/converter.js +212 -239
- package/dist/lib/converter/factories/index-signature.d.ts +3 -3
- package/dist/lib/converter/factories/index-signature.js +43 -26
- package/dist/lib/converter/factories/signature.d.ts +2 -2
- package/dist/lib/converter/factories/signature.js +95 -106
- package/dist/lib/converter/index.d.ts +6 -7
- package/dist/lib/converter/index.js +3 -11
- package/dist/lib/converter/jsdoc.d.ts +1 -1
- package/dist/lib/converter/jsdoc.js +34 -41
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +6 -21
- package/dist/lib/converter/plugins/CategoryPlugin.js +57 -139
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +3 -5
- package/dist/lib/converter/plugins/CommentPlugin.js +153 -163
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +10 -9
- package/dist/lib/converter/plugins/GroupPlugin.js +87 -124
- package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +3 -5
- package/dist/lib/converter/plugins/ImplementsPlugin.js +255 -321
- package/dist/lib/converter/plugins/IncludePlugin.d.ts +11 -0
- package/dist/lib/converter/plugins/IncludePlugin.js +72 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +4 -3
- package/dist/lib/converter/plugins/InheritDocPlugin.js +41 -72
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +5 -5
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +37 -58
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.d.ts +12 -0
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +49 -0
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +4 -3
- package/dist/lib/converter/plugins/PackagePlugin.js +62 -111
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +3 -5
- package/dist/lib/converter/plugins/SourcePlugin.js +69 -110
- package/dist/lib/converter/plugins/TypePlugin.d.ts +4 -6
- package/dist/lib/converter/plugins/TypePlugin.js +95 -158
- package/dist/lib/converter/plugins/index.d.ts +10 -9
- package/dist/lib/converter/plugins/index.js +10 -21
- package/dist/lib/converter/symbols.d.ts +1 -1
- package/dist/lib/converter/symbols.js +234 -227
- package/dist/lib/converter/types.d.ts +2 -2
- package/dist/lib/converter/types.js +252 -237
- package/dist/lib/converter/utils/nodes.js +5 -13
- package/dist/lib/converter/utils/reflections.d.ts +1 -1
- package/dist/lib/converter/utils/reflections.js +4 -7
- package/dist/lib/converter/utils/repository.d.ts +1 -1
- package/dist/lib/converter/utils/repository.js +103 -97
- package/dist/lib/converter/utils/symbols.js +3 -9
- package/dist/lib/internationalization/index.d.ts +3 -4
- package/dist/lib/internationalization/index.js +3 -8
- package/dist/lib/internationalization/internationalization.d.ts +5 -4
- package/dist/lib/internationalization/internationalization.js +97 -103
- package/dist/lib/internationalization/locale-utils.cjs +8 -0
- package/dist/lib/internationalization/locale-utils.d.cts +8 -0
- package/dist/lib/internationalization/locales/en.cjs +372 -2
- package/dist/lib/internationalization/locales/en.d.cts +343 -2
- package/dist/lib/internationalization/locales/jp.cjs +13 -14
- package/dist/lib/internationalization/locales/jp.d.cts +307 -1
- package/dist/lib/internationalization/locales/ko.cjs +12 -11
- package/dist/lib/internationalization/locales/ko.d.cts +221 -1
- package/dist/lib/internationalization/locales/zh.cjs +43 -19
- package/dist/lib/internationalization/locales/zh.d.cts +409 -1
- package/dist/lib/internationalization/translatable.d.ts +4 -327
- package/dist/lib/internationalization/translatable.js +2 -360
- package/dist/lib/models/FileRegistry.d.ts +20 -9
- package/dist/lib/models/FileRegistry.js +54 -45
- package/dist/lib/models/ReflectionCategory.d.ts +2 -2
- package/dist/lib/models/ReflectionCategory.js +16 -12
- package/dist/lib/models/ReflectionGroup.d.ts +3 -3
- package/dist/lib/models/ReflectionGroup.js +23 -14
- package/dist/lib/models/comments/comment.d.ts +23 -37
- package/dist/lib/models/comments/comment.js +388 -325
- package/dist/lib/models/comments/index.d.ts +2 -2
- package/dist/lib/models/comments/index.js +1 -6
- package/dist/lib/models/index.d.ts +7 -7
- package/dist/lib/models/index.js +7 -23
- package/dist/lib/models/reflections/ReflectionSymbolId.d.ts +2 -2
- package/dist/lib/models/reflections/ReflectionSymbolId.js +42 -34
- package/dist/lib/models/reflections/abstract.d.ts +17 -20
- package/dist/lib/models/reflections/abstract.js +249 -256
- package/dist/lib/models/reflections/container.d.ts +7 -7
- package/dist/lib/models/reflections/container.js +43 -16
- package/dist/lib/models/reflections/declaration.d.ts +15 -12
- package/dist/lib/models/reflections/declaration.js +150 -29
- package/dist/lib/models/reflections/document.d.ts +3 -3
- package/dist/lib/models/reflections/document.js +26 -13
- package/dist/lib/models/reflections/index.d.ts +15 -15
- package/dist/lib/models/reflections/index.js +12 -31
- package/dist/lib/models/reflections/kind.d.ts +1 -1
- package/dist/lib/models/reflections/kind.js +3 -6
- package/dist/lib/models/reflections/parameter.d.ts +5 -4
- package/dist/lib/models/reflections/parameter.js +11 -13
- package/dist/lib/models/reflections/project.d.ts +14 -9
- package/dist/lib/models/reflections/project.js +104 -56
- package/dist/lib/models/reflections/reference.d.ts +3 -3
- package/dist/lib/models/reflections/reference.js +6 -9
- package/dist/lib/models/reflections/signature.d.ts +8 -8
- package/dist/lib/models/reflections/signature.js +35 -14
- package/dist/lib/models/reflections/type-parameter.d.ts +5 -5
- package/dist/lib/models/reflections/type-parameter.js +9 -10
- package/dist/lib/models/reflections/utils.js +1 -4
- package/dist/lib/models/reflections/variant.d.ts +8 -7
- package/dist/lib/models/reflections/variant.js +1 -2
- package/dist/lib/models/sources/file.d.ts +2 -2
- package/dist/lib/models/sources/file.js +22 -5
- package/dist/lib/models/sources/index.d.ts +1 -1
- package/dist/lib/models/sources/index.js +1 -5
- package/dist/lib/models/types.d.ts +29 -16
- package/dist/lib/models/types.js +236 -151
- package/dist/lib/output/components.d.ts +5 -11
- package/dist/lib/output/components.js +84 -125
- package/dist/lib/output/events.d.ts +3 -3
- package/dist/lib/output/events.js +128 -94
- package/dist/lib/output/formatter.d.ts +84 -0
- package/dist/lib/output/formatter.js +624 -0
- package/dist/lib/output/index.d.ts +9 -8
- package/dist/lib/output/index.js +7 -19
- package/dist/lib/output/models/UrlMapping.d.ts +2 -2
- package/dist/lib/output/models/UrlMapping.js +4 -5
- package/dist/lib/output/output.d.ts +14 -0
- package/dist/lib/output/output.js +91 -0
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +9 -8
- package/dist/lib/output/plugins/AssetsPlugin.js +64 -80
- package/dist/lib/output/plugins/HierarchyPlugin.d.ts +7 -0
- package/dist/lib/output/plugins/HierarchyPlugin.js +67 -0
- package/dist/lib/output/plugins/IconsPlugin.d.ts +3 -2
- package/dist/lib/output/plugins/IconsPlugin.js +28 -84
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +9 -2
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +90 -96
- package/dist/lib/output/plugins/NavigationPlugin.d.ts +3 -2
- package/dist/lib/output/plugins/NavigationPlugin.js +22 -102
- package/dist/lib/output/plugins/SitemapPlugin.d.ts +3 -2
- package/dist/lib/output/plugins/SitemapPlugin.js +60 -120
- package/dist/lib/output/plugins/index.d.ts +7 -6
- package/dist/lib/output/plugins/index.js +7 -15
- package/dist/lib/output/renderer.d.ts +14 -13
- package/dist/lib/output/renderer.js +130 -185
- package/dist/lib/output/theme.d.ts +9 -5
- package/dist/lib/output/theme.js +14 -62
- package/dist/lib/output/themes/MarkedPlugin.d.ts +8 -9
- package/dist/lib/output/themes/MarkedPlugin.js +152 -117
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +17 -29
- package/dist/lib/output/themes/default/DefaultTheme.js +334 -310
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +63 -48
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +119 -95
- package/dist/lib/output/themes/default/Slugger.d.ts +13 -0
- package/dist/lib/output/themes/default/Slugger.js +46 -0
- package/dist/lib/output/themes/default/layouts/default.d.ts +5 -5
- package/dist/lib/output/themes/default/layouts/default.js +48 -36
- package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/anchor-icon.js +4 -7
- package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/breadcrumb.js +4 -8
- package/dist/lib/output/themes/default/partials/comment.d.ts +6 -4
- package/dist/lib/output/themes/default/partials/comment.js +52 -29
- package/dist/lib/output/themes/default/partials/footer.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/footer.js +11 -14
- package/dist/lib/output/themes/default/partials/header.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/header.js +9 -13
- package/dist/lib/output/themes/default/partials/hierarchy.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/hierarchy.js +12 -15
- package/dist/lib/output/themes/default/partials/icon.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/icon.js +78 -73
- package/dist/lib/output/themes/default/partials/index.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/index.js +19 -22
- package/dist/lib/output/themes/default/partials/member.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.declaration.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.declaration.js +18 -61
- package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.getterSetter.js +10 -26
- package/dist/lib/output/themes/default/partials/member.js +19 -24
- package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.signature.body.js +17 -21
- package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +4 -7
- package/dist/lib/output/themes/default/partials/member.signature.title.js +8 -35
- package/dist/lib/output/themes/default/partials/member.signatures.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.signatures.js +9 -13
- package/dist/lib/output/themes/default/partials/member.sources.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.sources.js +13 -17
- package/dist/lib/output/themes/default/partials/members.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/members.js +10 -42
- package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/moduleReflection.js +62 -0
- package/dist/lib/output/themes/default/partials/navigation.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/navigation.js +51 -62
- package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/reflectionPreview.js +12 -15
- package/dist/lib/output/themes/default/partials/toolbar.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/toolbar.js +16 -20
- package/dist/lib/output/themes/default/partials/type.d.ts +4 -6
- package/dist/lib/output/themes/default/partials/type.js +8 -388
- package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/typeAndParent.js +11 -15
- package/dist/lib/output/themes/default/partials/typeDetails.d.ts +8 -0
- package/dist/lib/output/themes/default/partials/typeDetails.js +222 -0
- package/dist/lib/output/themes/default/partials/typeParameters.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/typeParameters.js +14 -17
- package/dist/lib/output/themes/default/templates/document.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/document.js +3 -7
- package/dist/lib/output/themes/default/templates/hierarchy.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/hierarchy.js +24 -22
- package/dist/lib/output/themes/default/templates/index.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/index.js +3 -7
- package/dist/lib/output/themes/default/templates/reflection.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/reflection.js +32 -34
- package/dist/lib/output/themes/lib.d.ts +17 -3
- package/dist/lib/output/themes/lib.js +118 -50
- package/dist/lib/serialization/components.d.ts +2 -5
- package/dist/lib/serialization/components.js +1 -2
- package/dist/lib/serialization/deserializer.d.ts +21 -7
- package/dist/lib/serialization/deserializer.js +138 -123
- package/dist/lib/serialization/events.d.ts +2 -2
- package/dist/lib/serialization/events.js +6 -5
- package/dist/lib/serialization/index.d.ts +5 -5
- package/dist/lib/serialization/index.js +4 -33
- package/dist/lib/serialization/schema.d.ts +8 -2
- package/dist/lib/serialization/schema.js +2 -2
- package/dist/lib/serialization/serializer.d.ts +11 -5
- package/dist/lib/serialization/serializer.js +32 -25
- package/dist/lib/utils/array.d.ts +3 -0
- package/dist/lib/utils/array.js +26 -27
- package/dist/lib/utils/component.d.ts +2 -44
- package/dist/lib/utils/component.js +10 -102
- package/dist/lib/utils/entry-point.d.ts +3 -4
- package/dist/lib/utils/entry-point.js +114 -85
- package/dist/lib/utils/enum.js +6 -14
- package/dist/lib/utils/events.js +6 -12
- package/dist/lib/utils/fs.js +50 -91
- package/dist/lib/utils/general.d.ts +2 -1
- package/dist/lib/utils/general.js +50 -40
- package/dist/lib/utils/highlighter.js +30 -57
- package/dist/lib/utils/hooks.js +7 -13
- package/dist/lib/utils/html-entities.d.ts +8926 -0
- package/dist/lib/utils/html-entities.js +2329 -0
- package/dist/lib/utils/html.d.ts +8 -0
- package/dist/lib/utils/html.js +81 -34
- package/dist/lib/utils/index.d.ts +22 -22
- package/dist/lib/utils/index.js +20 -91
- package/dist/lib/utils/jsx.d.ts +12 -6
- package/dist/lib/utils/jsx.elements.d.ts +1 -1
- package/dist/lib/utils/jsx.elements.js +3 -4
- package/dist/lib/utils/jsx.js +82 -52
- package/dist/lib/utils/loggers.d.ts +3 -3
- package/dist/lib/utils/loggers.js +36 -46
- package/dist/lib/utils/map.js +6 -13
- package/dist/lib/utils/minimalSourceFile.js +5 -7
- package/dist/lib/utils/options/declaration.d.ts +35 -7
- package/dist/lib/utils/options/declaration.js +20 -22
- package/dist/lib/utils/options/defaults.d.ts +3 -2
- package/dist/lib/utils/options/defaults.js +18 -38
- package/dist/lib/utils/options/help.d.ts +2 -2
- package/dist/lib/utils/options/help.js +7 -10
- package/dist/lib/utils/options/index.d.ts +6 -6
- package/dist/lib/utils/options/index.js +4 -18
- package/dist/lib/utils/options/options.d.ts +8 -5
- package/dist/lib/utils/options/options.js +47 -71
- package/dist/lib/utils/options/readers/arguments.d.ts +2 -2
- package/dist/lib/utils/options/readers/arguments.js +15 -17
- package/dist/lib/utils/options/readers/index.d.ts +4 -4
- package/dist/lib/utils/options/readers/index.js +4 -11
- package/dist/lib/utils/options/readers/package-json.d.ts +3 -3
- package/dist/lib/utils/options/readers/package-json.js +15 -21
- package/dist/lib/utils/options/readers/tsconfig.d.ts +2 -2
- package/dist/lib/utils/options/readers/tsconfig.js +54 -63
- package/dist/lib/utils/options/readers/typedoc.d.ts +3 -3
- package/dist/lib/utils/options/readers/typedoc.js +44 -76
- package/dist/lib/utils/options/sources/index.d.ts +1 -1
- package/dist/lib/utils/options/sources/index.js +1 -5
- package/dist/lib/utils/options/sources/typedoc.d.ts +1 -1
- package/dist/lib/utils/options/sources/typedoc.js +232 -196
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +3 -3
- package/dist/lib/utils/options/tsdoc-defaults.js +16 -12
- package/dist/lib/utils/package-manifest.d.ts +1 -1
- package/dist/lib/utils/package-manifest.js +15 -19
- package/dist/lib/utils/paths.js +9 -15
- package/dist/lib/utils/perf.js +6 -11
- package/dist/lib/utils/plugins.d.ts +1 -1
- package/dist/lib/utils/plugins.js +7 -10
- package/dist/lib/utils/reflections.d.ts +1 -1
- package/dist/lib/utils/reflections.js +9 -12
- package/dist/lib/utils/set.js +2 -6
- package/dist/lib/utils/sort.d.ts +3 -3
- package/dist/lib/utils/sort.js +20 -24
- package/dist/lib/utils/tsconfig.d.ts +1 -1
- package/dist/lib/utils/tsconfig.js +13 -21
- package/dist/lib/utils/tsutils.d.ts +1 -1
- package/dist/lib/utils/tsutils.js +3 -30
- package/dist/lib/utils/validation.js +6 -12
- package/dist/lib/validation/documentation.d.ts +2 -2
- package/dist/lib/validation/documentation.js +26 -29
- package/dist/lib/validation/exports.d.ts +2 -2
- package/dist/lib/validation/exports.js +9 -11
- package/dist/lib/validation/links.d.ts +2 -2
- package/dist/lib/validation/links.js +4 -7
- package/dist/lib/validation/unusedMergeModuleWith.d.ts +3 -0
- package/dist/lib/validation/unusedMergeModuleWith.js +11 -0
- package/package.json +17 -14
- package/static/main.js +4 -4
- package/static/style.css +109 -17
- package/tsdoc.json +30 -0
- package/dist/lib/output/themes/default/partials/member.reference.d.ts +0 -4
- package/dist/lib/output/themes/default/partials/member.reference.js +0 -30
- package/dist/lib/output/themes/default/partials/parameter.d.ts +0 -4
- package/dist/lib/output/themes/default/partials/parameter.js +0 -79
- package/dist/lib/utils/html-entities.json +0 -2326
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ContextAwareRendererComponent } from "../components";
|
|
2
|
-
import {
|
|
1
|
+
import { ContextAwareRendererComponent } from "../components.js";
|
|
2
|
+
import { MarkdownEvent, RendererEvent, type PageEvent } from "../events.js";
|
|
3
3
|
import type { BundledTheme } from "shiki" with { "resolution-mode": "import" };
|
|
4
|
-
import type { DefaultThemeRenderContext } from "
|
|
5
|
-
import { type CommentDisplayPart } from "../../models";
|
|
4
|
+
import type { DefaultThemeRenderContext, Renderer } from "../index.js";
|
|
5
|
+
import { type CommentDisplayPart } from "../../models/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* Implements markdown and relativeURL helpers for templates.
|
|
8
8
|
* @internal
|
|
@@ -13,18 +13,16 @@ export declare class MarkedPlugin extends ContextAwareRendererComponent {
|
|
|
13
13
|
accessor markdownItOptions: Record<string, unknown>;
|
|
14
14
|
accessor markdownLinkExternal: boolean;
|
|
15
15
|
private parser?;
|
|
16
|
+
private renderedRelativeLinks;
|
|
16
17
|
/**
|
|
17
18
|
* This needing to be here really feels hacky... probably some nicer way to do this.
|
|
18
19
|
* Revisit when adding support for arbitrary pages in 0.26.
|
|
19
20
|
*/
|
|
20
21
|
private renderContext;
|
|
21
22
|
private lastHeaderSlug;
|
|
23
|
+
constructor(owner: Renderer);
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
initialize(): void;
|
|
26
|
-
/**
|
|
27
|
-
* Highlight the syntax of the given text using HighlightJS.
|
|
25
|
+
* Highlight the syntax of the given text using Shiki.
|
|
28
26
|
*
|
|
29
27
|
* @param text The text that should be highlighted.
|
|
30
28
|
* @param lang The language that should be used to highlight the string.
|
|
@@ -39,6 +37,7 @@ export declare class MarkedPlugin extends ContextAwareRendererComponent {
|
|
|
39
37
|
*/
|
|
40
38
|
parseMarkdown(input: string | readonly CommentDisplayPart[], page: PageEvent<any>, context: DefaultThemeRenderContext): string;
|
|
41
39
|
private displayPartsToMarkdown;
|
|
40
|
+
private onEnd;
|
|
42
41
|
/**
|
|
43
42
|
* Triggered before the renderer starts rendering a project.
|
|
44
43
|
*
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
2
|
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
3
|
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
@@ -33,54 +32,20 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
32
|
}
|
|
34
33
|
return useValue ? value : void 0;
|
|
35
34
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
45
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
46
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
47
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
48
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
49
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
50
|
-
};
|
|
51
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
52
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
53
|
-
};
|
|
54
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
-
exports.MarkedPlugin = void 0;
|
|
56
|
-
const markdown_it_1 = __importDefault(require("markdown-it"));
|
|
57
|
-
const components_1 = require("../components");
|
|
58
|
-
const events_1 = require("../events");
|
|
59
|
-
const utils_1 = require("../../utils");
|
|
60
|
-
const highlighter_1 = require("../../utils/highlighter");
|
|
61
|
-
const html_1 = require("../../utils/html");
|
|
62
|
-
const DefaultTheme_1 = require("./default/DefaultTheme");
|
|
63
|
-
const anchor_icon_1 = require("./default/partials/anchor-icon");
|
|
64
|
-
const models_1 = require("../../models");
|
|
65
|
-
let defaultSlugger;
|
|
66
|
-
function getDefaultSlugger(logger) {
|
|
67
|
-
if (!defaultSlugger) {
|
|
68
|
-
logger.warn(logger.i18n.custom_theme_does_not_define_getSlugger());
|
|
69
|
-
defaultSlugger = new DefaultTheme_1.Slugger();
|
|
70
|
-
}
|
|
71
|
-
return defaultSlugger;
|
|
72
|
-
}
|
|
35
|
+
import MarkdownIt from "markdown-it";
|
|
36
|
+
import { ContextAwareRendererComponent } from "../components.js";
|
|
37
|
+
import { MarkdownEvent, RendererEvent } from "../events.js";
|
|
38
|
+
import { Option, renderElement, assertNever } from "../../utils/index.js";
|
|
39
|
+
import { highlight, isLoadedLanguage, isSupportedLanguage } from "../../utils/highlighter.js";
|
|
40
|
+
import { escapeHtml } from "../../utils/html.js";
|
|
41
|
+
import { anchorIcon } from "./default/partials/anchor-icon.js";
|
|
42
|
+
import { ReflectionKind, } from "../../models/index.js";
|
|
73
43
|
/**
|
|
74
44
|
* Implements markdown and relativeURL helpers for templates.
|
|
75
45
|
* @internal
|
|
76
46
|
*/
|
|
77
47
|
let MarkedPlugin = (() => {
|
|
78
|
-
|
|
79
|
-
let _classDecorators = [(0, components_1.Component)({ name: "marked" })];
|
|
80
|
-
let _classDescriptor;
|
|
81
|
-
let _classExtraInitializers = [];
|
|
82
|
-
let _classThis;
|
|
83
|
-
let _classSuper = components_1.ContextAwareRendererComponent;
|
|
48
|
+
let _classSuper = ContextAwareRendererComponent;
|
|
84
49
|
let _lightTheme_decorators;
|
|
85
50
|
let _lightTheme_initializers = [];
|
|
86
51
|
let _lightTheme_extraInitializers = [];
|
|
@@ -93,38 +58,46 @@ let MarkedPlugin = (() => {
|
|
|
93
58
|
let _markdownLinkExternal_decorators;
|
|
94
59
|
let _markdownLinkExternal_initializers = [];
|
|
95
60
|
let _markdownLinkExternal_extraInitializers = [];
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
this.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
this.renderContext = null;
|
|
109
|
-
this.lastHeaderSlug = "";
|
|
61
|
+
return class MarkedPlugin extends _classSuper {
|
|
62
|
+
static {
|
|
63
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
64
|
+
_lightTheme_decorators = [Option("lightHighlightTheme")];
|
|
65
|
+
_darkTheme_decorators = [Option("darkHighlightTheme")];
|
|
66
|
+
_markdownItOptions_decorators = [Option("markdownItOptions")];
|
|
67
|
+
_markdownLinkExternal_decorators = [Option("markdownLinkExternal")];
|
|
68
|
+
__esDecorate(this, 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);
|
|
69
|
+
__esDecorate(this, 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);
|
|
70
|
+
__esDecorate(this, 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);
|
|
71
|
+
__esDecorate(this, 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);
|
|
72
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
110
73
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
get
|
|
116
|
-
set
|
|
117
|
-
|
|
118
|
-
|
|
74
|
+
#lightTheme_accessor_storage = __runInitializers(this, _lightTheme_initializers, void 0);
|
|
75
|
+
get lightTheme() { return this.#lightTheme_accessor_storage; }
|
|
76
|
+
set lightTheme(value) { this.#lightTheme_accessor_storage = value; }
|
|
77
|
+
#darkTheme_accessor_storage = (__runInitializers(this, _lightTheme_extraInitializers), __runInitializers(this, _darkTheme_initializers, void 0));
|
|
78
|
+
get darkTheme() { return this.#darkTheme_accessor_storage; }
|
|
79
|
+
set darkTheme(value) { this.#darkTheme_accessor_storage = value; }
|
|
80
|
+
#markdownItOptions_accessor_storage = (__runInitializers(this, _darkTheme_extraInitializers), __runInitializers(this, _markdownItOptions_initializers, void 0));
|
|
81
|
+
get markdownItOptions() { return this.#markdownItOptions_accessor_storage; }
|
|
82
|
+
set markdownItOptions(value) { this.#markdownItOptions_accessor_storage = value; }
|
|
83
|
+
#markdownLinkExternal_accessor_storage = (__runInitializers(this, _markdownItOptions_extraInitializers), __runInitializers(this, _markdownLinkExternal_initializers, void 0));
|
|
84
|
+
get markdownLinkExternal() { return this.#markdownLinkExternal_accessor_storage; }
|
|
85
|
+
set markdownLinkExternal(value) { this.#markdownLinkExternal_accessor_storage = value; }
|
|
86
|
+
parser = __runInitializers(this, _markdownLinkExternal_extraInitializers);
|
|
87
|
+
renderedRelativeLinks = [];
|
|
119
88
|
/**
|
|
120
|
-
*
|
|
89
|
+
* This needing to be here really feels hacky... probably some nicer way to do this.
|
|
90
|
+
* Revisit when adding support for arbitrary pages in 0.26.
|
|
121
91
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
92
|
+
renderContext = null;
|
|
93
|
+
lastHeaderSlug = "";
|
|
94
|
+
constructor(owner) {
|
|
95
|
+
super(owner);
|
|
96
|
+
this.owner.on(MarkdownEvent.PARSE, this.onParseMarkdown.bind(this));
|
|
97
|
+
this.owner.on(RendererEvent.END, this.onEnd.bind(this));
|
|
125
98
|
}
|
|
126
99
|
/**
|
|
127
|
-
* Highlight the syntax of the given text using
|
|
100
|
+
* Highlight the syntax of the given text using Shiki.
|
|
128
101
|
*
|
|
129
102
|
* @param text The text that should be highlighted.
|
|
130
103
|
* @param lang The language that should be used to highlight the string.
|
|
@@ -133,15 +106,15 @@ let MarkedPlugin = (() => {
|
|
|
133
106
|
getHighlighted(text, lang) {
|
|
134
107
|
lang = lang || "typescript";
|
|
135
108
|
lang = lang.toLowerCase();
|
|
136
|
-
if (!
|
|
109
|
+
if (!isSupportedLanguage(lang)) {
|
|
137
110
|
this.application.logger.warn(this.application.i18n.unsupported_highlight_language_0_not_highlighted_in_comment_for_1(lang, this.page?.model.getFriendlyFullName() ?? "(unknown)"));
|
|
138
111
|
return text;
|
|
139
112
|
}
|
|
140
|
-
if (!
|
|
113
|
+
if (!isLoadedLanguage(lang)) {
|
|
141
114
|
this.application.logger.warn(this.application.i18n.unloaded_language_0_not_highlighted_in_comment_for_1(lang, this.page?.model.getFriendlyFullName() ?? "(unknown)"));
|
|
142
115
|
return text;
|
|
143
116
|
}
|
|
144
|
-
return
|
|
117
|
+
return highlight(text, lang);
|
|
145
118
|
}
|
|
146
119
|
/**
|
|
147
120
|
* Parse the given markdown string and return the resulting html.
|
|
@@ -155,8 +128,8 @@ let MarkedPlugin = (() => {
|
|
|
155
128
|
markdown = this.displayPartsToMarkdown(page, context, markdown);
|
|
156
129
|
}
|
|
157
130
|
this.renderContext = context;
|
|
158
|
-
const event = new
|
|
159
|
-
this.owner.trigger(
|
|
131
|
+
const event = new MarkdownEvent(page, markdown, markdown);
|
|
132
|
+
this.owner.trigger(MarkdownEvent.PARSE, event);
|
|
160
133
|
this.renderContext = null;
|
|
161
134
|
return event.parsedText;
|
|
162
135
|
}
|
|
@@ -187,7 +160,7 @@ let MarkedPlugin = (() => {
|
|
|
187
160
|
// No point in trying to resolve a ReflectionSymbolId at this point, we've already
|
|
188
161
|
// tried and failed during the resolution step.
|
|
189
162
|
url = context.urlTo(part.target);
|
|
190
|
-
kindClass =
|
|
163
|
+
kindClass = ReflectionKind.classString(part.target.kind);
|
|
191
164
|
}
|
|
192
165
|
if (useHtml) {
|
|
193
166
|
const text = part.tag === "@linkcode" ? `<code>${part.text}</code>` : part.text;
|
|
@@ -215,14 +188,29 @@ let MarkedPlugin = (() => {
|
|
|
215
188
|
case "relative-link":
|
|
216
189
|
switch (typeof part.target) {
|
|
217
190
|
case "number": {
|
|
218
|
-
const refl = page.project.files.resolve(part.target);
|
|
191
|
+
const refl = page.project.files.resolve(part.target, page.model.project);
|
|
192
|
+
let url;
|
|
219
193
|
if (typeof refl === "object") {
|
|
220
|
-
|
|
221
|
-
|
|
194
|
+
url = context.urlTo(refl);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
const fileName = page.project.files.getName(part.target);
|
|
198
|
+
if (fileName) {
|
|
199
|
+
url = context.relativeURL(`media/${fileName}`);
|
|
200
|
+
}
|
|
222
201
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
202
|
+
if (url) {
|
|
203
|
+
if (part.targetAnchor) {
|
|
204
|
+
url += "#" + part.targetAnchor;
|
|
205
|
+
if (typeof refl === "object") {
|
|
206
|
+
this.renderedRelativeLinks.push({
|
|
207
|
+
source: this.page.model,
|
|
208
|
+
target: refl,
|
|
209
|
+
link: part,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
result.push(url);
|
|
226
214
|
break;
|
|
227
215
|
}
|
|
228
216
|
}
|
|
@@ -233,11 +221,24 @@ let MarkedPlugin = (() => {
|
|
|
233
221
|
}
|
|
234
222
|
break;
|
|
235
223
|
default:
|
|
236
|
-
|
|
224
|
+
assertNever(part);
|
|
237
225
|
}
|
|
238
226
|
}
|
|
239
227
|
return result.join("");
|
|
240
228
|
}
|
|
229
|
+
onEnd() {
|
|
230
|
+
for (const { source, target, link } of this.renderedRelativeLinks) {
|
|
231
|
+
const slugger = this.owner.theme.getSlugger(target);
|
|
232
|
+
if (!slugger.hasAnchor(link.targetAnchor)) {
|
|
233
|
+
this.application.logger.warn(this.application.i18n.reflection_0_links_to_1_but_anchor_does_not_exist_try_2(source.getFriendlyFullName(), link.text, slugger
|
|
234
|
+
.getSimilarAnchors(link.targetAnchor)
|
|
235
|
+
.map((a) => link.text.replace(/#.*/, "#" + a))
|
|
236
|
+
.join("\n\t")));
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
// In case we're in watch mode
|
|
240
|
+
this.renderedRelativeLinks = [];
|
|
241
|
+
}
|
|
241
242
|
/**
|
|
242
243
|
* Triggered before the renderer starts rendering a project.
|
|
243
244
|
*
|
|
@@ -248,10 +249,7 @@ let MarkedPlugin = (() => {
|
|
|
248
249
|
this.setupParser();
|
|
249
250
|
}
|
|
250
251
|
getSlugger() {
|
|
251
|
-
|
|
252
|
-
return this.owner.theme.getSlugger(this.page.model);
|
|
253
|
-
}
|
|
254
|
-
return getDefaultSlugger(this.application.logger);
|
|
252
|
+
return this.owner.theme.getSlugger(this.page.model);
|
|
255
253
|
}
|
|
256
254
|
/**
|
|
257
255
|
* Creates an object with options that are passed to the markdown parser.
|
|
@@ -259,7 +257,7 @@ let MarkedPlugin = (() => {
|
|
|
259
257
|
* @returns The options object for the markdown parser.
|
|
260
258
|
*/
|
|
261
259
|
setupParser() {
|
|
262
|
-
this.parser = (
|
|
260
|
+
this.parser = MarkdownIt({
|
|
263
261
|
...this.markdownItOptions,
|
|
264
262
|
highlight: (code, lang) => {
|
|
265
263
|
code = this.getHighlighted(code, lang || "ts");
|
|
@@ -267,9 +265,10 @@ let MarkedPlugin = (() => {
|
|
|
267
265
|
if (!lang) {
|
|
268
266
|
return `<pre><code>${code}</code><button>${this.application.i18n.theme_copy()}</button></pre>\n`;
|
|
269
267
|
}
|
|
270
|
-
return `<pre><code class="${
|
|
268
|
+
return `<pre><code class="${escapeHtml(lang)}">${code}</code><button type="button">${this.application.i18n.theme_copy()}</button></pre>\n`;
|
|
271
269
|
},
|
|
272
270
|
});
|
|
271
|
+
githubAlertMarkdownPlugin(this.parser, this.application.i18n);
|
|
273
272
|
const loader = this.application.options.getValue("markdownItLoader");
|
|
274
273
|
loader(this.parser);
|
|
275
274
|
// Add anchor links for headings in readme, and add them to the "On this page" section
|
|
@@ -279,22 +278,21 @@ let MarkedPlugin = (() => {
|
|
|
279
278
|
const level = token.markup.length;
|
|
280
279
|
const slug = this.getSlugger().slug(content);
|
|
281
280
|
this.lastHeaderSlug = slug;
|
|
282
|
-
// Prefix the slug with an extra `md:` to prevent conflicts with TypeDoc's anchors.
|
|
283
281
|
this.page.pageHeadings.push({
|
|
284
|
-
link:
|
|
282
|
+
link: `#${slug}`,
|
|
285
283
|
text: content,
|
|
286
284
|
level,
|
|
287
285
|
});
|
|
288
|
-
return `<a id="
|
|
286
|
+
return `<a id="${slug}" class="tsd-anchor"></a><${token.tag} class="tsd-anchor-link">`;
|
|
289
287
|
};
|
|
290
288
|
this.parser.renderer.rules["heading_close"] = (tokens, idx) => {
|
|
291
|
-
return `${
|
|
289
|
+
return `${renderElement(anchorIcon(this.renderContext, this.lastHeaderSlug))}</${tokens[idx].tag}>`;
|
|
292
290
|
};
|
|
293
291
|
// Rewrite anchor links inline in a readme file to links targeting the `md:` prefixed anchors
|
|
294
292
|
// that TypeDoc creates.
|
|
295
293
|
this.parser.renderer.rules["link_open"] = (tokens, idx, options, _env, self) => {
|
|
296
294
|
const token = tokens[idx];
|
|
297
|
-
const href = token.attrGet("href")
|
|
295
|
+
const href = token.attrGet("href");
|
|
298
296
|
if (href) {
|
|
299
297
|
// Note: This doesn't catch @link tags to reflections as those
|
|
300
298
|
// will be relative links. This will likely have to change with
|
|
@@ -310,6 +308,11 @@ let MarkedPlugin = (() => {
|
|
|
310
308
|
}
|
|
311
309
|
return self.renderToken(tokens, idx, options);
|
|
312
310
|
};
|
|
311
|
+
this.parser.renderer.rules["alert_open"] = (tokens, idx) => {
|
|
312
|
+
const icon = this.renderContext.icons[tokens[idx].attrGet("icon")];
|
|
313
|
+
const iconHtml = renderElement(icon());
|
|
314
|
+
return `<div class="${tokens[idx].attrGet("class")}"><div class="tsd-alert-title">${iconHtml}<span>${tokens[idx].attrGet("alert")}</span></div>`;
|
|
315
|
+
};
|
|
313
316
|
}
|
|
314
317
|
/**
|
|
315
318
|
* Triggered when {@link MarkedPlugin} parses a markdown string.
|
|
@@ -320,32 +323,64 @@ let MarkedPlugin = (() => {
|
|
|
320
323
|
event.parsedText = this.parser.render(event.parsedText);
|
|
321
324
|
}
|
|
322
325
|
};
|
|
323
|
-
_MarkedPlugin_lightTheme_accessor_storage = new WeakMap();
|
|
324
|
-
_MarkedPlugin_darkTheme_accessor_storage = new WeakMap();
|
|
325
|
-
_MarkedPlugin_markdownItOptions_accessor_storage = new WeakMap();
|
|
326
|
-
_MarkedPlugin_markdownLinkExternal_accessor_storage = new WeakMap();
|
|
327
|
-
__setFunctionName(_classThis, "MarkedPlugin");
|
|
328
|
-
(() => {
|
|
329
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
330
|
-
_lightTheme_decorators = [(0, utils_1.Option)("lightHighlightTheme")];
|
|
331
|
-
_darkTheme_decorators = [(0, utils_1.Option)("darkHighlightTheme")];
|
|
332
|
-
_markdownItOptions_decorators = [(0, utils_1.Option)("markdownItOptions")];
|
|
333
|
-
_markdownLinkExternal_decorators = [(0, utils_1.Option)("markdownLinkExternal")];
|
|
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);
|
|
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);
|
|
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);
|
|
338
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
339
|
-
MarkedPlugin = _classThis = _classDescriptor.value;
|
|
340
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
341
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
342
|
-
})();
|
|
343
|
-
return MarkedPlugin = _classThis;
|
|
344
326
|
})();
|
|
345
|
-
|
|
327
|
+
export { MarkedPlugin };
|
|
346
328
|
function getTokenTextContent(token) {
|
|
347
329
|
if (token.children) {
|
|
348
330
|
return token.children.map(getTokenTextContent).join("");
|
|
349
331
|
}
|
|
350
332
|
return token.content;
|
|
351
333
|
}
|
|
334
|
+
const kindNames = ["note", "tip", "important", "warning", "caution"];
|
|
335
|
+
const iconNames = ["alertNote", "alertTip", "alertImportant", "alertWarning", "alertCaution"];
|
|
336
|
+
const kindTranslations = [
|
|
337
|
+
(i18n) => i18n.alert_note(),
|
|
338
|
+
(i18n) => i18n.alert_tip(),
|
|
339
|
+
(i18n) => i18n.alert_important(),
|
|
340
|
+
(i18n) => i18n.alert_warning(),
|
|
341
|
+
(i18n) => i18n.alert_caution(),
|
|
342
|
+
];
|
|
343
|
+
function githubAlertMarkdownPlugin(md, i18n) {
|
|
344
|
+
md.core.ruler.after("block", "typedoc-github-alert-plugin", (state) => {
|
|
345
|
+
const bqStarts = [];
|
|
346
|
+
for (let i = 0; i < state.tokens.length; ++i) {
|
|
347
|
+
const token = state.tokens[i];
|
|
348
|
+
if (token.type === "blockquote_open") {
|
|
349
|
+
bqStarts.push(i);
|
|
350
|
+
}
|
|
351
|
+
else if (token.type === "blockquote_close") {
|
|
352
|
+
if (bqStarts.length === 1) {
|
|
353
|
+
checkForAlert(state.tokens, bqStarts[0], i, i18n);
|
|
354
|
+
}
|
|
355
|
+
bqStarts.pop();
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
function checkForAlert(tokens, start, end, i18n) {
|
|
361
|
+
let alertKind = -1;
|
|
362
|
+
// Search for the first "inline" token. That will be the blockquote text.
|
|
363
|
+
for (let i = start; i < end; ++i) {
|
|
364
|
+
if (tokens[i].type === "inline") {
|
|
365
|
+
// Check for `[!NOTE]`
|
|
366
|
+
const kindString = tokens[i].content.match(/^\[!(\w+)\]/);
|
|
367
|
+
const kindIndex = kindNames.indexOf(kindString?.[1].toLowerCase() || "");
|
|
368
|
+
if (kindIndex !== -1) {
|
|
369
|
+
tokens[i].content = tokens[i].content.substring(kindString[0].length);
|
|
370
|
+
alertKind = kindIndex;
|
|
371
|
+
}
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
// If we found an alert, then replace the blockquote_open and blockquote_close tokens with
|
|
376
|
+
// alert_open and alert_close tokens that can be rendered specially.
|
|
377
|
+
if (alertKind === -1)
|
|
378
|
+
return;
|
|
379
|
+
tokens[start].type = "alert_open";
|
|
380
|
+
tokens[start].tag = "div";
|
|
381
|
+
tokens[start].attrPush(["class", `tsd-alert tsd-alert-${kindNames[alertKind]}`]);
|
|
382
|
+
tokens[start].attrPush(["alert", kindTranslations[alertKind](i18n)]);
|
|
383
|
+
tokens[start].attrPush(["icon", iconNames[alertKind]]);
|
|
384
|
+
tokens[end].type = "alert_close";
|
|
385
|
+
tokens[end].tag = "div";
|
|
386
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Theme } from "../../theme";
|
|
2
|
-
import type { Renderer } from "../../renderer";
|
|
3
|
-
import { ReflectionKind, ProjectReflection, type ContainerReflection, DeclarationReflection, type Reflection, type DocumentReflection } from "../../../models";
|
|
4
|
-
import { type RenderTemplate, UrlMapping } from "../../models/UrlMapping";
|
|
5
|
-
import type { PageEvent } from "../../events";
|
|
6
|
-
import type { MarkedPlugin } from "../../plugins";
|
|
7
|
-
import { DefaultThemeRenderContext } from "./DefaultThemeRenderContext";
|
|
8
|
-
import { JSX } from "../../../utils";
|
|
1
|
+
import { Theme } from "../../theme.js";
|
|
2
|
+
import type { Renderer } from "../../renderer.js";
|
|
3
|
+
import { ReflectionKind, ProjectReflection, type ContainerReflection, DeclarationReflection, type Reflection, type DocumentReflection } from "../../../models/index.js";
|
|
4
|
+
import { type RenderTemplate, UrlMapping } from "../../models/UrlMapping.js";
|
|
5
|
+
import type { PageEvent } from "../../events.js";
|
|
6
|
+
import type { MarkedPlugin } from "../../plugins/index.js";
|
|
7
|
+
import { DefaultThemeRenderContext } from "./DefaultThemeRenderContext.js";
|
|
8
|
+
import { JSX } from "../../../utils/index.js";
|
|
9
9
|
export interface NavigationElement {
|
|
10
10
|
text: string;
|
|
11
11
|
path?: string;
|
|
@@ -13,19 +13,9 @@ export interface NavigationElement {
|
|
|
13
13
|
class?: string;
|
|
14
14
|
children?: NavigationElement[];
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Responsible for getting a unique anchor for elements within a page.
|
|
18
|
-
*/
|
|
19
|
-
export declare class Slugger {
|
|
20
|
-
private seen;
|
|
21
|
-
private serialize;
|
|
22
|
-
slug(value: string): string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Default theme implementation of TypeDoc. If a theme does not provide a custom
|
|
26
|
-
* {@link Theme} implementation, this theme class will be used.
|
|
27
|
-
*/
|
|
28
16
|
export declare class DefaultTheme extends Theme {
|
|
17
|
+
usedFileNames: Set<string>;
|
|
18
|
+
private accessor sluggerConfiguration;
|
|
29
19
|
/** @internal */
|
|
30
20
|
markedPlugin: MarkedPlugin;
|
|
31
21
|
/**
|
|
@@ -73,6 +63,11 @@ export declare class DefaultTheme extends Theme {
|
|
|
73
63
|
menu: () => JSX.Element;
|
|
74
64
|
chevronSmall: () => JSX.Element;
|
|
75
65
|
folder: () => JSX.Element;
|
|
66
|
+
alertNote: () => JSX.Element;
|
|
67
|
+
alertTip: () => JSX.Element;
|
|
68
|
+
alertImportant: () => JSX.Element;
|
|
69
|
+
alertWarning: () => JSX.Element;
|
|
70
|
+
alertCaution: () => JSX.Element;
|
|
76
71
|
};
|
|
77
72
|
getRenderContext(pageEvent: PageEvent<Reflection>): DefaultThemeRenderContext;
|
|
78
73
|
documentTemplate: (pageEvent: PageEvent<DocumentReflection>) => JSX.Element;
|
|
@@ -101,14 +96,9 @@ export declare class DefaultTheme extends Theme {
|
|
|
101
96
|
*/
|
|
102
97
|
getUrls(project: ProjectReflection): UrlMapping[];
|
|
103
98
|
/**
|
|
104
|
-
* Return a url for the given reflection.
|
|
105
|
-
*
|
|
106
99
|
* @param reflection The reflection the url should be generated for.
|
|
107
|
-
* @param relative The parent reflection the url generation should stop on.
|
|
108
|
-
* @param separator The separator used to generate the url.
|
|
109
|
-
* @returns The generated url.
|
|
110
100
|
*/
|
|
111
|
-
|
|
101
|
+
getFileName(reflection: Reflection): string;
|
|
112
102
|
/**
|
|
113
103
|
* Return the template mapping for the given reflection.
|
|
114
104
|
*
|
|
@@ -131,13 +121,11 @@ export declare class DefaultTheme extends Theme {
|
|
|
131
121
|
*/
|
|
132
122
|
getNavigation(project: ProjectReflection): NavigationElement[];
|
|
133
123
|
buildNavigation(project: ProjectReflection): NavigationElement[];
|
|
134
|
-
private sluggers;
|
|
135
|
-
getSlugger(reflection: Reflection): Slugger;
|
|
136
124
|
/**
|
|
137
125
|
* Generate an anchor url for the given reflection and all of its children.
|
|
138
126
|
*
|
|
139
127
|
* @param reflection The reflection an anchor url should be created for.
|
|
140
128
|
* @param container The nearest reflection having an own document.
|
|
141
129
|
*/
|
|
142
|
-
|
|
130
|
+
applyAnchorUrl(reflection: Reflection, container: Reflection): void;
|
|
143
131
|
}
|