@depup/typedoc 0.28.17-depup.0
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/LICENSE +201 -0
- package/README.md +34 -0
- package/bin/package.json +3 -0
- package/bin/typedoc +24 -0
- package/changes.json +22 -0
- package/dist/browser-locales/de.d.ts +2 -0
- package/dist/browser-locales/de.js +62 -0
- package/dist/browser-locales/en.d.ts +2 -0
- package/dist/browser-locales/en.js +62 -0
- package/dist/browser-locales/ja.d.ts +2 -0
- package/dist/browser-locales/ja.js +62 -0
- package/dist/browser-locales/ko.d.ts +2 -0
- package/dist/browser-locales/ko.js +62 -0
- package/dist/browser-locales/zh.d.ts +2 -0
- package/dist/browser-locales/zh.js +62 -0
- package/dist/browser-utils.d.ts +3 -0
- package/dist/browser-utils.js +3 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +46 -0
- package/dist/lib/application-events.d.ts +5 -0
- package/dist/lib/application-events.js +5 -0
- package/dist/lib/application.d.ts +195 -0
- package/dist/lib/application.js +715 -0
- package/dist/lib/cli.d.ts +1 -0
- package/dist/lib/cli.js +111 -0
- package/dist/lib/converter/comments/blockLexer.d.ts +4 -0
- package/dist/lib/converter/comments/blockLexer.js +391 -0
- package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +3 -0
- package/dist/lib/converter/comments/declarationReferenceResolver.js +218 -0
- package/dist/lib/converter/comments/discovery.d.ts +14 -0
- package/dist/lib/converter/comments/discovery.js +563 -0
- package/dist/lib/converter/comments/index.d.ts +37 -0
- package/dist/lib/converter/comments/index.js +241 -0
- package/dist/lib/converter/comments/lexer.d.ts +17 -0
- package/dist/lib/converter/comments/lexer.js +10 -0
- package/dist/lib/converter/comments/lineLexer.d.ts +3 -0
- package/dist/lib/converter/comments/lineLexer.js +279 -0
- package/dist/lib/converter/comments/linkResolver.d.ts +20 -0
- package/dist/lib/converter/comments/linkResolver.js +186 -0
- package/dist/lib/converter/comments/parser.d.ts +18 -0
- package/dist/lib/converter/comments/parser.js +538 -0
- package/dist/lib/converter/comments/rawLexer.d.ts +8 -0
- package/dist/lib/converter/comments/rawLexer.js +218 -0
- package/dist/lib/converter/comments/tagName.d.ts +8 -0
- package/dist/lib/converter/comments/tagName.js +58 -0
- package/dist/lib/converter/comments/textParser.d.ts +33 -0
- package/dist/lib/converter/comments/textParser.js +372 -0
- package/dist/lib/converter/components.d.ts +4 -0
- package/dist/lib/converter/components.js +3 -0
- package/dist/lib/converter/context.d.ts +101 -0
- package/dist/lib/converter/context.js +311 -0
- package/dist/lib/converter/convert-expression.d.ts +9 -0
- package/dist/lib/converter/convert-expression.js +58 -0
- package/dist/lib/converter/converter-events.d.ts +13 -0
- package/dist/lib/converter/converter-events.js +13 -0
- package/dist/lib/converter/converter.d.ts +238 -0
- package/dist/lib/converter/converter.js +705 -0
- package/dist/lib/converter/factories/index-signature.d.ts +3 -0
- package/dist/lib/converter/factories/index-signature.js +50 -0
- package/dist/lib/converter/factories/signature.d.ts +14 -0
- package/dist/lib/converter/factories/signature.js +353 -0
- package/dist/lib/converter/factories/symbol-id.d.ts +3 -0
- package/dist/lib/converter/factories/symbol-id.js +47 -0
- package/dist/lib/converter/index.d.ts +5 -0
- package/dist/lib/converter/index.js +3 -0
- package/dist/lib/converter/jsdoc.d.ts +4 -0
- package/dist/lib/converter/jsdoc.js +135 -0
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +48 -0
- package/dist/lib/converter/plugins/CategoryPlugin.js +278 -0
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +128 -0
- package/dist/lib/converter/plugins/CommentPlugin.js +770 -0
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +48 -0
- package/dist/lib/converter/plugins/GroupPlugin.js +281 -0
- package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +42 -0
- package/dist/lib/converter/plugins/ImplementsPlugin.js +438 -0
- package/dist/lib/converter/plugins/IncludePlugin.d.ts +14 -0
- package/dist/lib/converter/plugins/IncludePlugin.js +254 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +32 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.js +220 -0
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +13 -0
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +88 -0
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.d.ts +12 -0
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +50 -0
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +31 -0
- package/dist/lib/converter/plugins/PackagePlugin.js +188 -0
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +36 -0
- package/dist/lib/converter/plugins/SourcePlugin.js +215 -0
- package/dist/lib/converter/plugins/TypePlugin.d.ts +16 -0
- package/dist/lib/converter/plugins/TypePlugin.js +108 -0
- package/dist/lib/converter/plugins/index.d.ts +10 -0
- package/dist/lib/converter/plugins/index.js +10 -0
- package/dist/lib/converter/symbols.d.ts +3 -0
- package/dist/lib/converter/symbols.js +861 -0
- package/dist/lib/converter/types.d.ts +10 -0
- package/dist/lib/converter/types.js +833 -0
- package/dist/lib/converter/utils/nodes.d.ts +7 -0
- package/dist/lib/converter/utils/nodes.js +26 -0
- package/dist/lib/converter/utils/reflections.d.ts +2 -0
- package/dist/lib/converter/utils/reflections.js +17 -0
- package/dist/lib/converter/utils/repository.d.ts +96 -0
- package/dist/lib/converter/utils/repository.js +295 -0
- package/dist/lib/converter/utils/symbols.d.ts +2 -0
- package/dist/lib/converter/utils/symbols.js +12 -0
- package/dist/lib/debug/index.d.ts +2 -0
- package/dist/lib/debug/index.js +2 -0
- package/dist/lib/debug/reflectionLifetimes.d.ts +3 -0
- package/dist/lib/debug/reflectionLifetimes.js +27 -0
- package/dist/lib/debug/rendererUrls.d.ts +6 -0
- package/dist/lib/debug/rendererUrls.js +68 -0
- package/dist/lib/internationalization/index.d.ts +7 -0
- package/dist/lib/internationalization/index.js +7 -0
- package/dist/lib/internationalization/internationalization.d.ts +65 -0
- package/dist/lib/internationalization/internationalization.js +64 -0
- package/dist/lib/internationalization/locale-utils.cjs +8 -0
- package/dist/lib/internationalization/locale-utils.d.cts +8 -0
- package/dist/lib/internationalization/locales/de.cjs +401 -0
- package/dist/lib/internationalization/locales/de.d.cts +368 -0
- package/dist/lib/internationalization/locales/en.cjs +411 -0
- package/dist/lib/internationalization/locales/en.d.cts +380 -0
- package/dist/lib/internationalization/locales/ja.cjs +320 -0
- package/dist/lib/internationalization/locales/ja.d.cts +307 -0
- package/dist/lib/internationalization/locales/ko.cjs +233 -0
- package/dist/lib/internationalization/locales/ko.d.cts +221 -0
- package/dist/lib/internationalization/locales/zh.cjs +488 -0
- package/dist/lib/internationalization/locales/zh.d.cts +452 -0
- package/dist/lib/internationalization/translatable.d.ts +21 -0
- package/dist/lib/internationalization/translatable.js +8 -0
- package/dist/lib/models/Comment.d.ts +241 -0
- package/dist/lib/models/Comment.js +534 -0
- package/dist/lib/models/ContainerReflection.d.ts +56 -0
- package/dist/lib/models/ContainerReflection.js +159 -0
- package/dist/lib/models/DeclarationReflection.d.ts +149 -0
- package/dist/lib/models/DeclarationReflection.js +287 -0
- package/dist/lib/models/DocumentReflection.d.ts +32 -0
- package/dist/lib/models/DocumentReflection.js +66 -0
- package/dist/lib/models/FileRegistry.d.ts +46 -0
- package/dist/lib/models/FileRegistry.js +133 -0
- package/dist/lib/models/ParameterReflection.d.ts +21 -0
- package/dist/lib/models/ParameterReflection.js +39 -0
- package/dist/lib/models/ProjectReflection.d.ts +112 -0
- package/dist/lib/models/ProjectReflection.js +417 -0
- package/dist/lib/models/ReferenceReflection.d.ts +49 -0
- package/dist/lib/models/ReferenceReflection.js +85 -0
- package/dist/lib/models/Reflection.d.ts +229 -0
- package/dist/lib/models/Reflection.js +495 -0
- package/dist/lib/models/ReflectionCategory.d.ts +31 -0
- package/dist/lib/models/ReflectionCategory.js +56 -0
- package/dist/lib/models/ReflectionGroup.d.ts +38 -0
- package/dist/lib/models/ReflectionGroup.js +72 -0
- package/dist/lib/models/ReflectionSymbolId.d.ts +63 -0
- package/dist/lib/models/ReflectionSymbolId.js +85 -0
- package/dist/lib/models/SignatureReflection.d.ts +50 -0
- package/dist/lib/models/SignatureReflection.js +96 -0
- package/dist/lib/models/SourceReference.d.ts +33 -0
- package/dist/lib/models/SourceReference.js +50 -0
- package/dist/lib/models/TypeParameterReflection.d.ts +30 -0
- package/dist/lib/models/TypeParameterReflection.js +45 -0
- package/dist/lib/models/index.d.ts +19 -0
- package/dist/lib/models/index.js +19 -0
- package/dist/lib/models/kind.d.ts +84 -0
- package/dist/lib/models/kind.js +231 -0
- package/dist/lib/models/types.d.ts +553 -0
- package/dist/lib/models/types.js +1296 -0
- package/dist/lib/models/utils.d.ts +1 -0
- package/dist/lib/models/utils.js +26 -0
- package/dist/lib/models/variant.d.ts +21 -0
- package/dist/lib/models/variant.js +1 -0
- package/dist/lib/output/components.d.ts +53 -0
- package/dist/lib/output/components.js +133 -0
- package/dist/lib/output/events.d.ts +175 -0
- package/dist/lib/output/events.js +195 -0
- package/dist/lib/output/formatter.d.ts +88 -0
- package/dist/lib/output/formatter.js +660 -0
- package/dist/lib/output/index.d.ts +9 -0
- package/dist/lib/output/index.js +7 -0
- package/dist/lib/output/output.d.ts +14 -0
- package/dist/lib/output/output.js +92 -0
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +20 -0
- package/dist/lib/output/plugins/AssetsPlugin.js +160 -0
- package/dist/lib/output/plugins/HierarchyPlugin.d.ts +7 -0
- package/dist/lib/output/plugins/HierarchyPlugin.js +65 -0
- package/dist/lib/output/plugins/IconsPlugin.d.ts +12 -0
- package/dist/lib/output/plugins/IconsPlugin.js +54 -0
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +22 -0
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +222 -0
- package/dist/lib/output/plugins/NavigationPlugin.d.ts +7 -0
- package/dist/lib/output/plugins/NavigationPlugin.js +23 -0
- package/dist/lib/output/plugins/SitemapPlugin.d.ts +8 -0
- package/dist/lib/output/plugins/SitemapPlugin.js +82 -0
- package/dist/lib/output/plugins/index.d.ts +7 -0
- package/dist/lib/output/plugins/index.js +7 -0
- package/dist/lib/output/renderer.d.ts +227 -0
- package/dist/lib/output/renderer.js +387 -0
- package/dist/lib/output/router.d.ts +187 -0
- package/dist/lib/output/router.js +520 -0
- package/dist/lib/output/theme.d.ts +22 -0
- package/dist/lib/output/theme.js +17 -0
- package/dist/lib/output/themes/MarkedPlugin.d.ts +62 -0
- package/dist/lib/output/themes/MarkedPlugin.js +461 -0
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +72 -0
- package/dist/lib/output/themes/default/DefaultTheme.js +367 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +105 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +151 -0
- package/dist/lib/output/themes/default/Slugger.d.ts +13 -0
- package/dist/lib/output/themes/default/Slugger.js +60 -0
- package/dist/lib/output/themes/default/layouts/default.d.ts +6 -0
- package/dist/lib/output/themes/default/layouts/default.js +89 -0
- package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/anchor-icon.js +9 -0
- package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/breadcrumb.js +11 -0
- package/dist/lib/output/themes/default/partials/comment.d.ts +8 -0
- package/dist/lib/output/themes/default/partials/comment.js +80 -0
- package/dist/lib/output/themes/default/partials/footer.d.ts +3 -0
- package/dist/lib/output/themes/default/partials/footer.js +37 -0
- package/dist/lib/output/themes/default/partials/header.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/header.js +39 -0
- package/dist/lib/output/themes/default/partials/hierarchy.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/hierarchy.js +32 -0
- package/dist/lib/output/themes/default/partials/icon.d.ts +20 -0
- package/dist/lib/output/themes/default/partials/icon.js +101 -0
- package/dist/lib/output/themes/default/partials/index.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/index.js +24 -0
- package/dist/lib/output/themes/default/partials/member.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.declaration.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.declaration.js +35 -0
- package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.getterSetter.js +12 -0
- package/dist/lib/output/themes/default/partials/member.js +36 -0
- package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +6 -0
- package/dist/lib/output/themes/default/partials/member.signature.body.js +33 -0
- package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/member.signature.title.js +9 -0
- package/dist/lib/output/themes/default/partials/member.signatures.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.signatures.js +9 -0
- package/dist/lib/output/themes/default/partials/member.sources.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/member.sources.js +55 -0
- package/dist/lib/output/themes/default/partials/members.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/members.js +17 -0
- package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/moduleReflection.js +68 -0
- package/dist/lib/output/themes/default/partials/navigation.d.ts +10 -0
- package/dist/lib/output/themes/default/partials/navigation.js +144 -0
- package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/reflectionPreview.js +26 -0
- package/dist/lib/output/themes/default/partials/toolbar.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/toolbar.js +13 -0
- package/dist/lib/output/themes/default/partials/type.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/type.js +9 -0
- package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/typeAndParent.js +28 -0
- package/dist/lib/output/themes/default/partials/typeDetails.d.ts +8 -0
- package/dist/lib/output/themes/default/partials/typeDetails.js +284 -0
- package/dist/lib/output/themes/default/partials/typeParameters.d.ts +4 -0
- package/dist/lib/output/themes/default/partials/typeParameters.js +26 -0
- package/dist/lib/output/themes/default/templates/document.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/document.js +3 -0
- package/dist/lib/output/themes/default/templates/hierarchy.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/hierarchy.js +31 -0
- package/dist/lib/output/themes/default/templates/index.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/index.js +3 -0
- package/dist/lib/output/themes/default/templates/reflection.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/reflection.js +53 -0
- package/dist/lib/output/themes/lib.d.ts +44 -0
- package/dist/lib/output/themes/lib.js +218 -0
- package/dist/lib/serialization/components.d.ts +22 -0
- package/dist/lib/serialization/components.js +1 -0
- package/dist/lib/serialization/deserializer.d.ts +70 -0
- package/dist/lib/serialization/deserializer.js +235 -0
- package/dist/lib/serialization/events.d.ts +17 -0
- package/dist/lib/serialization/events.js +18 -0
- package/dist/lib/serialization/index.d.ts +5 -0
- package/dist/lib/serialization/index.js +4 -0
- package/dist/lib/serialization/schema.d.ts +283 -0
- package/dist/lib/serialization/schema.js +32 -0
- package/dist/lib/serialization/serializer.d.ts +52 -0
- package/dist/lib/serialization/serializer.js +65 -0
- package/dist/lib/utils/ValidatingFileRegistry.d.ts +12 -0
- package/dist/lib/utils/ValidatingFileRegistry.js +52 -0
- package/dist/lib/utils/component.d.ts +38 -0
- package/dist/lib/utils/component.js +41 -0
- package/dist/lib/utils/compress.d.ts +7 -0
- package/dist/lib/utils/compress.js +13 -0
- package/dist/lib/utils/declaration-maps.d.ts +3 -0
- package/dist/lib/utils/declaration-maps.js +51 -0
- package/dist/lib/utils/entry-point.d.ts +50 -0
- package/dist/lib/utils/entry-point.js +330 -0
- package/dist/lib/utils/fs.d.ts +65 -0
- package/dist/lib/utils/fs.js +372 -0
- package/dist/lib/utils/general.d.ts +4 -0
- package/dist/lib/utils/general.js +25 -0
- package/dist/lib/utils/highlighter.d.ts +9 -0
- package/dist/lib/utils/highlighter.js +150 -0
- 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 +67 -0
- package/dist/lib/utils/html.js +635 -0
- package/dist/lib/utils/index.d.ts +17 -0
- package/dist/lib/utils/index.js +15 -0
- package/dist/lib/utils/loggers.d.ts +10 -0
- package/dist/lib/utils/loggers.js +71 -0
- package/dist/lib/utils/options/declaration.d.ts +514 -0
- package/dist/lib/utils/options/declaration.js +443 -0
- package/dist/lib/utils/options/defaults.d.ts +20 -0
- package/dist/lib/utils/options/defaults.js +104 -0
- package/dist/lib/utils/options/help.d.ts +7 -0
- package/dist/lib/utils/options/help.js +63 -0
- package/dist/lib/utils/options/index.d.ts +6 -0
- package/dist/lib/utils/options/index.js +4 -0
- package/dist/lib/utils/options/options.d.ts +199 -0
- package/dist/lib/utils/options/options.js +273 -0
- package/dist/lib/utils/options/readers/arguments.d.ts +15 -0
- package/dist/lib/utils/options/readers/arguments.js +109 -0
- package/dist/lib/utils/options/readers/index.d.ts +4 -0
- package/dist/lib/utils/options/readers/index.js +4 -0
- package/dist/lib/utils/options/readers/package-json.d.ts +9 -0
- package/dist/lib/utils/options/readers/package-json.js +40 -0
- package/dist/lib/utils/options/readers/tsconfig.d.ts +14 -0
- package/dist/lib/utils/options/readers/tsconfig.js +172 -0
- package/dist/lib/utils/options/readers/typedoc.d.ts +33 -0
- package/dist/lib/utils/options/readers/typedoc.js +136 -0
- package/dist/lib/utils/options/sources/index.d.ts +1 -0
- package/dist/lib/utils/options/sources/index.js +1 -0
- package/dist/lib/utils/options/sources/typedoc.d.ts +2 -0
- package/dist/lib/utils/options/sources/typedoc.js +876 -0
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +6 -0
- package/dist/lib/utils/options/tsdoc-defaults.js +94 -0
- package/dist/lib/utils/package-manifest.d.ts +11 -0
- package/dist/lib/utils/package-manifest.js +84 -0
- package/dist/lib/utils/paths.d.ts +27 -0
- package/dist/lib/utils/paths.js +127 -0
- package/dist/lib/utils/perf.d.ts +6 -0
- package/dist/lib/utils/perf.js +86 -0
- package/dist/lib/utils/plugins.d.ts +3 -0
- package/dist/lib/utils/plugins.js +61 -0
- package/dist/lib/utils/reflections.d.ts +5 -0
- package/dist/lib/utils/reflections.js +64 -0
- package/dist/lib/utils/sort.d.ts +11 -0
- package/dist/lib/utils/sort.js +153 -0
- package/dist/lib/utils/tsconfig.d.ts +5 -0
- package/dist/lib/utils/tsconfig.js +60 -0
- package/dist/lib/utils/tsutils.d.ts +3 -0
- package/dist/lib/utils/tsutils.js +23 -0
- package/dist/lib/utils-common/array.d.ts +57 -0
- package/dist/lib/utils-common/array.js +152 -0
- package/dist/lib/utils-common/declarationReference.d.ts +42 -0
- package/dist/lib/utils-common/declarationReference.js +341 -0
- package/dist/lib/utils-common/enum.d.ts +9 -0
- package/dist/lib/utils-common/enum.js +27 -0
- package/dist/lib/utils-common/events.d.ts +29 -0
- package/dist/lib/utils-common/events.js +49 -0
- package/dist/lib/utils-common/general.d.ts +40 -0
- package/dist/lib/utils-common/general.js +22 -0
- package/dist/lib/utils-common/hooks.d.ts +51 -0
- package/dist/lib/utils-common/hooks.js +90 -0
- package/dist/lib/utils-common/i18n.d.ts +18 -0
- package/dist/lib/utils-common/i18n.js +39 -0
- package/dist/lib/utils-common/index.d.ts +16 -0
- package/dist/lib/utils-common/index.js +17 -0
- package/dist/lib/utils-common/jsx.d.ts +53 -0
- package/dist/lib/utils-common/jsx.elements.d.ts +949 -0
- package/dist/lib/utils-common/jsx.elements.js +3 -0
- package/dist/lib/utils-common/jsx.js +187 -0
- package/dist/lib/utils-common/logger.d.ts +97 -0
- package/dist/lib/utils-common/logger.js +129 -0
- package/dist/lib/utils-common/map.d.ts +23 -0
- package/dist/lib/utils-common/map.js +63 -0
- package/dist/lib/utils-common/minimalSourceFile.d.ts +12 -0
- package/dist/lib/utils-common/minimalSourceFile.js +43 -0
- package/dist/lib/utils-common/path.d.ts +42 -0
- package/dist/lib/utils-common/path.js +130 -0
- package/dist/lib/utils-common/set.d.ts +3 -0
- package/dist/lib/utils-common/set.js +23 -0
- package/dist/lib/utils-common/string.d.ts +11 -0
- package/dist/lib/utils-common/string.js +84 -0
- package/dist/lib/utils-common/validation.d.ts +33 -0
- package/dist/lib/utils-common/validation.js +50 -0
- package/dist/lib/validation/documentation.d.ts +3 -0
- package/dist/lib/validation/documentation.js +91 -0
- package/dist/lib/validation/exports.d.ts +3 -0
- package/dist/lib/validation/exports.js +65 -0
- package/dist/lib/validation/links.d.ts +3 -0
- package/dist/lib/validation/links.js +78 -0
- package/dist/lib/validation/unusedMergeModuleWith.d.ts +3 -0
- package/dist/lib/validation/unusedMergeModuleWith.js +12 -0
- package/package.json +161 -0
- package/static/main.js +58 -0
- package/static/style.css +1633 -0
- package/tsdoc.json +247 -0
- package/typedoc-config.schema.json +941 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { TokenSyntaxKind } from "./lexer.js";
|
|
2
|
+
/**
|
|
3
|
+
* Note: This lexer intentionally *only* recognizes inline tags and code blocks.
|
|
4
|
+
* This is because it is intended for use on markdown documents, and we shouldn't
|
|
5
|
+
* take some stray `@user` mention within a "Thanks" section of someone's changelog
|
|
6
|
+
* as starting a block!
|
|
7
|
+
*/
|
|
8
|
+
export function* lexCommentString(file) {
|
|
9
|
+
// Wrapper around our real lex function to collapse adjacent text tokens.
|
|
10
|
+
let textToken;
|
|
11
|
+
for (const token of lexCommentString2(file)) {
|
|
12
|
+
if (token.kind === TokenSyntaxKind.Text ||
|
|
13
|
+
token.kind === TokenSyntaxKind.NewLine) {
|
|
14
|
+
if (textToken) {
|
|
15
|
+
textToken.text += token.text;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
token.kind = TokenSyntaxKind.Text;
|
|
19
|
+
textToken = token;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
if (textToken) {
|
|
24
|
+
yield textToken;
|
|
25
|
+
textToken = void 0;
|
|
26
|
+
}
|
|
27
|
+
yield token;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (textToken) {
|
|
31
|
+
yield textToken;
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
function* lexCommentString2(file) {
|
|
36
|
+
let pos = 0;
|
|
37
|
+
let end = file.length;
|
|
38
|
+
// Skip leading whitespace
|
|
39
|
+
while (pos < end && /\s/.test(file[pos])) {
|
|
40
|
+
pos++;
|
|
41
|
+
}
|
|
42
|
+
// Trailing whitespace
|
|
43
|
+
while (pos < end && /\s/.test(file[end - 1])) {
|
|
44
|
+
end--;
|
|
45
|
+
}
|
|
46
|
+
let expectingTag = false;
|
|
47
|
+
for (;;) {
|
|
48
|
+
if (pos >= end) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
switch (file[pos]) {
|
|
52
|
+
case "\n":
|
|
53
|
+
yield makeToken(TokenSyntaxKind.NewLine, 1);
|
|
54
|
+
expectingTag = false;
|
|
55
|
+
break;
|
|
56
|
+
case "{":
|
|
57
|
+
yield makeToken(TokenSyntaxKind.OpenBrace, 1);
|
|
58
|
+
expectingTag = true;
|
|
59
|
+
break;
|
|
60
|
+
case "}":
|
|
61
|
+
yield makeToken(TokenSyntaxKind.CloseBrace, 1);
|
|
62
|
+
expectingTag = false;
|
|
63
|
+
break;
|
|
64
|
+
case "`": {
|
|
65
|
+
// Markdown's code rules are a royal pain. This could be one of several things.
|
|
66
|
+
// 1. Inline code: <1-n ticks><text without multiple consecutive newlines or ticks at start of line><same number of ticks>
|
|
67
|
+
// 2. Code block: <newline><3+ ticks><language, no ticks>\n<text>\n<3 ticks>\n
|
|
68
|
+
// 3. Unmatched tick(s), not code, but part of some text.
|
|
69
|
+
// We don't quite handle #2 correctly yet. PR welcome!
|
|
70
|
+
let tickCount = 1;
|
|
71
|
+
let lookahead = pos - 1;
|
|
72
|
+
let atNewline = true;
|
|
73
|
+
while (lookahead > 0 && file[lookahead] !== "\n") {
|
|
74
|
+
if (/\S/.test(file[lookahead])) {
|
|
75
|
+
atNewline = false;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
--lookahead;
|
|
79
|
+
}
|
|
80
|
+
lookahead = pos;
|
|
81
|
+
while (lookahead + 1 < end && file[lookahead + 1] === "`") {
|
|
82
|
+
tickCount++;
|
|
83
|
+
lookahead++;
|
|
84
|
+
}
|
|
85
|
+
const isCodeBlock = atNewline && tickCount >= 3;
|
|
86
|
+
let lookaheadStart = pos;
|
|
87
|
+
const codeText = [];
|
|
88
|
+
lookahead++;
|
|
89
|
+
while (lookahead < end) {
|
|
90
|
+
if (lookaheadExactlyNTicks(lookahead, tickCount)) {
|
|
91
|
+
lookahead += tickCount;
|
|
92
|
+
codeText.push(file.substring(lookaheadStart, lookahead));
|
|
93
|
+
const codeTextStr = codeText.join("");
|
|
94
|
+
if (isCodeBlock || !/\n\s*\n/.test(codeTextStr)) {
|
|
95
|
+
yield {
|
|
96
|
+
kind: TokenSyntaxKind.Code,
|
|
97
|
+
text: codeTextStr,
|
|
98
|
+
pos,
|
|
99
|
+
};
|
|
100
|
+
expectingTag = false;
|
|
101
|
+
pos = lookahead;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
yield makeToken(TokenSyntaxKind.Text, tickCount);
|
|
105
|
+
expectingTag = false;
|
|
106
|
+
}
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
else if (file[lookahead] === "`") {
|
|
110
|
+
while (lookahead < end && file[lookahead] === "`") {
|
|
111
|
+
lookahead++;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else if (file[lookahead] === "\\" &&
|
|
115
|
+
lookahead + 1 < end &&
|
|
116
|
+
file[lookahead + 1] !== "\n") {
|
|
117
|
+
lookahead += 2;
|
|
118
|
+
}
|
|
119
|
+
else if (file[lookahead] === "\n") {
|
|
120
|
+
lookahead++;
|
|
121
|
+
codeText.push(file.substring(lookaheadStart, lookahead));
|
|
122
|
+
lookaheadStart = lookahead;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
lookahead++;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (lookahead >= end && pos !== lookahead) {
|
|
129
|
+
if (isCodeBlock &&
|
|
130
|
+
file.substring(pos, end).includes("\n")) {
|
|
131
|
+
codeText.push(file.substring(lookaheadStart, end));
|
|
132
|
+
yield {
|
|
133
|
+
kind: TokenSyntaxKind.Code,
|
|
134
|
+
text: codeText.join(""),
|
|
135
|
+
pos,
|
|
136
|
+
};
|
|
137
|
+
expectingTag = false;
|
|
138
|
+
pos = lookahead;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
yield makeToken(TokenSyntaxKind.Text, tickCount);
|
|
142
|
+
expectingTag = false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
case "@": {
|
|
148
|
+
let lookahead = pos + 1;
|
|
149
|
+
while (lookahead < end && /[a-z]/i.test(file[lookahead])) {
|
|
150
|
+
lookahead++;
|
|
151
|
+
}
|
|
152
|
+
if (lookahead !== pos + 1) {
|
|
153
|
+
while (lookahead < end &&
|
|
154
|
+
/[a-z0-9-]/i.test(file[lookahead])) {
|
|
155
|
+
lookahead++;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (expectingTag &&
|
|
159
|
+
lookahead !== pos + 1 &&
|
|
160
|
+
(lookahead === end || /[\s}]/.test(file[lookahead]))) {
|
|
161
|
+
yield makeToken(TokenSyntaxKind.Tag, lookahead - pos);
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// fall through if we didn't find something that looks like a tag
|
|
166
|
+
default: {
|
|
167
|
+
const textParts = [];
|
|
168
|
+
let lookaheadStart = pos;
|
|
169
|
+
let lookahead = pos;
|
|
170
|
+
while (lookahead < end) {
|
|
171
|
+
if ("{}\n`".includes(file[lookahead]))
|
|
172
|
+
break;
|
|
173
|
+
if (lookahead !== pos &&
|
|
174
|
+
file[lookahead] === "@" &&
|
|
175
|
+
/\s/.test(file[lookahead - 1])) {
|
|
176
|
+
// Probably the start of a modifier tag
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
if (file[lookahead] === "\\" &&
|
|
180
|
+
lookahead + 1 < end &&
|
|
181
|
+
"{}@`".includes(file[lookahead + 1])) {
|
|
182
|
+
textParts.push(file.substring(lookaheadStart, lookahead), file[lookahead + 1]);
|
|
183
|
+
lookahead++;
|
|
184
|
+
lookaheadStart = lookahead + 1;
|
|
185
|
+
}
|
|
186
|
+
lookahead++;
|
|
187
|
+
}
|
|
188
|
+
textParts.push(file.substring(lookaheadStart, lookahead));
|
|
189
|
+
if (textParts.some((part) => /\S/.test(part))) {
|
|
190
|
+
expectingTag = false;
|
|
191
|
+
}
|
|
192
|
+
// This piece of text had line continuations or escaped text
|
|
193
|
+
yield {
|
|
194
|
+
kind: TokenSyntaxKind.Text,
|
|
195
|
+
text: textParts.join(""),
|
|
196
|
+
pos,
|
|
197
|
+
};
|
|
198
|
+
pos = lookahead;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function makeToken(kind, size) {
|
|
204
|
+
const start = pos;
|
|
205
|
+
pos += size;
|
|
206
|
+
return {
|
|
207
|
+
kind,
|
|
208
|
+
text: file.substring(start, pos),
|
|
209
|
+
pos: start,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function lookaheadExactlyNTicks(pos, n) {
|
|
213
|
+
if (pos + n > end) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
return file.startsWith("`".repeat(n), pos) && file[pos + n] !== "`";
|
|
217
|
+
}
|
|
218
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines the name of the parameter/template/property from the tag content
|
|
3
|
+
* when processing `@param x`
|
|
4
|
+
*/
|
|
5
|
+
export function extractTagName(text) {
|
|
6
|
+
let pos = skipWs(text, 0);
|
|
7
|
+
// Extract the "name" part of the comment, this might also include a default
|
|
8
|
+
// value if bracketed.
|
|
9
|
+
let nameStart = pos;
|
|
10
|
+
let bracketDepth = 0;
|
|
11
|
+
let stringChar = "";
|
|
12
|
+
while (pos < text.length && (bracketDepth > 0 || /\S/.test(text[pos]))) {
|
|
13
|
+
if (stringChar) {
|
|
14
|
+
if (text[pos] == stringChar) {
|
|
15
|
+
stringChar = "";
|
|
16
|
+
++pos;
|
|
17
|
+
}
|
|
18
|
+
else if (text[pos] == "\\") {
|
|
19
|
+
pos += 2;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
++pos;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
if ("\"'`".includes(text[pos])) {
|
|
27
|
+
stringChar = text[pos];
|
|
28
|
+
}
|
|
29
|
+
else if (text[pos] == "[") {
|
|
30
|
+
++bracketDepth;
|
|
31
|
+
}
|
|
32
|
+
else if (text[pos] == "]") {
|
|
33
|
+
--bracketDepth;
|
|
34
|
+
}
|
|
35
|
+
++pos;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
let nameEnd = pos;
|
|
39
|
+
if (text[nameStart] === "[") {
|
|
40
|
+
nameStart = skipWs(text, nameStart + 1);
|
|
41
|
+
nameEnd = skipWith(text, nameStart, /[^\s=\]]/);
|
|
42
|
+
}
|
|
43
|
+
// Skip any whitespace & an optional dash before the description
|
|
44
|
+
pos = skipWith(text, pos, /[\s-]/);
|
|
45
|
+
return {
|
|
46
|
+
name: text.substring(nameStart, nameEnd),
|
|
47
|
+
newText: text.substring(pos),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function skipWs(text, pos) {
|
|
51
|
+
return skipWith(text, pos, /\s/);
|
|
52
|
+
}
|
|
53
|
+
function skipWith(text, pos, reg) {
|
|
54
|
+
while (pos < text.length && reg.test(text[pos])) {
|
|
55
|
+
++pos;
|
|
56
|
+
}
|
|
57
|
+
return pos;
|
|
58
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CommentDisplayPart } from "../../models/index.js";
|
|
2
|
+
import type { FileRegistry } from "../../models/FileRegistry.js";
|
|
3
|
+
import { type ValidationOptions } from "#node-utils";
|
|
4
|
+
import { type Token } from "./lexer.js";
|
|
5
|
+
import type { NormalizedPath, TranslatedString } from "#utils";
|
|
6
|
+
interface TextParserData {
|
|
7
|
+
sourcePath: NormalizedPath;
|
|
8
|
+
token: Token;
|
|
9
|
+
pos: number;
|
|
10
|
+
warning: (msg: TranslatedString, token: Token) => void;
|
|
11
|
+
validationWarning: (msg: TranslatedString, token: Token) => void;
|
|
12
|
+
files: FileRegistry;
|
|
13
|
+
atNewLine: boolean;
|
|
14
|
+
validationOptions: ValidationOptions;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* This is incredibly unfortunate. The comment lexer owns the responsibility
|
|
18
|
+
* for splitting up text into text/code, this is totally fine for HTML links
|
|
19
|
+
* but for markdown links, ``[`code`](./link)`` is valid, so we need to keep
|
|
20
|
+
* track of state across calls to {@link textContent}.
|
|
21
|
+
*/
|
|
22
|
+
export declare class TextParserReentryState {
|
|
23
|
+
withinLinkLabel: boolean;
|
|
24
|
+
withinLinkDest: boolean;
|
|
25
|
+
private lastPartWasNewline;
|
|
26
|
+
checkState(token: Token): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Look for relative links within a piece of text and add them to the {@link FileRegistry}
|
|
30
|
+
* so that they can be correctly resolved during rendering.
|
|
31
|
+
*/
|
|
32
|
+
export declare function textContent(parserData: Omit<TextParserData, "pos">, outContent: CommentDisplayPart[], reentry: TextParserReentryState): void;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser to handle plain text markdown.
|
|
3
|
+
*
|
|
4
|
+
* Responsible for recognizing relative paths within the text and turning
|
|
5
|
+
* them into references.
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { i18n } from "#utils";
|
|
9
|
+
import { HtmlAttributeParser, ParserState } from "#node-utils";
|
|
10
|
+
import { TokenSyntaxKind } from "./lexer.js";
|
|
11
|
+
import MarkdownIt from "markdown-it";
|
|
12
|
+
const MdHelpers = new MarkdownIt().helpers;
|
|
13
|
+
/**
|
|
14
|
+
* This is incredibly unfortunate. The comment lexer owns the responsibility
|
|
15
|
+
* for splitting up text into text/code, this is totally fine for HTML links
|
|
16
|
+
* but for markdown links, ``[`code`](./link)`` is valid, so we need to keep
|
|
17
|
+
* track of state across calls to {@link textContent}.
|
|
18
|
+
*/
|
|
19
|
+
export class TextParserReentryState {
|
|
20
|
+
withinLinkLabel = false;
|
|
21
|
+
withinLinkDest = false;
|
|
22
|
+
lastPartWasNewline = false;
|
|
23
|
+
checkState(token) {
|
|
24
|
+
switch (token.kind) {
|
|
25
|
+
case TokenSyntaxKind.Code:
|
|
26
|
+
if (/\n\s*\n/.test(token.text)) {
|
|
27
|
+
this.withinLinkLabel = false;
|
|
28
|
+
this.withinLinkDest = false;
|
|
29
|
+
}
|
|
30
|
+
break;
|
|
31
|
+
case TokenSyntaxKind.NewLine:
|
|
32
|
+
if (this.lastPartWasNewline) {
|
|
33
|
+
this.withinLinkLabel = false;
|
|
34
|
+
this.withinLinkDest = false;
|
|
35
|
+
}
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
this.lastPartWasNewline = token.kind === TokenSyntaxKind.NewLine;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Look for relative links within a piece of text and add them to the {@link FileRegistry}
|
|
43
|
+
* so that they can be correctly resolved during rendering.
|
|
44
|
+
*/
|
|
45
|
+
export function textContent(parserData, outContent, reentry) {
|
|
46
|
+
let lastPartEnd = 0;
|
|
47
|
+
let canEndMarkdownLink = true;
|
|
48
|
+
const data = {
|
|
49
|
+
...parserData,
|
|
50
|
+
pos: 0, // relative to the token
|
|
51
|
+
};
|
|
52
|
+
function addRef(ref) {
|
|
53
|
+
canEndMarkdownLink = true;
|
|
54
|
+
outContent.push({
|
|
55
|
+
kind: "text",
|
|
56
|
+
text: data.token.text.slice(lastPartEnd, ref.pos),
|
|
57
|
+
});
|
|
58
|
+
const link = {
|
|
59
|
+
kind: "relative-link",
|
|
60
|
+
text: data.token.text.slice(ref.pos, ref.end),
|
|
61
|
+
target: ref.target,
|
|
62
|
+
targetAnchor: ref.targetAnchor,
|
|
63
|
+
};
|
|
64
|
+
outContent.push(link);
|
|
65
|
+
lastPartEnd = ref.end;
|
|
66
|
+
data.pos = ref.end;
|
|
67
|
+
if (!ref.target && data.validationOptions.invalidPath) {
|
|
68
|
+
data.validationWarning(i18n.relative_path_0_is_not_a_file_and_will_not_be_copied_to_output(data.token.text.slice(ref.pos, ref.end)), {
|
|
69
|
+
kind: TokenSyntaxKind.Text,
|
|
70
|
+
// ref.pos is relative to the token, but this pos is relative to the file.
|
|
71
|
+
pos: data.token.pos + ref.pos,
|
|
72
|
+
text: data.token.text.slice(ref.pos, ref.end),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
while (data.pos < data.token.text.length) {
|
|
77
|
+
if (canEndMarkdownLink) {
|
|
78
|
+
const link = checkMarkdownLink(data, reentry);
|
|
79
|
+
if (link) {
|
|
80
|
+
addRef(link);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
// If we're within a Markdown link, then `checkMarkdownLink`
|
|
84
|
+
// already scanned `token` up to a line feed (if any).
|
|
85
|
+
canEndMarkdownLink = !reentry.withinLinkLabel && !reentry.withinLinkDest;
|
|
86
|
+
}
|
|
87
|
+
const reference = checkReference(data);
|
|
88
|
+
if (reference) {
|
|
89
|
+
addRef(reference);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const tagLinks = checkTagLink(data);
|
|
93
|
+
if (tagLinks.length) {
|
|
94
|
+
for (const tagLink of tagLinks) {
|
|
95
|
+
addRef(tagLink);
|
|
96
|
+
}
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const atNewLine = data.token.text[data.pos] === "\n";
|
|
100
|
+
data.atNewLine = atNewLine;
|
|
101
|
+
if (atNewLine && !reentry.withinLinkDest)
|
|
102
|
+
canEndMarkdownLink = true;
|
|
103
|
+
++data.pos;
|
|
104
|
+
}
|
|
105
|
+
if (lastPartEnd !== data.token.text.length) {
|
|
106
|
+
outContent.push({ kind: "text", text: data.token.text.slice(lastPartEnd) });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Links are inline text with the form `[ text ]( url title )`.
|
|
111
|
+
*
|
|
112
|
+
* Images are just links with a leading `!` and lack of support for `[ref]` referring to a path
|
|
113
|
+
* defined elsewhere, we don't care about that distinction here as we'll only replace the path
|
|
114
|
+
* piece of the image.
|
|
115
|
+
*
|
|
116
|
+
* Reference: https://github.com/markdown-it/markdown-it/blob/14.1.0/lib/rules_inline/link.mjs
|
|
117
|
+
* Reference: https://github.com/markdown-it/markdown-it/blob/14.1.0/lib/rules_inline/image.mjs
|
|
118
|
+
*/
|
|
119
|
+
function checkMarkdownLink(data, reentry) {
|
|
120
|
+
const { token, sourcePath, files } = data;
|
|
121
|
+
let searchStart;
|
|
122
|
+
if (reentry.withinLinkLabel || reentry.withinLinkDest) {
|
|
123
|
+
searchStart = data.pos;
|
|
124
|
+
}
|
|
125
|
+
else if (token.text[data.pos] === "[") {
|
|
126
|
+
searchStart = data.pos + 1;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (!reentry.withinLinkDest) {
|
|
132
|
+
const labelEnd = findLabelEnd(token.text, searchStart);
|
|
133
|
+
if (labelEnd === -1 || token.text[labelEnd] === "\n") {
|
|
134
|
+
// This markdown link might be split across multiple lines or input tokens
|
|
135
|
+
// [prefix `code` suffix](target)
|
|
136
|
+
// ........^^^^^^................
|
|
137
|
+
// Unless we encounter two consecutive line feeds, expect it to keep going.
|
|
138
|
+
reentry.withinLinkLabel = labelEnd !== data.pos || !data.atNewLine;
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
reentry.withinLinkLabel = false;
|
|
142
|
+
if (!token.text.startsWith("](", labelEnd))
|
|
143
|
+
return;
|
|
144
|
+
searchStart = labelEnd + 2;
|
|
145
|
+
}
|
|
146
|
+
// Skip whitespace (including line breaks) between "](" and the link destination.
|
|
147
|
+
// https://spec.commonmark.org/0.31.2/#links
|
|
148
|
+
const end = token.text.length;
|
|
149
|
+
let lookahead = searchStart;
|
|
150
|
+
for (let newlines = 0;; ++lookahead) {
|
|
151
|
+
if (lookahead === end) {
|
|
152
|
+
reentry.withinLinkDest = true;
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
switch (token.text[lookahead]) {
|
|
156
|
+
case "\n":
|
|
157
|
+
if (++newlines === 2) {
|
|
158
|
+
reentry.withinLinkDest = false;
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
continue;
|
|
162
|
+
case " ":
|
|
163
|
+
case "\t":
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
reentry.withinLinkDest = false;
|
|
169
|
+
const link = MdHelpers.parseLinkDestination(token.text, lookahead, end);
|
|
170
|
+
if (link.ok) {
|
|
171
|
+
// Only make a relative-link display part if it's actually a relative link.
|
|
172
|
+
// Discard protocol:// links, unix style absolute paths, and windows style absolute paths.
|
|
173
|
+
const decoded = decodeURI(link.str);
|
|
174
|
+
if (isRelativePath(decoded)) {
|
|
175
|
+
const { target, anchor } = files.register(sourcePath, decoded) || { target: undefined, anchor: undefined };
|
|
176
|
+
return {
|
|
177
|
+
pos: lookahead,
|
|
178
|
+
end: link.pos,
|
|
179
|
+
target,
|
|
180
|
+
targetAnchor: anchor,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
// This was a link, skip ahead to ensure we don't happen to parse
|
|
184
|
+
// something else as a link within the link.
|
|
185
|
+
data.pos = link.pos - 1;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Reference definitions are blocks with the form `[label]: link title`
|
|
190
|
+
* Reference: https://github.com/markdown-it/markdown-it/blob/14.1.0/lib/rules_block/reference.mjs
|
|
191
|
+
*
|
|
192
|
+
* Note: This may include false positives where TypeDoc recognizes a reference block that markdown
|
|
193
|
+
* does not if users start lines with something that looks like a reference block without fully
|
|
194
|
+
* separating it from an above paragraph. For a first cut, this is good enough.
|
|
195
|
+
*/
|
|
196
|
+
function checkReference(data) {
|
|
197
|
+
const { atNewLine, pos, token, files, sourcePath } = data;
|
|
198
|
+
if (atNewLine) {
|
|
199
|
+
let lookahead = pos;
|
|
200
|
+
while (/[ \t]/.test(token.text[lookahead])) {
|
|
201
|
+
++lookahead;
|
|
202
|
+
}
|
|
203
|
+
// #2991, we check that this reference also doesn't look like a footnote reference
|
|
204
|
+
// as it is unlikely that someone uses that syntax without intending for footnote behavior.
|
|
205
|
+
// This introduces a problem if someone has an [^ref] and doesn't intend for that to
|
|
206
|
+
// be interpreted as a footnote, but as a reference, but we can't have it both ways,
|
|
207
|
+
// and having people rename their reference to not be confused with a footnote isn't a
|
|
208
|
+
// horrible workaround.
|
|
209
|
+
if (token.text[lookahead] === "[" && token.text[lookahead + 1] !== "^") {
|
|
210
|
+
while (lookahead < token.text.length &&
|
|
211
|
+
/[^\n\]]/.test(token.text[lookahead])) {
|
|
212
|
+
++lookahead;
|
|
213
|
+
}
|
|
214
|
+
if (token.text.startsWith("]:", lookahead)) {
|
|
215
|
+
lookahead += 2;
|
|
216
|
+
while (/[ \t]/.test(token.text[lookahead])) {
|
|
217
|
+
++lookahead;
|
|
218
|
+
}
|
|
219
|
+
const link = MdHelpers.parseLinkDestination(token.text, lookahead, token.text.length);
|
|
220
|
+
if (link.ok) {
|
|
221
|
+
const decoded = decodeURI(link.str);
|
|
222
|
+
if (isRelativePath(decoded)) {
|
|
223
|
+
const { target, anchor } = files.register(sourcePath, decoded) || { target: undefined, anchor: undefined };
|
|
224
|
+
return {
|
|
225
|
+
pos: lookahead,
|
|
226
|
+
end: link.pos,
|
|
227
|
+
target,
|
|
228
|
+
targetAnchor: anchor,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
data.pos = link.pos - 1;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Looks for `<a href="./relative">`, `<img src="./relative">`, and `<source srcset="./relative">`
|
|
239
|
+
*/
|
|
240
|
+
function checkTagLink(data) {
|
|
241
|
+
const { pos, token } = data;
|
|
242
|
+
if (token.text.startsWith("<img ", pos)) {
|
|
243
|
+
data.pos += 4;
|
|
244
|
+
return checkAttributes(data, {
|
|
245
|
+
src: checkAttributeDirectPath,
|
|
246
|
+
srcset: checkAttributeSrcSet,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
if (token.text.startsWith("<link ", pos)) {
|
|
250
|
+
data.pos += 4;
|
|
251
|
+
return checkAttributes(data, {
|
|
252
|
+
// cspell:words imagesrcset
|
|
253
|
+
imagesrcset: checkAttributeSrcSet,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
if (token.text.startsWith("<a ", pos)) {
|
|
257
|
+
data.pos += 3;
|
|
258
|
+
return checkAttributes(data, { href: checkAttributeDirectPath });
|
|
259
|
+
}
|
|
260
|
+
if (token.text.startsWith("<source ", pos)) {
|
|
261
|
+
data.pos += 8;
|
|
262
|
+
return checkAttributes(data, {
|
|
263
|
+
src: checkAttributeDirectPath,
|
|
264
|
+
srcset: checkAttributeSrcSet,
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
return [];
|
|
268
|
+
}
|
|
269
|
+
function checkAttributes(data, attributes) {
|
|
270
|
+
const links = [];
|
|
271
|
+
const parser = new HtmlAttributeParser(data.token.text, data.pos);
|
|
272
|
+
while (parser.state !== ParserState.END) {
|
|
273
|
+
if (parser.state === ParserState.BeforeAttributeValue &&
|
|
274
|
+
Object.prototype.hasOwnProperty.call(attributes, parser.currentAttributeName)) {
|
|
275
|
+
parser.step();
|
|
276
|
+
links.push(...attributes[parser.currentAttributeName](data, parser.currentAttributeValue, parser.currentAttributeValueStart, parser.currentAttributeValueEnd));
|
|
277
|
+
}
|
|
278
|
+
parser.step();
|
|
279
|
+
}
|
|
280
|
+
return links;
|
|
281
|
+
}
|
|
282
|
+
function checkAttributeDirectPath(data, text, pos, end) {
|
|
283
|
+
const decoded = decodeURI(text.trim());
|
|
284
|
+
if (isRelativePath(decoded)) {
|
|
285
|
+
const { target, anchor } = data.files.register(data.sourcePath, decoded) || { target: undefined, anchor: undefined };
|
|
286
|
+
return [{
|
|
287
|
+
pos,
|
|
288
|
+
end,
|
|
289
|
+
target,
|
|
290
|
+
targetAnchor: anchor,
|
|
291
|
+
}];
|
|
292
|
+
}
|
|
293
|
+
return [];
|
|
294
|
+
}
|
|
295
|
+
// See https://html.spec.whatwg.org/multipage/images.html#srcset-attribute
|
|
296
|
+
function checkAttributeSrcSet(data, text, pos, _end) {
|
|
297
|
+
const result = [];
|
|
298
|
+
let textPos = 0;
|
|
299
|
+
parseImageCandidate();
|
|
300
|
+
while (textPos < text.length && text[textPos] == ",") {
|
|
301
|
+
++textPos;
|
|
302
|
+
parseImageCandidate();
|
|
303
|
+
}
|
|
304
|
+
return result;
|
|
305
|
+
function parseImageCandidate() {
|
|
306
|
+
// 1. Zero or more ASCII whitespace
|
|
307
|
+
while (textPos < text.length && /[\t\r\f\n ]/.test(text[textPos]))
|
|
308
|
+
++textPos;
|
|
309
|
+
// 2. A valid non-empty URL that does not start or end with a comma
|
|
310
|
+
// TypeDoc: We don't exactly match this, PR welcome! For now, just permit anything
|
|
311
|
+
// that's not whitespace or a comma
|
|
312
|
+
const url = text.slice(textPos).match(/^[^\t\r\f\n ,]+/);
|
|
313
|
+
const decoded = url && decodeURI(url[0]);
|
|
314
|
+
if (decoded && isRelativePath(decoded)) {
|
|
315
|
+
const { target, anchor } = data.files.register(data.sourcePath, decoded) || { target: undefined, anchor: undefined };
|
|
316
|
+
result.push({
|
|
317
|
+
pos: pos + textPos,
|
|
318
|
+
end: pos + textPos + url[0].length,
|
|
319
|
+
target,
|
|
320
|
+
targetAnchor: anchor,
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
textPos += url ? url[0].length : 0;
|
|
324
|
+
// 3. Zero or more ASCII whitespace
|
|
325
|
+
while (textPos < text.length && /[\t\r\f\n ]/.test(text[textPos]))
|
|
326
|
+
++textPos;
|
|
327
|
+
// 4. Zero or one of the following:
|
|
328
|
+
{
|
|
329
|
+
// A width descriptor, consisting of: ASCII whitespace, a valid non-negative integer giving
|
|
330
|
+
// a number greater than zero representing the width descriptor value, and a U+0077 LATIN
|
|
331
|
+
// SMALL LETTER W character.
|
|
332
|
+
const w = text.slice(textPos).match(/^\+?\d+\s*w/);
|
|
333
|
+
textPos += w ? w[0].length : 0;
|
|
334
|
+
// A pixel density descriptor, consisting of: ASCII whitespace, a valid floating-point number
|
|
335
|
+
// giving a number greater than zero representing the pixel density descriptor value, and a
|
|
336
|
+
// U+0078 LATIN SMALL LETTER X character.
|
|
337
|
+
if (!w) {
|
|
338
|
+
const x = text.slice(textPos).match(/^\+?\d+(\.\d+)?([eE][+-]\d+)?\s*x/);
|
|
339
|
+
textPos += x ? x[0].length : 0;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
// 5. Zero or more ASCII whitespace
|
|
343
|
+
while (textPos < text.length && /[\t\r\f\n ]/.test(text[textPos]))
|
|
344
|
+
++textPos;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function isRelativePath(link) {
|
|
348
|
+
// Lots of edge cases encoded right here!
|
|
349
|
+
// Originally, this attempted to match protocol://, but...
|
|
350
|
+
// `mailto:example@example.com` is not a relative path
|
|
351
|
+
// `C:\foo` is not a relative path
|
|
352
|
+
// `/etc/passwd` is not a relative path
|
|
353
|
+
// `#anchor` is not a relative path
|
|
354
|
+
return !/^[a-z]+:|^\/|^#/i.test(link);
|
|
355
|
+
}
|
|
356
|
+
function findLabelEnd(text, pos) {
|
|
357
|
+
while (pos < text.length) {
|
|
358
|
+
switch (text[pos]) {
|
|
359
|
+
case "\\":
|
|
360
|
+
++pos;
|
|
361
|
+
if (pos < text.length && text[pos] === "\n")
|
|
362
|
+
return pos;
|
|
363
|
+
break;
|
|
364
|
+
case "\n":
|
|
365
|
+
case "]":
|
|
366
|
+
case "[":
|
|
367
|
+
return pos;
|
|
368
|
+
}
|
|
369
|
+
++pos;
|
|
370
|
+
}
|
|
371
|
+
return -1;
|
|
372
|
+
}
|