From b9840f91ccc2efeeaf91a3f9341cdd33d2124deb Mon Sep 17 00:00:00 2001 From: tgreyuk Date: Mon, 27 May 2024 10:34:37 +0100 Subject: [PATCH] fix(core): further typedoc beta fixes --- .eslintrc => .eslintrc.json | 0 .gitignore | 2 +- CONTRIBUTING.md | 14 +- devtools/packages/fixtures/typedoc.cjs | 5 + devtools/packages/helpers/constants.ts | 2 +- .../prebuild-options/tasks/generate-docs.ts | 6 +- .../prebuild-options/tasks/generate-models.ts | 63 +- .../pages/api-docs/Class.MarkdownPageEvent.md | 43 +- .../api-docs/Class.MarkdownRendererEvent.md | 24 +- docs/pages/api-docs/Class.MarkdownTheme.md | 36 +- .../api-docs/Class.MarkdownThemeContext.md | 538 +++++++++++++---- .../api-docs/Interface.MarkdownApplication.md | 12 +- .../api-docs/Interface.MarkdownRenderer.md | 30 +- .../Interface.MarkdownRendererHooks.md | 20 +- .../api-docs/Interface.NavigationItem.md | 16 +- .../api-docs/Interface.PackageMetaData.md | 8 +- .../pages/api-docs/Interface.PluginOptions.md | 243 ++++++-- docs/pages/api-docs/Interface.UrlMapping.md | 12 +- docs/pages/api-docs/_meta.js | 26 +- docs/pages/api-docs/index.md | 31 +- docs/pages/docs/CHANGELOG.md | 126 ---- docs/pages/docs/_meta.js | 4 +- .../4.0.mdx} | 26 +- docs/pages/docs/changelog/4.1.mdx | 31 + docs/pages/docs/changelog/_meta.js | 4 + docs/pages/docs/internationalization.mdx | 3 + docs/pages/docs/options.mdx | 80 ++- docs/pages/docs/options/_meta.js | 6 +- .../docs/options/display options-options.mdx | 180 ++++++ docs/pages/docs/options/display-options.mdx | 76 +-- .../docs/options/file options-options.mdx | 108 ++++ docs/pages/docs/options/file-options.mdx | 48 +- .../docs/options/utility options-options.mdx | 104 ++++ docs/pages/docs/options/utility-options.mdx | 70 +-- docs/theme.config.jsx | 2 +- package-lock.json | 546 ++++++++++++++---- package.json | 23 +- .../docusaurus-plugin-typedoc/package.json | 2 +- .../__snapshots__/docusaurus.spec.ts.snap | 2 +- .../.docs/plugins/typedoc-default-values.js | 41 ++ .../.docs/plugins/typedoc-symbol-resolver.mjs | 18 - .../.docs/typedoc.dev.json | 115 ++++ .../.docs/typedoc.html.json | 88 +++ .../.docs/typedoc.json | 16 +- .../.scripts/prebuild-kinds.ts | 90 --- .../.scripts/prebuild-resources.ts | 120 ++-- packages/typedoc-plugin-markdown/DEVELOP.md | 9 + packages/typedoc-plugin-markdown/OPTIONS.md | 14 + .../barrelsby.config.json | 15 + packages/typedoc-plugin-markdown/package.json | 6 +- .../src/{defs/typedoc.d.ts => _typedoc.d.ts} | 30 +- .../src/app/_initialize.ts | 122 ++++ .../src/app/application.ts | 67 --- .../src/app/events/index.ts | 9 +- .../src/app/events/markdown-page-event.ts | 14 +- .../src/app/events/markdown-renderer-event.ts | 16 +- .../typedoc-plugin-markdown/src/app/index.ts | 9 + .../{renderer/overrides.ts => renderer.ts} | 63 +- .../src/app/renderer/index.ts | 3 - .../src/app/renderer/packages.ts | 28 - .../src/app/translatable.ts | 73 --- .../src/app/types/index.ts | 8 + .../src/app/types/markdown-application.ts | 23 + .../markdown-renderer-hooks.ts | 5 +- .../src/app/types/markdown-renderer.ts | 52 ++ packages/typedoc-plugin-markdown/src/index.ts | 111 +--- .../src/internationalization/index.ts | 8 + .../src/internationalization/locales/en.ts | 22 + .../src/internationalization/locales/index.ts | 10 + .../src/internationalization/locales/ko.ts | 20 + .../src/internationalization/translatable.ts | 26 + .../src/internationalization/types.ts | 25 + .../typedoc-plugin-markdown/src/libs/index.ts | 7 + .../src/libs/markdown/_index.ts | 14 + .../src/libs/markdown/index.ts | 21 +- .../src/libs/utils/_index.ts | 14 + .../src/libs/utils/index.ts | 21 +- .../src/options/constants.ts | 25 + .../src/options/declarations.ts | 274 ++++----- .../src/options/index.ts | 11 +- .../src/options/maps.ts | 30 + .../src/options/option-maps.ts | 26 - .../src/options/{option-types.ts => types.ts} | 42 +- .../typedoc-plugin-markdown/src/public-api.ts | 18 +- .../src/theme/context/helpers/_index.ts | 18 + .../context/helpers/get-comment-parts.ts | 70 +++ .../helpers/get-declaration-type.ts | 0 .../helpers/get-description-for-reflection.ts | 0 .../helpers/get-flattened-declarations.ts | 0 .../helpers/get-group-index-list.ts | 4 +- .../helpers/get-group-index-table.ts | 18 +- .../helpers/get-group-index.ts | 1 + .../helpers/get-hierarchy-type.ts | 2 +- .../helpers/get-keyword.ts | 0 .../helpers/get-modifier.ts | 0 .../helpers/get-parameter-default-value.ts | 4 +- .../theme/context/helpers/get-project-name.ts | 16 + .../helpers/get-property-default-value.ts | 2 +- .../context/helpers/get-reflection-flags.ts | 24 + .../helpers/get-return-type.ts | 2 +- .../src/theme/context/helpers/index.ts | 12 + .../helpers/is-group-kind.ts | 0 .../theme/context/helpers/use-table.format.ts | 24 + .../src/theme/context/index.ts | 8 + .../src/theme/context/partials/_index.ts | 61 ++ .../partials/comments.comment.ts | 9 +- .../partials/comments.commentParts.ts | 4 +- .../partials/container.body.ts | 2 +- .../partials/container.categories.ts | 4 +- .../partials/container.groups.ts | 28 +- .../partials/container.members.ts | 4 +- .../src/theme/context/partials/index.ts | 19 + .../partials/member.accessor.ts | 6 +- .../partials/member.constructors.ts | 6 +- .../partials/member.container.ts | 9 +- .../partials/member.declaration.ts | 19 +- .../partials/member.declarationTitle.ts | 13 +- .../partials/member.documents.ts | 18 +- .../partials/member.enumMembersTable.ts | 10 +- .../partials/member.hierarchy.ts | 4 +- .../partials/member.indexSignature.ts | 4 +- .../partials/member.inheritance.ts | 4 +- .../partials/member.memberTitle.ts | 6 +- .../partials/member.memberWithGroups.ts | 6 +- .../partials/member.parametersList.ts | 6 +- .../partials/member.parametersTable.ts | 10 +- .../partials/member.propertiesTable.ts | 50 +- .../partials/member.reference.ts | 4 +- .../partials/member.reflectionIndex.ts | 55 ++ .../partials/member.signature.ts | 15 +- .../partials/member.signatureParameters.ts | 4 +- .../partials/member.signatureReturns.ts | 4 +- .../partials/member.signatureTitle.ts | 6 +- .../partials/member.signatures.ts | 6 +- .../partials/member.sources.ts | 8 +- .../{resources => context}/partials/member.ts | 2 +- .../partials/member.typeAndParent.ts | 4 +- .../partials/member.typeArguments.ts | 2 +- .../partials/member.typeDeclaration.ts | 2 +- .../partials/member.typeDeclarationList.ts | 2 +- .../partials/member.typeDeclarationTable.ts | 18 +- .../partials/member.typeParametersList.ts | 4 +- .../partials/member.typeParametersTable.ts | 13 +- .../partials/page.breadcrumbs.ts | 18 +- .../src/theme/context/partials/page.footer.ts | 10 + .../partials/page.header.ts | 34 +- .../partials/page.packagesIndex.ts | 10 +- .../theme/context/partials/page.pageTitle.ts | 25 + .../partials/type.array.ts | 2 +- .../partials/type.conditional.ts | 4 +- .../partials/type.index-access.ts | 2 +- .../partials/type.inferred.ts | 4 +- .../partials/type.intersection.ts | 2 +- .../partials/type.intrinsic.ts | 4 +- .../partials/type.literal.ts | 2 +- .../partials/type.named-tuple.ts | 2 +- .../partials/type.query.ts | 4 +- .../partials/type.reference.ts | 4 +- .../partials/type.reflection.declaration.ts | 11 +- .../partials/type.reflection.function.ts | 4 +- .../partials/type.reflection.ts | 4 +- .../partials/type.some.ts | 4 +- .../partials/type.tuple.ts | 2 +- .../partials/type.type-operator.ts | 2 +- .../partials/type.union.ts | 2 +- .../partials/type.unknown.ts | 4 +- .../index.ts => context/resources.ts} | 362 ++++++------ .../src/theme/context/templates/_index.ts | 5 + .../templates/document.ts | 4 +- .../src/theme/context/templates/index.ts | 8 + .../templates/project.ts | 24 +- .../templates/read-me.ts | 4 +- .../templates/reflection.ts | 6 +- .../src/theme/core/index.ts | 7 + .../src/theme/core/navigation-builder.ts | 11 +- .../src/theme/core/url-builder.ts | 35 +- .../src/theme/index.ts | 13 +- ...mecontext.ts => markdown-theme-context.ts} | 55 +- .../src/theme/markdown-theme.ts | 43 +- .../partials/member.reflectionFlags.ts | 33 -- .../partials/member.reflectionIndex.ts | 81 --- .../theme/resources/partials/page.footer.ts | 9 - .../resources/partials/page.pageTitle.ts | 25 - .../src/theme/{theme-types.ts => types.ts} | 7 +- .../test/fixtures/config.ts | 42 +- .../test/fixtures/src/comments/index.ts | 13 +- .../fixtures/src/reflections/functions.ts | 2 - .../test/fixtures/typedoc.text-locales.cjs | 19 + ...-options.cjs => typedoc.text-mappings.cjs} | 17 +- .../specs/__snapshots__/comments.spec.ts.snap | 131 ++++- .../specs/__snapshots__/groups.spec.ts.snap | 82 ++- .../__snapshots__/navigation.spec.ts.snap | 116 +++- .../objects-and-params.spec.ts.snap | 70 +-- .../specs/__snapshots__/packages.spec.ts.snap | 24 - .../specs/__snapshots__/readme.spec.ts.snap | 6 +- .../reflection.class.spec.ts.snap | 30 +- .../reflection.function.spec.ts.snap | 16 +- .../reflection.interface.spec.ts.snap | 12 +- .../reflection.variable.spec.ts.snap | 46 +- .../specs/__snapshots__/text.spec.ts.snap | 67 ++- .../specs/__snapshots__/urls.spec.ts.snap | 28 + .../test/specs/comments.spec.ts | 4 + .../test/specs/text.spec.ts | 8 +- .../typedoc-plugin-markdown/tsconfig.json | 10 +- packages/typedoc-plugin-markdown/typedoc.json | 22 + typedoc.base.json | 1 + typedoc.html.json | 13 + typedoc.json | 25 + 208 files changed, 4222 insertions(+), 2481 deletions(-) rename .eslintrc => .eslintrc.json (100%) delete mode 100644 docs/pages/docs/CHANGELOG.md rename docs/pages/docs/{migration-guide.mdx => changelog/4.0.mdx} (85%) create mode 100644 docs/pages/docs/changelog/4.1.mdx create mode 100644 docs/pages/docs/changelog/_meta.js create mode 100644 docs/pages/docs/internationalization.mdx create mode 100644 docs/pages/docs/options/display options-options.mdx create mode 100644 docs/pages/docs/options/file options-options.mdx create mode 100644 docs/pages/docs/options/utility options-options.mdx create mode 100644 packages/typedoc-plugin-markdown/.docs/plugins/typedoc-default-values.js delete mode 100644 packages/typedoc-plugin-markdown/.docs/plugins/typedoc-symbol-resolver.mjs create mode 100644 packages/typedoc-plugin-markdown/.docs/typedoc.dev.json create mode 100644 packages/typedoc-plugin-markdown/.docs/typedoc.html.json delete mode 100644 packages/typedoc-plugin-markdown/.scripts/prebuild-kinds.ts create mode 100644 packages/typedoc-plugin-markdown/DEVELOP.md create mode 100644 packages/typedoc-plugin-markdown/OPTIONS.md create mode 100644 packages/typedoc-plugin-markdown/barrelsby.config.json rename packages/typedoc-plugin-markdown/src/{defs/typedoc.d.ts => _typedoc.d.ts} (74%) create mode 100644 packages/typedoc-plugin-markdown/src/app/_initialize.ts delete mode 100644 packages/typedoc-plugin-markdown/src/app/application.ts create mode 100644 packages/typedoc-plugin-markdown/src/app/index.ts rename packages/typedoc-plugin-markdown/src/app/{renderer/overrides.ts => renderer.ts} (76%) delete mode 100644 packages/typedoc-plugin-markdown/src/app/renderer/index.ts delete mode 100644 packages/typedoc-plugin-markdown/src/app/renderer/packages.ts delete mode 100644 packages/typedoc-plugin-markdown/src/app/translatable.ts create mode 100644 packages/typedoc-plugin-markdown/src/app/types/index.ts create mode 100644 packages/typedoc-plugin-markdown/src/app/types/markdown-application.ts rename packages/typedoc-plugin-markdown/src/app/{renderer => types}/markdown-renderer-hooks.ts (91%) create mode 100644 packages/typedoc-plugin-markdown/src/app/types/markdown-renderer.ts create mode 100644 packages/typedoc-plugin-markdown/src/internationalization/index.ts create mode 100644 packages/typedoc-plugin-markdown/src/internationalization/locales/en.ts create mode 100644 packages/typedoc-plugin-markdown/src/internationalization/locales/index.ts create mode 100644 packages/typedoc-plugin-markdown/src/internationalization/locales/ko.ts create mode 100644 packages/typedoc-plugin-markdown/src/internationalization/translatable.ts create mode 100644 packages/typedoc-plugin-markdown/src/internationalization/types.ts create mode 100644 packages/typedoc-plugin-markdown/src/libs/index.ts create mode 100644 packages/typedoc-plugin-markdown/src/libs/markdown/_index.ts create mode 100644 packages/typedoc-plugin-markdown/src/libs/utils/_index.ts create mode 100644 packages/typedoc-plugin-markdown/src/options/constants.ts create mode 100644 packages/typedoc-plugin-markdown/src/options/maps.ts delete mode 100644 packages/typedoc-plugin-markdown/src/options/option-maps.ts rename packages/typedoc-plugin-markdown/src/options/{option-types.ts => types.ts} (84%) create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/helpers/_index.ts create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/helpers/get-comment-parts.ts rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/helpers/get-declaration-type.ts (100%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/helpers/get-description-for-reflection.ts (100%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/helpers/get-flattened-declarations.ts (100%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/helpers/get-group-index-list.ts (84%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/helpers/get-group-index-table.ts (67%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/helpers/get-group-index.ts (86%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/helpers/get-hierarchy-type.ts (85%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/helpers/get-keyword.ts (100%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/helpers/get-modifier.ts (100%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/helpers/get-parameter-default-value.ts (53%) create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/helpers/get-project-name.ts rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/helpers/get-property-default-value.ts (88%) create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/helpers/get-reflection-flags.ts rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/helpers/get-return-type.ts (90%) create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/helpers/index.ts rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/helpers/is-group-kind.ts (100%) create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/helpers/use-table.format.ts create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/index.ts create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/partials/_index.ts rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/comments.comment.ts (88%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/comments.commentParts.ts (94%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/container.body.ts (96%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/container.categories.ts (87%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/container.groups.ts (74%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/container.members.ts (88%) create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/partials/index.ts rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.accessor.ts (92%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.constructors.ts (78%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.container.ts (79%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.declaration.ts (92%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.declarationTitle.ts (86%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.documents.ts (57%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.enumMembersTable.ts (89%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.hierarchy.ts (91%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.indexSignature.ts (85%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.inheritance.ts (91%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.memberTitle.ts (87%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.memberWithGroups.ts (93%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.parametersList.ts (92%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.parametersTable.ts (92%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.propertiesTable.ts (83%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.reference.ts (90%) create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/partials/member.reflectionIndex.ts rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.signature.ts (87%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.signatureParameters.ts (91%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.signatureReturns.ts (93%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.signatureTitle.ts (88%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.signatures.ts (89%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.sources.ts (74%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.ts (95%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.typeAndParent.ts (91%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.typeArguments.ts (90%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.typeDeclaration.ts (91%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.typeDeclarationList.ts (91%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.typeDeclarationTable.ts (87%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.typeParametersList.ts (88%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/member.typeParametersTable.ts (81%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/page.breadcrumbs.ts (79%) create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/partials/page.footer.ts rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/page.header.ts (84%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/page.packagesIndex.ts (88%) create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/partials/page.pageTitle.ts rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.array.ts (85%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.conditional.ts (86%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.index-access.ts (88%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.inferred.ts (67%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.intersection.ts (84%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.intrinsic.ts (66%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.literal.ts (84%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.named-tuple.ts (81%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.query.ts (70%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.reference.ts (89%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.reflection.declaration.ts (88%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.reflection.function.ts (92%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.reflection.ts (84%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.some.ts (94%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.tuple.ts (83%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.type-operator.ts (82%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.union.ts (89%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/partials/type.unknown.ts (66%) rename packages/typedoc-plugin-markdown/src/theme/{resources/index.ts => context/resources.ts} (53%) create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/templates/_index.ts rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/templates/document.ts (83%) create mode 100644 packages/typedoc-plugin-markdown/src/theme/context/templates/index.ts rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/templates/project.ts (75%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/templates/read-me.ts (86%) rename packages/typedoc-plugin-markdown/src/theme/{resources => context}/templates/reflection.ts (87%) create mode 100644 packages/typedoc-plugin-markdown/src/theme/core/index.ts rename packages/typedoc-plugin-markdown/src/theme/{markdown-themecontext.ts => markdown-theme-context.ts} (63%) delete mode 100644 packages/typedoc-plugin-markdown/src/theme/resources/partials/member.reflectionFlags.ts delete mode 100644 packages/typedoc-plugin-markdown/src/theme/resources/partials/member.reflectionIndex.ts delete mode 100644 packages/typedoc-plugin-markdown/src/theme/resources/partials/page.footer.ts delete mode 100644 packages/typedoc-plugin-markdown/src/theme/resources/partials/page.pageTitle.ts rename packages/typedoc-plugin-markdown/src/theme/{theme-types.ts => types.ts} (83%) create mode 100644 packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-locales.cjs rename packages/typedoc-plugin-markdown/test/fixtures/{typedoc.text-options.cjs => typedoc.text-mappings.cjs} (59%) create mode 100644 packages/typedoc-plugin-markdown/typedoc.json create mode 100644 typedoc.base.json create mode 100644 typedoc.html.json create mode 100644 typedoc.json diff --git a/.eslintrc b/.eslintrc.json similarity index 100% rename from .eslintrc rename to .eslintrc.json diff --git a/.gitignore b/.gitignore index 872c3c9ae..048aaf52e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ samples out typedoc-examples html -/devdocs +devdocs /devdocs-html # dependencies diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1f4defceb..6b764db0a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,15 @@ # Contributing Guide -Coming soon. +Thank you for showing interest in contributing to this project. This guide provides some basic guidelines for doing so. + +## Overview + +This project attempts to align with TypeDoc core as much as possible. Before you start, you might find it helpful to read the [TypeDoc development guide]() to understand the architecture of TypeDoc itself. + +## Developers Guide + +Please visit the [developers guide](./devdocs/README.md) (created by this plugin) for to start developing. + +## Credits + +Thank you to all the people who have already contributed to typedoc-plugin-markdown. diff --git a/devtools/packages/fixtures/typedoc.cjs b/devtools/packages/fixtures/typedoc.cjs index 3b9925aab..a01312618 100644 --- a/devtools/packages/fixtures/typedoc.cjs +++ b/devtools/packages/fixtures/typedoc.cjs @@ -15,4 +15,9 @@ module.exports = { navigation: { includeGroups: true, }, + locales: { + en: { + theme_defined_in: 'Source', + }, + }, }; diff --git a/devtools/packages/helpers/constants.ts b/devtools/packages/helpers/constants.ts index 8e42ba188..c1dc331a6 100644 --- a/devtools/packages/helpers/constants.ts +++ b/devtools/packages/helpers/constants.ts @@ -6,7 +6,7 @@ export const PRESETS_PATH = `${process.cwd()}/src/options/presets.ts`; export const DOCS_CONFIG: Record = { ['typedoc-plugin-markdown']: { declarationsPath: `${process.cwd()}/src/options/declarations.ts`, - translatablePath: `${process.cwd()}/src/app/translatable.ts`, + translatablePath: `${process.cwd()}/src/internationalization/locales/en.ts`, optionsPath: '/docs', docsPath: '/docs', declarations: true, diff --git a/devtools/packages/prebuild-options/tasks/generate-docs.ts b/devtools/packages/prebuild-options/tasks/generate-docs.ts index e576165c3..90da46334 100644 --- a/devtools/packages/prebuild-options/tasks/generate-docs.ts +++ b/devtools/packages/prebuild-options/tasks/generate-docs.ts @@ -160,7 +160,8 @@ ${presetsJson} if ( option.type !== ParameterType.Flags && option.type !== ParameterType.Array && - option.type !== ParameterType.Mixed + option.type !== ParameterType.Mixed && + option.type !== ParameterType.Object ) { meta.push(`Defaults to \`${getDefaultValue(option)}\`.`); } @@ -306,6 +307,9 @@ function getDefaultValue(option) { if (option.type === ParameterType.Mixed) { return JSON.stringify(option.defaultValue); } + if (option.type === ParameterType.Object) { + return JSON.stringify(option.defaultValue); + } return `"${option.defaultValue}"`; } diff --git a/devtools/packages/prebuild-options/tasks/generate-models.ts b/devtools/packages/prebuild-options/tasks/generate-models.ts index 998263387..043a289be 100644 --- a/devtools/packages/prebuild-options/tasks/generate-models.ts +++ b/devtools/packages/prebuild-options/tasks/generate-models.ts @@ -4,10 +4,6 @@ import * as path from 'path'; import * as prettier from 'prettier'; import { DeclarationOption, ParameterType } from 'typedoc'; -/** - * Creates models for plugin options - */ - export async function generateOptionsModels(docsConfig: DocsConfig) { const optionsConfig = await import(docsConfig.declarationsPath as string); @@ -23,7 +19,7 @@ async function writeTypeDocDeclarations( docsConfig: DocsConfig, sortedOptionsConfig: any, ) { - const typedocDeclarationsFile = path.join(SRC_PATH, 'defs', 'typedoc.d.ts'); + const typedocDeclarationsFile = path.join(SRC_PATH, '_typedoc.d.ts'); const manuallyValidatedOptions = Object.entries(sortedOptionsConfig) .filter( @@ -52,11 +48,25 @@ import { ManuallyValidatedOption } from 'typedoc'`); }`); if (docsConfig.translatablePath) { - const { translatable } = await import(docsConfig.translatablePath); out.push(` // eslint-disable-next-line @typescript-eslint/no-namespace export namespace Internationalization { - export interface TranslatableStrings ${getTranslations(translatable)} + export interface TranslatableStrings { + theme_default_value: []; + theme_default_type: []; + theme_description: []; + theme_event: []; + theme_extends: []; + theme_extended_by: []; + theme_member: []; + theme_member_plural: []; + theme_modifier: []; + theme_name: []; + theme_packages: []; + theme_type: []; + theme_value: []; + theme_version: []; + } }`); } out.push(`}`); @@ -78,13 +88,16 @@ async function writeOptionsTypes( option.type === ParameterType.Mixed && option.defaultValue, ); - const optionsOutput = ` - // THIS FILE IS AUTO GENERATED FROM THE OPTIONS CONFIG. DO NOT EDIT DIRECTLY. - + const optionsOutput: string[] = []; + optionsOutput.push(` /** * Describes the options declared by the plugin. * - * @category Options + * @privateRemarks + * + * THIS FILE IS AUTO GENERATED FROM THE OPTIONS CONFIG. DO NOT EDIT DIRECTLY + * + * @module */ export interface PluginOptions { ${(Object.entries(sortedOptionsConfig) as any) @@ -117,14 +130,14 @@ ${name}: ${getType(name, option, true)};`, `; }) .join('\n')} - `; + `); const optionsModelFile = path.join( path.dirname(docsConfig.declarationsPath as string), - 'option-types.ts', + 'types.ts', ); - const formatted = await prettier.format(optionsOutput, { + const formatted = await prettier.format(optionsOutput.join('\n\n'), { parser: 'typescript', singleQuote: true, trailingComma: 'all', @@ -133,15 +146,6 @@ ${name}: ${getType(name, option, true)};`, fs.writeFileSync(optionsModelFile, formatted); } -function getTranslations(inputObject: { [key: string]: string }) { - const output: { [key: string]: string[] } = {}; - for (const [key, value] of Object.entries(inputObject)) { - const matches = value.match(/{\d+}/g) || []; - output[key] = matches.map(() => 'string'); - } - return JSON.stringify(output).replace(/"/g, ''); -} - function getComments(name: string) { if (name === 'textContentMappings') { return 'Describes the keys available to replace static text.'; @@ -208,9 +212,22 @@ function getType( .map((value) => `"${value}"`) .join(' | ')}`; } + if (option.type === ParameterType.Object) { + const outType = `{${Object.keys(option.defaultValue as any) + .map((key) => `'${key}': ${getObjectType(name)};`) + .join('')}}`; + return isInterface ? outType : `ManuallyValidatedOption<${outType}>`; + } return 'any'; } +function getObjectType(name: string) { + if (name === 'reflectionFormats') { + return "'list'|'table'|'htmlTable'"; + } + return 'string'; +} + function capitalize(str: string) { return str.charAt(0).toUpperCase() + str.slice(1); } diff --git a/docs/pages/api-docs/Class.MarkdownPageEvent.md b/docs/pages/api-docs/Class.MarkdownPageEvent.md index 553fa0bcf..66d0eb352 100644 --- a/docs/pages/api-docs/Class.MarkdownPageEvent.md +++ b/docs/pages/api-docs/Class.MarkdownPageEvent.md @@ -20,41 +20,52 @@ export function load(app: MarkdownApplication) { ### project -> **project**: [`ProjectReflection`](https://typedoc.org/api/classes/Models.ProjectReflection.html) +```ts +project: ProjectReflection; +``` -The project the renderer is currently processing. +The [`ProjectReflection`](https://typedoc.org/api/classes/Models.ProjectReflection.html) instance the renderer is currently processing. *** ### model -> `readonly` **model**: `Model` +```ts +readonly model: Model; +``` -The model that should be rendered on this page. +The model that that is being rendered on this page. +Either a [`DeclarationReflection`](https://typedoc.org/api/classes/Models.DeclarationReflection.html) or [`ProjectReflection`](https://typedoc.org/api/classes/Models.ProjectReflection.html). *** ### url -> **url**: `string` +```ts +url: string; +``` -The url this page will be located at. +The url `string` of the page. *** ### filename -> **filename**: `string` +```ts +filename: string; +``` -The filename the page will be written to. +The complete `string` filename where the file will be written.. *** ### contents? -> `optional` **contents**: `string` +```ts +optional contents: string; +``` -The final markdown content of this page. +The final markdown `string` content of the page. Should be rendered by layout templates and can be modified by plugins. @@ -62,7 +73,9 @@ Should be rendered by layout templates and can be modified by plugins. ### frontmatter? -> `optional` **frontmatter**: `Record`\<`string`, `any`\> +```ts +optional frontmatter: Record; +``` The frontmatter of this page represented as a key value object. This property can be utilised by other plugins. @@ -70,7 +83,9 @@ The frontmatter of this page represented as a key value object. This property ca ### BEGIN -> `static` `readonly` **BEGIN**: `"beginPage"` = `'beginPage'` +```ts +static readonly BEGIN: "beginPage" = 'beginPage'; +``` Triggered before a document will be rendered. @@ -78,6 +93,8 @@ Triggered before a document will be rendered. ### END -> `static` `readonly` **END**: `"endPage"` = `'endPage'` +```ts +static readonly END: "endPage" = 'endPage'; +``` Triggered after a document has been rendered, just before it is written to disc. diff --git a/docs/pages/api-docs/Class.MarkdownRendererEvent.md b/docs/pages/api-docs/Class.MarkdownRendererEvent.md index be21c5003..0ffa47528 100644 --- a/docs/pages/api-docs/Class.MarkdownRendererEvent.md +++ b/docs/pages/api-docs/Class.MarkdownRendererEvent.md @@ -18,7 +18,9 @@ app.renderer.on(MarkdownRendererEvent.BEGIN, (event) => { ### project -> `readonly` **project**: [`ProjectReflection`](https://typedoc.org/api/classes/Models.ProjectReflection.html) +```ts +readonly project: ProjectReflection; +``` The project the renderer is currently processing. @@ -26,7 +28,9 @@ The project the renderer is currently processing. ### outputDirectory -> `readonly` **outputDirectory**: `string` +```ts +readonly outputDirectory: string; +``` The path of the directory the documentation should be written to. @@ -34,7 +38,9 @@ The path of the directory the documentation should be written to. ### urls? -> `optional` **urls**: [`UrlMapping`](/api-docs/Interface.UrlMapping.md)\<[`Reflection`](https://typedoc.org/api/classes/Models.Reflection.html)\>[] +```ts +optional urls: UrlMapping[]; +``` A list of all pages that should be generated. @@ -42,7 +48,9 @@ A list of all pages that should be generated. ### navigation? -> `optional` **navigation**: [`NavigationItem`](/api-docs/Interface.NavigationItem.md)[] +```ts +optional navigation: NavigationItem[]; +``` The navigation structure of the project that can be utilised by plugins. @@ -50,7 +58,9 @@ The navigation structure of the project that can be utilised by plugins. ### BEGIN -> `static` `readonly` **BEGIN**: `"beginRender"` = `'beginRender'` +```ts +static readonly BEGIN: "beginRender" = 'beginRender'; +``` Triggered before the renderer starts rendering a project. @@ -58,6 +68,8 @@ Triggered before the renderer starts rendering a project. ### END -> `static` `readonly` **END**: `"endRender"` = `'endRender'` +```ts +static readonly END: "endRender" = 'endRender'; +``` Triggered after the renderer has written all documents. diff --git a/docs/pages/api-docs/Class.MarkdownTheme.md b/docs/pages/api-docs/Class.MarkdownTheme.md index 8855ff51b..b6764e07f 100644 --- a/docs/pages/api-docs/Class.MarkdownTheme.md +++ b/docs/pages/api-docs/Class.MarkdownTheme.md @@ -24,11 +24,37 @@ class MyMarkdownTheme extends MarkdownTheme { - [`Theme`](https://typedoc.org/api/classes/Theme.html) +## Constructors + +### new MarkdownTheme() + +```ts +new MarkdownTheme(owner): MarkdownTheme +``` + +Create new Component instance. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `owner` | [`Renderer`](https://typedoc.org/api/classes/Renderer.html) | + +#### Returns + +[`MarkdownTheme`](/api-docs/Class.MarkdownTheme.md) + +#### Inherited from + +`Theme.constructor` + ## Methods ### getRenderContext() -> **getRenderContext**(`page`): [`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md) +```ts +getRenderContext(page): MarkdownThemeContext +``` Creates a new instance of the current theme context. @@ -48,7 +74,9 @@ This method can be overridden to provide an alternative theme context. ### getUrls() -> **getUrls**(`project`): [`UrlMapping`](/api-docs/Interface.UrlMapping.md)\<[`Reflection`](https://typedoc.org/api/classes/Models.Reflection.html)\>[] +```ts +getUrls(project): UrlMapping[] +``` Maps the models of the given project to the desired output files. @@ -72,7 +100,9 @@ This method can be overriden to provide an alternative url structure. ### getNavigation() -> **getNavigation**(`project`): [`NavigationItem`](/api-docs/Interface.NavigationItem.md)[] +```ts +getNavigation(project): NavigationItem[] +``` Map the models of the given project to a navigation structure. diff --git a/docs/pages/api-docs/Class.MarkdownThemeContext.md b/docs/pages/api-docs/Class.MarkdownThemeContext.md index 747790ce5..99302f22f 100644 --- a/docs/pages/api-docs/Class.MarkdownThemeContext.md +++ b/docs/pages/api-docs/Class.MarkdownThemeContext.md @@ -4,7 +4,7 @@ The theme context class that is provided as context on the rendering of every pa It is heavily influenced by the equivalent [DefaultThemeRenderContext](https://typedoc.org/api/classes/DefaultThemeRenderContext.html) from the default theme. -This class can be used to customize the theme output by extending the class and overriding the [templates](#templates), [partials](#partials) and [helpers](#helpers). +This class can be used to customize the theme output by extending the class and overriding the templates, partials and helpers. ## Usage @@ -20,7 +20,12 @@ class MyMarkdownTheme extends MarkdownTheme { ### new MarkdownThemeContext() -> **new MarkdownThemeContext**(`theme`, `page`, `options`): [`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md) +```ts +new MarkdownThemeContext( + theme, + page, + options): MarkdownThemeContext +``` #### Parameters @@ -40,19 +45,25 @@ Properties are passed into the constructor and are used to provide context to th ### internationalization -> **internationalization**: `Internationalization` +```ts +internationalization: Internationalization; +``` *** ### i18n -> **i18n**: `TranslationProxy` +```ts +i18n: TranslationProxy; +``` *** ### page -> `readonly` **page**: [`MarkdownPageEvent`](/api-docs/Class.MarkdownPageEvent.md)\<[`Reflection`](https://typedoc.org/api/classes/Models.Reflection.html)\> +```ts +readonly page: MarkdownPageEvent; +``` The current page event. @@ -60,7 +71,9 @@ The current page event. ### options -> `readonly` **options**: [`Options`](https://typedoc.org/api/classes/Configuration.Options.html) +```ts +readonly options: Options; +``` The options provided to the application. @@ -70,7 +83,9 @@ General context aware helper methods not bound to any specific models that can b ### getPackageMetaData() -> **getPackageMetaData**(`packageName`): [`PackageMetaData`](/api-docs/Interface.PackageMetaData.md) +```ts +getPackageMetaData(packageName): PackageMetaData +``` Returns the package meta data for a given package name when entrypointStrategy is set to `packages`. @@ -88,7 +103,9 @@ Returns the package meta data for a given package name when entrypointStrategy i ### getRelativeUrl() -> **getRelativeUrl**(`url`, `ignorePublicPath`): `string` +```ts +getRelativeUrl(url, ignorePublicPath): string +``` Returns the relative URL (from the current page context url). @@ -96,10 +113,10 @@ If public path is set, it will be used as the base URL. #### Parameters -| Parameter | Type | Default Value | Description | -| :------ | :------ | :------ | :------ | -| `url` | `string` | `undefined` | The URL to make relative. | -| `ignorePublicPath` | `boolean` | `false` | Whether to ignore the public path. | +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `url` | `string` | The URL to make relative. | +| `ignorePublicPath` | `boolean` | Whether to ignore the public path. | #### Returns @@ -111,7 +128,14 @@ Theme resources are the main building blocks for the theme context. They are spl ### templates -> **templates**: `object` +```ts +templates: { + document: (page) => string; + project: (page) => string; + readme: (page) => string; + reflection: (page) => string; +}; +``` Then `templates` namespace holds the main templates for the theme and are mapped to single pages and configured in the MarkdownTheme. @@ -119,7 +143,9 @@ All templates return a string that is passed back to the renderer. Internally te #### document() -> **document**: (`page`) => `string` +```ts +document: (page) => string; +``` Template that maps to a project document. @@ -135,7 +161,9 @@ Template that maps to a project document. #### project() -> **project**: (`page`) => `string` +```ts +project: (page) => string; +``` Template that maps to the root project reflection. This will be the index page / documentation root page. @@ -151,7 +179,9 @@ Template that maps to the root project reflection. This will be the index page / #### readme() -> **readme**: (`page`) => `string` +```ts +readme: (page) => string; +``` Template that specifically maps to the resolved readme file. This template is not used when 'readme' is set to 'none'. @@ -167,7 +197,9 @@ Template that specifically maps to the resolved readme file. This template is no #### reflection() -> **reflection**: (`page`) => `string` +```ts +reflection: (page) => string; +``` Template that maps to individual reflection models. @@ -185,7 +217,70 @@ Template that maps to individual reflection models. ### partials -> **partials**: `object` +```ts +partials: { + comment: (model, options) => string; + commentParts: (model) => string; + body: (model, options) => string; + categories: (model, options) => string; + groups: (model, options) => string; + members: (model, options) => string; + accessor: (model, options) => string; + constructor: (model, options) => string; + memberContainer: (model, options) => string; + declaration: (model, options) => string; + declarationTitle: (model) => string; + documents: (model, options) => string; + enumMembersTable: (model) => string; + hierarchy: (model, options) => string; + indexSignature: (model) => string; + inheritance: (model, options) => string; + memberTitle: (model) => string; + memberWithGroups: (model, options) => string; + parametersList: (model) => string; + parametersTable: (model) => string; + propertiesTable: (model, options?) => string; + referenceMember: (model) => string; + reflectionIndex: (model, options) => string; + signature: (model, options) => string; + signatureParameters: (model) => string; + signatureReturns: (model, options) => string; + signatureTitle: (model, options?) => string; + signatures: (model, options) => string; + sources: (model, options) => string; + member: (model, options) => string; + typeAndParent: (model) => string; + typeArguments: (model, options?) => string; + typeDeclaration: (model, options) => string; + typeDeclarationList: (model, headingLevel) => string; + typeDeclarationTable: (model) => string; + typeParametersList: (model) => string; + typeParametersTable: (model) => string; + breadcrumbs: () => string; + footer: () => string; + header: () => string; + packagesIndex: (model) => string; + pageTitle: () => string; + arrayType: (model) => string; + conditionalType: (model) => string; + indexAccessType: (model) => string; + inferredType: (model) => string; + intersectionType: (model) => string; + intrinsicType: (model) => string; + literalType: (model) => string; + namedTupleType: (model) => string; + queryType: (model) => string; + referenceType: (model) => string; + declarationType: (model) => string; + functionType: (model, options?) => string; + reflectionType: (model, options?) => string; + someType: (model?) => string; + tupleType: (model) => string; + typeOperatorType: (model) => string; + unionType: (model) => string; + unknownType: (model) => string; +}; +``` The `partials` namespace holds the partials for the theme and are used by templates to map speficic models to page output. @@ -197,17 +292,19 @@ Please note that partials:: Partials are categorised by their use: -- [Page Partials](#page-partials): Partials that render core page elements such as header and breadcrumbs. -- [Container Partials](#container-partials): Partials that are used to render reflection groups and categories. -- [Member Partials](#member-partials): Partials that render specific parts of reflections. -- [Comment Partials](#comment-partials): Partials that render comments. -- [Type Partials](#type-partials): Partials that render specific TypeDoc model types. +- Page Partials: Partials that render core page elements such as header and breadcrumbs. +- Container Partials: Partials that are used to render reflection groups and categories. +- Member Partials: Partials that render specific parts of reflections. +- Comment Partials: Partials that render comments. +- Type Partials: Partials that render specific TypeDoc model types. #### Page Partials ##### breadcrumbs() -> **breadcrumbs**: () => `string` +```ts +breadcrumbs: () => string; +``` ###### Returns @@ -215,7 +312,9 @@ Partials are categorised by their use: ##### footer() -> **footer**: () => `string` +```ts +footer: () => string; +``` ###### Returns @@ -223,7 +322,9 @@ Partials are categorised by their use: ##### header() -> **header**: () => `string` +```ts +header: () => string; +``` ###### Returns @@ -231,7 +332,9 @@ Partials are categorised by their use: ##### packagesIndex() -> **packagesIndex**: (`model`) => `string` +```ts +packagesIndex: (model) => string; +``` ###### Parameters @@ -245,7 +348,9 @@ Partials are categorised by their use: ##### pageTitle() -> **pageTitle**: () => `string` +```ts +pageTitle: () => string; +``` ###### Returns @@ -255,7 +360,9 @@ Partials are categorised by their use: ##### body() -> **body**: (`model`, `options`) => `string` +```ts +body: (model, options) => string; +``` ###### Parameters @@ -271,7 +378,9 @@ Partials are categorised by their use: ##### categories() -> **categories**: (`model`, `options`) => `string` +```ts +categories: (model, options) => string; +``` Renders a collection of reflection categories. @@ -289,7 +398,9 @@ Renders a collection of reflection categories. ##### groups() -> **groups**: (`model`, `options`) => `string` +```ts +groups: (model, options) => string; +``` Renders a collection of reflection groups. @@ -307,7 +418,9 @@ Renders a collection of reflection groups. ##### members() -> **members**: (`model`, `options`) => `string` +```ts +members: (model, options) => string; +``` Renders a collection of members. @@ -327,7 +440,9 @@ Renders a collection of members. ##### accessor() -> **accessor**: (`model`, `options`) => `string` +```ts +accessor: (model, options) => string; +``` Renders an accessor member. @@ -345,7 +460,9 @@ Renders an accessor member. ##### constructor() -> **constructor**: (`model`, `options`) => `string` +```ts +constructor: (model, options) => string; +``` Renders an constructor member. @@ -363,7 +480,9 @@ Renders an constructor member. ##### memberContainer() -> **memberContainer**: (`model`, `options`) => `string` +```ts +memberContainer: (model, options) => string; +``` ###### Parameters @@ -380,7 +499,9 @@ Renders an constructor member. ##### declaration() -> **declaration**: (`model`, `options`) => `string` +```ts +declaration: (model, options) => string; +``` Renders a standard declaration member. @@ -399,7 +520,9 @@ Renders a standard declaration member. ##### declarationTitle() -> **declarationTitle**: (`model`) => `string` +```ts +declarationTitle: (model) => string; +``` ###### Parameters @@ -413,7 +536,9 @@ Renders a standard declaration member. ##### documents() -> **documents**: (`model`, `options`) => `string` +```ts +documents: (model, options) => string; +``` ###### Parameters @@ -429,7 +554,9 @@ Renders a standard declaration member. ##### enumMembersTable() -> **enumMembersTable**: (`model`) => `string` +```ts +enumMembersTable: (model) => string; +``` Renders enum members as a table. @@ -445,7 +572,9 @@ Renders enum members as a table. ##### hierarchy() -> **hierarchy**: (`model`, `options`) => `string` +```ts +hierarchy: (model, options) => string; +``` ###### Parameters @@ -461,7 +590,9 @@ Renders enum members as a table. ##### indexSignature() -> **indexSignature**: (`model`) => `string` +```ts +indexSignature: (model) => string; +``` Renders an index signature block @@ -477,7 +608,9 @@ Renders an index signature block ##### inheritance() -> **inheritance**: (`model`, `options`) => `string` +```ts +inheritance: (model, options) => string; +``` Renders an inheritance section. @@ -495,7 +628,9 @@ Renders an inheritance section. ##### memberTitle() -> **memberTitle**: (`model`) => `string` +```ts +memberTitle: (model) => string; +``` Renders the main member title. @@ -511,7 +646,9 @@ Renders the main member title. ##### memberWithGroups() -> **memberWithGroups**: (`model`, `options`) => `string` +```ts +memberWithGroups: (model, options) => string; +``` Renders a top-level member that contains group and child members such as Classes, Interfaces and Enums. @@ -529,7 +666,9 @@ Renders a top-level member that contains group and child members such as Classes ##### parametersList() -> **parametersList**: (`model`) => `string` +```ts +parametersList: (model) => string; +``` ###### Parameters @@ -543,7 +682,9 @@ Renders a top-level member that contains group and child members such as Classes ##### parametersTable() -> **parametersTable**: (`model`) => `string` +```ts +parametersTable: (model) => string; +``` ###### Parameters @@ -555,9 +696,11 @@ Renders a top-level member that contains group and child members such as Classes `string` -##### declarationsTable() +##### propertiesTable() -> **declarationsTable**: (`model`, `options`?) => `string` +```ts +propertiesTable: (model, options?) => string; +``` Renders a collection of properties in a table. @@ -577,7 +720,9 @@ There is no association list partial for properties as these are handled as a st ##### referenceMember() -> **referenceMember**: (`model`) => `string` +```ts +referenceMember: (model) => string; +``` Renders an reference member. @@ -591,25 +736,11 @@ Renders an reference member. `string` -##### reflectionFlags() - -> **reflectionFlags**: (`model`) => `string` - -Renders the flags of a reflection. - -###### Parameters - -| Parameter | Type | -| :------ | :------ | -| `model` | [`Reflection`](https://typedoc.org/api/classes/Models.Reflection.html) | - -###### Returns - -`string` - ##### reflectionIndex() -> **reflectionIndex**: (`model`, `options`) => `string` +```ts +reflectionIndex: (model, options) => string; +``` ###### Parameters @@ -625,7 +756,9 @@ Renders the flags of a reflection. ##### signature() -> **signature**: (`model`, `options`) => `string` +```ts +signature: (model, options) => string; +``` Renders a signature member. @@ -646,7 +779,9 @@ Renders a signature member. ##### signatureParameters() -> **signatureParameters**: (`model`) => `string` +```ts +signatureParameters: (model) => string; +``` ###### Parameters @@ -660,7 +795,9 @@ Renders a signature member. ##### signatureReturns() -> **signatureReturns**: (`model`, `options`) => `string` +```ts +signatureReturns: (model, options) => string; +``` ###### Parameters @@ -676,7 +813,9 @@ Renders a signature member. ##### signatureTitle() -> **signatureTitle**: (`model`, `options`?) => `string` +```ts +signatureTitle: (model, options?) => string; +``` ###### Parameters @@ -693,7 +832,9 @@ Renders a signature member. ##### signatures() -> **signatures**: (`model`, `options`) => `string` +```ts +signatures: (model, options) => string; +``` Renders a signature collection. @@ -712,7 +853,9 @@ Renders a signature collection. ##### sources() -> **sources**: (`model`, `options`) => `string` +```ts +sources: (model, options) => string; +``` ###### Parameters @@ -728,7 +871,9 @@ Renders a signature collection. ##### member() -> **member**: (`model`, `options`) => `string` +```ts +member: (model, options) => string; +``` ###### Parameters @@ -745,7 +890,9 @@ Renders a signature collection. ##### typeAndParent() -> **typeAndParent**: (`model`) => `string` +```ts +typeAndParent: (model) => string; +``` ###### Parameters @@ -759,7 +906,9 @@ Renders a signature collection. ##### typeArguments() -> **typeArguments**: (`model`, `options`?) => `string` +```ts +typeArguments: (model, options?) => string; +``` ###### Parameters @@ -775,7 +924,9 @@ Renders a signature collection. ##### typeDeclaration() -> **typeDeclaration**: (`model`, `options`) => `string` +```ts +typeDeclaration: (model, options) => string; +``` ###### Parameters @@ -791,7 +942,9 @@ Renders a signature collection. ##### typeDeclarationList() -> **typeDeclarationList**: (`model`, `headingLevel`) => `string` +```ts +typeDeclarationList: (model, headingLevel) => string; +``` ###### Parameters @@ -806,7 +959,9 @@ Renders a signature collection. ##### typeDeclarationTable() -> **typeDeclarationTable**: (`model`) => `string` +```ts +typeDeclarationTable: (model) => string; +``` ###### Parameters @@ -820,7 +975,9 @@ Renders a signature collection. ##### typeParametersList() -> **typeParametersList**: (`model`) => `string` +```ts +typeParametersList: (model) => string; +``` ###### Parameters @@ -834,7 +991,9 @@ Renders a signature collection. ##### typeParametersTable() -> **typeParametersTable**: (`model`) => `string` +```ts +typeParametersTable: (model) => string; +``` ###### Parameters @@ -850,7 +1009,9 @@ Renders a signature collection. ##### comment() -> **comment**: (`model`, `options`) => `string` +```ts +comment: (model, options) => string; +``` ###### Parameters @@ -869,7 +1030,9 @@ Renders a signature collection. ##### commentParts() -> **commentParts**: (`model`) => `string` +```ts +commentParts: (model) => string; +``` ###### Parameters @@ -885,7 +1048,9 @@ Renders a signature collection. ##### arrayType() -> **arrayType**: (`model`) => `string` +```ts +arrayType: (model) => string; +``` ###### Parameters @@ -899,7 +1064,9 @@ Renders a signature collection. ##### conditionalType() -> **conditionalType**: (`model`) => `string` +```ts +conditionalType: (model) => string; +``` ###### Parameters @@ -913,7 +1080,9 @@ Renders a signature collection. ##### indexAccessType() -> **indexAccessType**: (`model`) => `string` +```ts +indexAccessType: (model) => string; +``` ###### Parameters @@ -927,7 +1096,9 @@ Renders a signature collection. ##### inferredType() -> **inferredType**: (`model`) => `string` +```ts +inferredType: (model) => string; +``` ###### Parameters @@ -941,7 +1112,9 @@ Renders a signature collection. ##### intersectionType() -> **intersectionType**: (`model`) => `string` +```ts +intersectionType: (model) => string; +``` ###### Parameters @@ -955,7 +1128,9 @@ Renders a signature collection. ##### intrinsicType() -> **intrinsicType**: (`model`) => `string` +```ts +intrinsicType: (model) => string; +``` ###### Parameters @@ -969,7 +1144,9 @@ Renders a signature collection. ##### literalType() -> **literalType**: (`model`) => `string` +```ts +literalType: (model) => string; +``` ###### Parameters @@ -983,7 +1160,9 @@ Renders a signature collection. ##### namedTupleType() -> **namedTupleType**: (`model`) => `string` +```ts +namedTupleType: (model) => string; +``` ###### Parameters @@ -997,7 +1176,9 @@ Renders a signature collection. ##### queryType() -> **queryType**: (`model`) => `string` +```ts +queryType: (model) => string; +``` ###### Parameters @@ -1011,7 +1192,9 @@ Renders a signature collection. ##### referenceType() -> **referenceType**: (`model`) => `string` +```ts +referenceType: (model) => string; +``` ###### Parameters @@ -1025,7 +1208,9 @@ Renders a signature collection. ##### declarationType() -> **declarationType**: (`model`) => `string` +```ts +declarationType: (model) => string; +``` ###### Parameters @@ -1039,7 +1224,9 @@ Renders a signature collection. ##### functionType() -> **functionType**: (`model`, `options`?) => `string` +```ts +functionType: (model, options?) => string; +``` ###### Parameters @@ -1055,7 +1242,9 @@ Renders a signature collection. ##### reflectionType() -> **reflectionType**: (`model`, `options`?) => `string` +```ts +reflectionType: (model, options?) => string; +``` ###### Parameters @@ -1071,7 +1260,9 @@ Renders a signature collection. ##### someType() -> **someType**: (`model`?) => `string` +```ts +someType: (model?) => string; +``` Takes a generic Type and returns the appropriate partial for it. @@ -1087,7 +1278,9 @@ Takes a generic Type and returns the appropriate partial for it. ##### tupleType() -> **tupleType**: (`model`) => `string` +```ts +tupleType: (model) => string; +``` ###### Parameters @@ -1101,7 +1294,9 @@ Takes a generic Type and returns the appropriate partial for it. ##### typeOperatorType() -> **typeOperatorType**: (`model`) => `string` +```ts +typeOperatorType: (model) => string; +``` ###### Parameters @@ -1115,7 +1310,9 @@ Takes a generic Type and returns the appropriate partial for it. ##### unionType() -> **unionType**: (`model`) => `string` +```ts +unionType: (model) => string; +``` ###### Parameters @@ -1129,7 +1326,9 @@ Takes a generic Type and returns the appropriate partial for it. ##### unknownType() -> **unknownType**: (`model`) => `string` +```ts +unknownType: (model) => string; +``` ###### Parameters @@ -1145,7 +1344,27 @@ Takes a generic Type and returns the appropriate partial for it. ### helpers -> **helpers**: `object` +```ts +helpers: { + getCommentParts: (model) => string; + getDeclarationType: (model) => undefined | SomeType; + getDescriptionForReflection: (model) => null | string; + getFlattenedDeclarations: (model, options?) => DeclarationReflection[]; + getGroupIndexList: (children) => string; + getGroupIndexTable: (children) => string; + getGroupIndex: (group) => any; + getHierarchyType: (model, options?) => string; + getKeyword: (model) => string; + getModifier: (model) => null | string; + getParameterDefaultValue: (model) => string; + getProjectName: (stringWithPlaceholders, page) => string; + getPropertyDefaultValue: (model) => null | string; + getReflectionFlags: (reflection) => string[]; + getReturnType: (model?) => string; + isGroupKind: (model) => boolean; + useTableFormat: (key) => boolean; +}; +``` The `helpers` namespace holds the helpers for the theme and are smaller utility functions that return snippets or text or other data transformations. @@ -1155,9 +1374,27 @@ Please note that partials: - Can reference other helpers but should not reference partials. - Can return strings or other models. +#### getCommentParts() + +```ts +getCommentParts: (model) => string; +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | [`CommentDisplayPart`](https://typedoc.org/api/types/Models.CommentDisplayPart.html)[] | + +##### Returns + +`string` + #### getDeclarationType() -> **getDeclarationType**: (`model`) => `undefined` \| [`SomeType`](https://typedoc.org/api/classes/Models.SomeType.html) +```ts +getDeclarationType: (model) => undefined | SomeType; +``` ##### Parameters @@ -1171,7 +1408,9 @@ Please note that partials: #### getDescriptionForReflection() -> **getDescriptionForReflection**: (`model`) => `null` \| `string` +```ts +getDescriptionForReflection: (model) => null | string; +``` ##### Parameters @@ -1185,7 +1424,9 @@ Please note that partials: #### getFlattenedDeclarations() -> **getFlattenedDeclarations**: (`model`, `options`?) => [`DeclarationReflection`](https://typedoc.org/api/classes/Models.DeclarationReflection.html)[] +```ts +getFlattenedDeclarations: (model, options?) => DeclarationReflection[]; +``` ##### Parameters @@ -1201,7 +1442,9 @@ Please note that partials: #### getGroupIndexList() -> **getGroupIndexList**: (`children`) => `string` +```ts +getGroupIndexList: (children) => string; +``` ##### Parameters @@ -1215,7 +1458,9 @@ Please note that partials: #### getGroupIndexTable() -> **getGroupIndexTable**: (`children`) => `string` +```ts +getGroupIndexTable: (children) => string; +``` ##### Parameters @@ -1229,7 +1474,9 @@ Please note that partials: #### getGroupIndex() -> **getGroupIndex**: (`group`) => `any` +```ts +getGroupIndex: (group) => any; +``` ##### Parameters @@ -1243,7 +1490,9 @@ Please note that partials: #### getHierarchyType() -> **getHierarchyType**: (`model`, `options`?) => `string` +```ts +getHierarchyType: (model, options?) => string; +``` ##### Parameters @@ -1259,7 +1508,9 @@ Please note that partials: #### getKeyword() -> **getKeyword**: (`model`) => `string` +```ts +getKeyword: (model) => string; +``` ##### Parameters @@ -1273,7 +1524,9 @@ Please note that partials: #### getModifier() -> **getModifier**: (`model`) => `null` \| `string` +```ts +getModifier: (model) => null | string; +``` ##### Parameters @@ -1287,7 +1540,9 @@ Please note that partials: #### getParameterDefaultValue() -> **getParameterDefaultValue**: (`model`) => `string` +```ts +getParameterDefaultValue: (model) => string; +``` ##### Parameters @@ -1299,9 +1554,28 @@ Please note that partials: `string` +#### getProjectName() + +```ts +getProjectName: (stringWithPlaceholders, page) => string; +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `stringWithPlaceholders` | `string` | +| `page` | [`MarkdownPageEvent`](/api-docs/Class.MarkdownPageEvent.md)\<[`Reflection`](https://typedoc.org/api/classes/Models.Reflection.html)\> | + +##### Returns + +`string` + #### getPropertyDefaultValue() -> **getPropertyDefaultValue**: (`model`) => `null` \| `string` +```ts +getPropertyDefaultValue: (model) => null | string; +``` ##### Parameters @@ -1313,9 +1587,27 @@ Please note that partials: `null` \| `string` +#### getReflectionFlags() + +```ts +getReflectionFlags: (reflection) => string[]; +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `reflection` | [`DeclarationReflection`](https://typedoc.org/api/classes/Models.DeclarationReflection.html) \| [`SignatureReflection`](https://typedoc.org/api/classes/Models.SignatureReflection.html) | + +##### Returns + +`string`[] + #### getReturnType() -> **getReturnType**: (`model`?) => `string` +```ts +getReturnType: (model?) => string; +``` ##### Parameters @@ -1329,7 +1621,9 @@ Please note that partials: #### isGroupKind() -> **isGroupKind**: (`model`) => `boolean` +```ts +isGroupKind: (model) => boolean; +``` ##### Parameters @@ -1340,3 +1634,19 @@ Please note that partials: ##### Returns `boolean` + +#### useTableFormat() + +```ts +useTableFormat: (key) => boolean; +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `"parameters"` \| `"properties"` \| `"enums"` \| `"typeDeclarations"` | + +##### Returns + +`boolean` diff --git a/docs/pages/api-docs/Interface.MarkdownApplication.md b/docs/pages/api-docs/Interface.MarkdownApplication.md index 3f324c939..5cdae7e1b 100644 --- a/docs/pages/api-docs/Interface.MarkdownApplication.md +++ b/docs/pages/api-docs/Interface.MarkdownApplication.md @@ -1,13 +1,11 @@ # MarkdownApplication -An extended typing of TypeDoc's Application instance. - -This is essentially a copy of the main class with the `renderer` property overridden to the custom [MarkdownRenderer](/api-docs/Interface.MarkdownRenderer.md). +This interface is essentially an extended typing of TypeDoc's [`Application`](https://typedoc.org/api/classes/Application.html) instance. ## Usage ```ts -import {MarkdownApplication} from 'typedoc-plugin-markdown'; +import { MarkdownApplication } from 'typedoc-plugin-markdown'; export function load(app: MarkdownApplication) { ... @@ -22,7 +20,11 @@ export function load(app: MarkdownApplication) { ### renderer -> **renderer**: [`MarkdownRenderer`](/api-docs/Interface.MarkdownRenderer.md) +```ts +renderer: MarkdownRenderer; +``` + +Re-types the `renderer` instance to [`MarkdownRenderer`](/api-docs/Interface.MarkdownRenderer.md). #### Overrides diff --git a/docs/pages/api-docs/Interface.MarkdownRenderer.md b/docs/pages/api-docs/Interface.MarkdownRenderer.md index e9421444f..4452a07d4 100644 --- a/docs/pages/api-docs/Interface.MarkdownRenderer.md +++ b/docs/pages/api-docs/Interface.MarkdownRenderer.md @@ -1,8 +1,6 @@ # MarkdownRenderer -An extended typing of TypeDoc's Renderer class. - -Includes updated typings for hooks and async jobs. +An extended typing of TypeDoc's [`Renderer`](https://typedoc.org/api/classes/Renderer.html) class that includes updated typings for hooks and async jobs. ## Usage @@ -15,12 +13,12 @@ app.renderer.markdownHooks.on( 'page.begin', () => '> This is some markdown at the top of the page', ); -app.renderer.preRenderAsyncJobs.push(async (event) => { - await doSomethingAsync(event); +app.renderer.preRenderAsyncJobs.push(async (output: MarkdownRendererEvent) => { + await doSomethingAsync(output); }); -app.renderer.postRenderAsyncJobs.push(async (event) => { - await doSomethingAsync(event); +app.renderer.postRenderAsyncJobs.push(async (output: MarkdownRendererEvent)) => { + await doSomethingAsync(output); }); } @@ -34,13 +32,21 @@ app.renderer.postRenderAsyncJobs.push(async (event) => { ### markdownHooks -> **markdownHooks**: [`EventHooks`](https://typedoc.org/api/classes/EventHooks.html)\<[`MarkdownRendererHooks`](/api-docs/Interface.MarkdownRendererHooks.md), `string`\> +```ts +markdownHooks: EventHooks; +``` + +Replaces the event hooks typings the [`MarkdownRendererHooks`](/api-docs/Interface.MarkdownRendererHooks.md) used by the plugin. *** ### preRenderAsyncJobs -> **preRenderAsyncJobs**: (`output`) => `Promise`\<`void`\>[] +```ts +preRenderAsyncJobs: (output) => Promise[]; +``` + +Re-types the returned argument argument to [`MarkdownRendererEvent`](/api-docs/Class.MarkdownRendererEvent.md). #### Overrides @@ -50,7 +56,11 @@ app.renderer.postRenderAsyncJobs.push(async (event) => { ### postRenderAsyncJobs -> **postRenderAsyncJobs**: (`output`) => `Promise`\<`void`\>[] +```ts +postRenderAsyncJobs: (output) => Promise[]; +``` + +Re-types the returned argument argument to [`MarkdownRendererEvent`](/api-docs/Class.MarkdownRendererEvent.md). #### Overrides diff --git a/docs/pages/api-docs/Interface.MarkdownRendererHooks.md b/docs/pages/api-docs/Interface.MarkdownRendererHooks.md index ffd0553f5..c762a8757 100644 --- a/docs/pages/api-docs/Interface.MarkdownRendererHooks.md +++ b/docs/pages/api-docs/Interface.MarkdownRendererHooks.md @@ -15,7 +15,9 @@ Describes the hooks available to inject output in the markdown theme. ### page.begin -> **page.begin**: [[`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md)] +```ts +page.begin: [MarkdownThemeContext]; +``` Applied at the start of the markdown output. @@ -23,7 +25,9 @@ Applied at the start of the markdown output. ### page.end -> **page.end**: [[`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md)] +```ts +page.end: [MarkdownThemeContext]; +``` Applied at the end of the markdown output. @@ -31,7 +35,9 @@ Applied at the end of the markdown output. ### content.begin -> **content.begin**: [[`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md)] +```ts +content.begin: [MarkdownThemeContext]; +``` Applied before the main markdown content is rendered. @@ -39,7 +45,9 @@ Applied before the main markdown content is rendered. ### index.page.begin -> **index.page.begin**: [[`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md)] +```ts +index.page.begin: [MarkdownThemeContext]; +``` Applied at the start of the markdown output on the index page. @@ -47,6 +55,8 @@ Applied at the start of the markdown output on the index page. ### index.page.end -> **index.page.end**: [[`MarkdownThemeContext`](/api-docs/Class.MarkdownThemeContext.md)] +```ts +index.page.end: [MarkdownThemeContext]; +``` Applied at the end of the markdown output on the index page. diff --git a/docs/pages/api-docs/Interface.NavigationItem.md b/docs/pages/api-docs/Interface.NavigationItem.md index 86a501cbc..1dac13b1b 100644 --- a/docs/pages/api-docs/Interface.NavigationItem.md +++ b/docs/pages/api-docs/Interface.NavigationItem.md @@ -6,22 +6,30 @@ The model used to define the navigation structure. ### title -> **title**: `string` +```ts +title: string; +``` *** ### path? -> `optional` **path**: `null` \| `string` +```ts +optional path: null | string; +``` *** ### kind? -> `optional` **kind**: [`ReflectionKind`](https://typedoc.org/api/enums/Models.ReflectionKind-1.html) +```ts +optional kind: ReflectionKind; +``` *** ### children? -> `optional` **children**: [`NavigationItem`](/api-docs/Interface.NavigationItem.md)[] +```ts +optional children: NavigationItem[]; +``` diff --git a/docs/pages/api-docs/Interface.PackageMetaData.md b/docs/pages/api-docs/Interface.PackageMetaData.md index b6881a56c..463e51292 100644 --- a/docs/pages/api-docs/Interface.PackageMetaData.md +++ b/docs/pages/api-docs/Interface.PackageMetaData.md @@ -6,10 +6,14 @@ The model used to define the package metadata when in packages mode. ### description -> **description**: `string` +```ts +description: string; +``` *** ### options -> **options**: [`Options`](https://typedoc.org/api/classes/Configuration.Options.html) +```ts +options: Options; +``` diff --git a/docs/pages/api-docs/Interface.PluginOptions.md b/docs/pages/api-docs/Interface.PluginOptions.md index f632d1038..3f0d298ca 100644 --- a/docs/pages/api-docs/Interface.PluginOptions.md +++ b/docs/pages/api-docs/Interface.PluginOptions.md @@ -6,7 +6,9 @@ Describes the options declared by the plugin. ### anchorPrefix -> **anchorPrefix**: `string` +```ts +anchorPrefix: string; +``` Custom anchor prefix when anchoring to in-page symbols. @@ -14,7 +16,9 @@ Custom anchor prefix when anchoring to in-page symbols. ### entryFileName -> **entryFileName**: `string` +```ts +entryFileName: string; +``` The file name of the entry page. @@ -22,7 +26,9 @@ The file name of the entry page. ### entryModule -> **entryModule**: `string` +```ts +entryModule: string; +``` The name of a module that should act as the root page for the documentation. @@ -30,7 +36,9 @@ The name of a module that should act as the root page for the documentation. ### enumMembersFormat -> **enumMembersFormat**: `"table"` \| `"list"` \| `"htmlTable"` +```ts +enumMembersFormat: "table" | "list" | "htmlTable"; +``` Specify the render style of enumeration members. @@ -38,7 +46,9 @@ Specify the render style of enumeration members. ### ~~excludeGroups~~ -> **excludeGroups**: `boolean` +```ts +excludeGroups: boolean; +``` #### Deprecated @@ -48,7 +58,9 @@ This option has been renamed hideGroupHeadings to better reflect its purpose. ### excludeScopesInPaths -> **excludeScopesInPaths**: `boolean` +```ts +excludeScopesInPaths: boolean; +``` Exclude writing @ scope directories in paths. @@ -56,7 +68,9 @@ Exclude writing @ scope directories in paths. ### expandObjects -> **expandObjects**: `boolean` +```ts +expandObjects: boolean; +``` Expand objects inside declarations. @@ -64,7 +78,9 @@ Expand objects inside declarations. ### expandParameters -> **expandParameters**: `boolean` +```ts +expandParameters: boolean; +``` Expand parameters in signature parentheses to display type information. @@ -72,7 +88,9 @@ Expand parameters in signature parentheses to display type information. ### fileExtension -> **fileExtension**: `string` +```ts +fileExtension: string; +``` Specify the file extension for generated output files. @@ -80,7 +98,9 @@ Specify the file extension for generated output files. ### flattenOutputFiles -> **flattenOutputFiles**: `boolean` +```ts +flattenOutputFiles: boolean; +``` Flatten output files to a single directory. @@ -88,7 +108,9 @@ Flatten output files to a single directory. ### hideBreadcrumbs -> **hideBreadcrumbs**: `boolean` +```ts +hideBreadcrumbs: boolean; +``` Do not print breadcrumbs. @@ -96,7 +118,9 @@ Do not print breadcrumbs. ### hideGroupHeadings -> **hideGroupHeadings**: `boolean` +```ts +hideGroupHeadings: boolean; +``` Excludes grouping by kind so all members are rendered and sorted at the same level. @@ -104,7 +128,9 @@ Excludes grouping by kind so all members are rendered and sorted at the same lev ### hidePageHeader -> **hidePageHeader**: `boolean` +```ts +hidePageHeader: boolean; +``` Do not print page header. @@ -112,7 +138,9 @@ Do not print page header. ### hidePageTitle -> **hidePageTitle**: `boolean` +```ts +hidePageTitle: boolean; +``` Do not print page title. @@ -120,31 +148,25 @@ Do not print page title. ### indexFormat -> **indexFormat**: `"table"` \| `"list"` \| `"htmlTable"` +```ts +indexFormat: "table" | "list"; +``` Specify the render format for index items. *** -### inlineDocuments - -> **inlineDocuments**: `boolean` - -Inline documents in pages. - -*** - -### leftAlignTableHeaders - -> **leftAlignTableHeaders**: `boolean` - -Left aligns items in table headers - -*** - ### membersWithOwnFile -> **membersWithOwnFile**: (`"Enum"` \| `"Variable"` \| `"Function"` \| `"Class"` \| `"Interface"` \| `"TypeAlias"`)[] +```ts +membersWithOwnFile: ( + | "Enum" + | "Variable" + | "Function" + | "Class" + | "Interface" + | "TypeAlias")[]; +``` Determines which members are exported to their own file when `outputFileStrategy` equals `members`. @@ -152,7 +174,9 @@ Determines which members are exported to their own file when `outputFileStrategy ### mergeReadme -> **mergeReadme**: `boolean` +```ts +mergeReadme: boolean; +``` Merges the resolved readme into the project index page. @@ -160,27 +184,41 @@ Merges the resolved readme into the project index page. ### navigationModel -> **navigationModel**: `object` +```ts +navigationModel: { + excludeGroups: boolean; + excludeCategories: boolean; + excludeFolders: boolean; +}; +``` Configures how the navigation model will be generated. #### excludeGroups -> **excludeGroups**: `boolean` +```ts +excludeGroups: boolean; +``` #### excludeCategories -> **excludeCategories**: `boolean` +```ts +excludeCategories: boolean; +``` #### excludeFolders -> **excludeFolders**: `boolean` +```ts +excludeFolders: boolean; +``` *** ### outputFileStrategy -> **outputFileStrategy**: `"members"` \| `"modules"` +```ts +outputFileStrategy: "members" | "modules"; +``` Determines how output files are generated. @@ -188,7 +226,9 @@ Determines how output files are generated. ### parametersFormat -> **parametersFormat**: `"table"` \| `"list"` \| `"htmlTable"` +```ts +parametersFormat: "table" | "list" | "htmlTable"; +``` Specify the render style of parameter and type parameter groups. @@ -196,7 +236,9 @@ Specify the render style of parameter and type parameter groups. ### preserveAnchorCasing -> **preserveAnchorCasing**: `boolean` +```ts +preserveAnchorCasing: boolean; +``` Preserve anchor casing when generating link to symbols. @@ -204,7 +246,9 @@ Preserve anchor casing when generating link to symbols. ### propertiesFormat -> **propertiesFormat**: `"table"` \| `"list"` \| `"htmlTable"` +```ts +propertiesFormat: "table" | "list" | "htmlTable"; +``` Specify the render style of property groups for interfaces and classes. @@ -212,7 +256,9 @@ Specify the render style of property groups for interfaces and classes. ### publicPath -> **publicPath**: `string` +```ts +publicPath: string; +``` Specify the base path for all urls. @@ -220,53 +266,132 @@ Specify the base path for all urls. ### sanitizeComments -> **sanitizeComments**: `boolean` +```ts +sanitizeComments: boolean; +``` Sanitize HTML and JSX inside JsDoc comments. *** -### tableColumnVisibility +### tableColumnSettings -> **tableColumnVisibility**: `object` +```ts +tableColumnSettings: { + hideDefaults: boolean; + hideInherited: boolean; + hideModifiers: boolean; + hideOverrides: boolean; + hideSources: boolean; + hideValues: boolean; + leftAlignHeaders: boolean; +}; +``` Control header alignment and column visibility in tables. #### hideDefaults -> **hideDefaults**: `boolean` +```ts +hideDefaults: boolean; +``` #### hideInherited -> **hideInherited**: `boolean` +```ts +hideInherited: boolean; +``` #### hideModifiers -> **hideModifiers**: `boolean` +```ts +hideModifiers: boolean; +``` #### hideOverrides -> **hideOverrides**: `boolean` +```ts +hideOverrides: boolean; +``` #### hideSources -> **hideSources**: `boolean` +```ts +hideSources: boolean; +``` + +#### hideValues + +```ts +hideValues: boolean; +``` + +#### leftAlignHeaders + +```ts +leftAlignHeaders: boolean; +``` *** -### ~~textContentMappings~~ +### textContentMappings -> **textContentMappings**: `Partial`\<`any`\> +```ts +textContentMappings: { + header.title: string; + header.docs: string; + breadcrumbs.home: string; + title.indexPage: string; + title.memberPage: string; + footer.text: string; +}; +``` -#### Deprecated +Change specific text placeholders in the template. + +#### header.title + +```ts +header.title: string; +``` + +#### header.docs + +```ts +header.docs: string; +``` + +#### breadcrumbs.home + +```ts +breadcrumbs.home: string; +``` + +#### title.indexPage + +```ts +title.indexPage: string; +``` + +#### title.memberPage + +```ts +title.memberPage: string; +``` + +#### footer.text -Provides a mechanism to change the content of text used in documentation. +```ts +footer.text: string; +``` *** ### typeDeclarationFormat -> **typeDeclarationFormat**: `"table"` \| `"list"` \| `"htmlTable"` +```ts +typeDeclarationFormat: "table" | "list" | "htmlTable"; +``` Specify the render style for type declaration members. @@ -274,7 +399,9 @@ Specify the render style for type declaration members. ### useCodeBlocks -> **useCodeBlocks**: `boolean` +```ts +useCodeBlocks: boolean; +``` Wraps signatures and declarations in code blocks. @@ -282,6 +409,8 @@ Wraps signatures and declarations in code blocks. ### useHTMLAnchors -> **useHTMLAnchors**: `boolean` +```ts +useHTMLAnchors: boolean; +``` Add HTML named anchors to headings and table rows. diff --git a/docs/pages/api-docs/Interface.UrlMapping.md b/docs/pages/api-docs/Interface.UrlMapping.md index ac3dec713..0e16564a2 100644 --- a/docs/pages/api-docs/Interface.UrlMapping.md +++ b/docs/pages/api-docs/Interface.UrlMapping.md @@ -6,19 +6,25 @@ The model used to define the URL mapping structure. ### url -> **url**: `string` +```ts +url: string; +``` *** ### model -> **model**: `Model` +```ts +model: Model; +``` *** ### template() -> **template**: (`data`) => `string` +```ts +template: (data) => string; +``` #### Parameters diff --git a/docs/pages/api-docs/_meta.js b/docs/pages/api-docs/_meta.js index 6913acee0..ec5831894 100644 --- a/docs/pages/api-docs/_meta.js +++ b/docs/pages/api-docs/_meta.js @@ -1,26 +1,12 @@ export default { "index": "API Index", - "Application": { + "Classes": { "type": "separator", - "title": "Application" + "title": "Classes" }, - "Interface.MarkdownApplication": "MarkdownApplication", - "Interface.MarkdownRenderer": "MarkdownRenderer", - "Class.MarkdownPageEvent": "MarkdownPageEvent", - "Class.MarkdownRendererEvent": "MarkdownRendererEvent", - "Interface.MarkdownRendererHooks": "MarkdownRendererHooks", - "Theme": { + "": "NavigationItem", + "Interfaces": { "type": "separator", - "title": "Theme" - }, - "Class.MarkdownTheme": "MarkdownTheme", - "Class.MarkdownThemeContext": "MarkdownThemeContext", - "Interface.PackageMetaData": "PackageMetaData", - "Interface.UrlMapping": "UrlMapping", - "Interface.NavigationItem": "NavigationItem", - "Options": { - "type": "separator", - "title": "Options" - }, - "Interface.PluginOptions": "PluginOptions" + "title": "Interfaces" + } } \ No newline at end of file diff --git a/docs/pages/api-docs/index.md b/docs/pages/api-docs/index.md index 7feb4a0c5..32797a15e 100644 --- a/docs/pages/api-docs/index.md +++ b/docs/pages/api-docs/index.md @@ -1,37 +1,22 @@ # API -The public API of typedoc-plugin-markdown exposes some classes and types that can be used to customize the output of the plugin. Please note this only covers the API relevant to this plugin and not cover the entire [TypeDoc API](https://typedoc.org/api/). - -The APIs are typically consumed by writing [local plugins](/docs/customizing-output#local-plugins). - -## Application - -The Application class is the main entry point for a TypeDoc application and provides the mechanism to listen to hooks, events and define new themes. +## Classes | Member | Description | | :------ | :------ | -| [MarkdownApplication](/api-docs/Interface.MarkdownApplication.md) | An extended typing of TypeDoc's Application instance. | -| [MarkdownRenderer](/api-docs/Interface.MarkdownRenderer.md) | An extended typing of TypeDoc's Renderer class. | | [MarkdownPageEvent](/api-docs/Class.MarkdownPageEvent.md) | An event emitted by before and after the markup of a page is rendered. | | [MarkdownRendererEvent](/api-docs/Class.MarkdownRendererEvent.md) | An event emitted at the beginning and end of the rendering process. | -| [MarkdownRendererHooks](/api-docs/Interface.MarkdownRendererHooks.md) | Describes the hooks available to inject output in the markdown theme. | - -## Theme +| [MarkdownThemeContext](/api-docs/Class.MarkdownThemeContext.md) | The theme context class that is provided as context on the rendering of every page. | +| [MarkdownTheme](/api-docs/Class.MarkdownTheme.md) | The main theme class for the plugin. | -Classes and types that are used to define the Markdown theme and create custom themes. +## Interfaces | Member | Description | | :------ | :------ | -| [MarkdownTheme](/api-docs/Class.MarkdownTheme.md) | The main theme class for the plugin. | -| [MarkdownThemeContext](/api-docs/Class.MarkdownThemeContext.md) | The theme context class that is provided as context on the rendering of every page. | +| [PluginOptions](/api-docs/Interface.PluginOptions.md) | Describes the options declared by the plugin. | +| [MarkdownApplication](/api-docs/Interface.MarkdownApplication.md) | This interface is essentially an extended typing of TypeDoc's [`Application`](https://typedoc.org/api/classes/Application.html) instance. | +| [MarkdownRenderer](/api-docs/Interface.MarkdownRenderer.md) | An extended typing of TypeDoc's [`Renderer`](https://typedoc.org/api/classes/Renderer.html) class that includes updated typings for hooks and async jobs. | +| [MarkdownRendererHooks](/api-docs/Interface.MarkdownRendererHooks.md) | Describes the hooks available to inject output in the markdown theme. | | [PackageMetaData](/api-docs/Interface.PackageMetaData.md) | The model used to define the package metadata when in packages mode. | | [UrlMapping](/api-docs/Interface.UrlMapping.md) | The model used to define the URL mapping structure. | | [NavigationItem](/api-docs/Interface.NavigationItem.md) | The model used to define the navigation structure. | - -## Options - -Types that are used to define the plugin options. - -| Member | Description | -| :------ | :------ | -| [PluginOptions](/api-docs/Interface.PluginOptions.md) | Describes the options declared by the plugin. | diff --git a/docs/pages/docs/CHANGELOG.md b/docs/pages/docs/CHANGELOG.md deleted file mode 100644 index 6236b6380..000000000 --- a/docs/pages/docs/CHANGELOG.md +++ /dev/null @@ -1,126 +0,0 @@ -# Changelog - -## 4.1 (2024-06-21) - -Version 4.1 introduces API compatibility fixes for TypeDoc 0.26. - -### New features - -#### TypeDoc 0.26 Feature Support - -##### Localization - -The plugin respects TypeDoc's 0.26 new localization model. For this reason the existing option `--textContentMappings` has been deprecated in favour of using this implementation. - -##### Documents - -The plugin respects TypeDoc's `@documents` implementation and attempts to follow a similar output structure. -In addition a new option [`--inlineDocuments`]() is available that will place documents in-place. - -#### Table Changes - -This release addresses some of the limitations of previous table implementations. - -Options effected are `--parametersFormat`, `--propertiesFormat`, `--enumMembersFormat`, `--typeDeclarationFormat` and `--indexFormat`, - -##### Markdown vs HTML tables - -Pure markdown have a limitation whereby block level elements can not render inside a cell. A workaround to this is an attempt to parse content into HTML, however this in itself is an anti pattern and introduces other issues (for example there is no way to ascertain how code blocks are handled by the host markdown parser). - -To overcome this issue a new key **"htmlTable"** which will wrap comments in an html table cell, which means that features such as code blocks can now render as intended and all parsing is the responsibility of the host's markdown parser. - -Please note this does involve an output change whereby all line breaks are now stripped from the existing **"table"** key. If you would like to preserve markdown block elements in tabular format please updated to use the **"htmlTable"** key. - -##### Additional Table Options - -Please two additional table options have been exposed: - -- **Column Visibility**: The option [`--tableColumnVisibility`]() introduces the ability to control what columns are displayed in output. This could be useful for some reflections that contain several columns. -- **Header alignment**: The plugin now does not define any header alignment by default. This typically results in table headers visually appearing center aligned. If you would prefer left align headers please use the [`--leftAlignTableHeaders`]() option. - -## 4.0.2 (2024-05-15) - -### Patch Changes - -- Fix symbol url anchors when "flattenOutputFiles" is "true" ([#616](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/616)) -- Normalize line breaks and tags within table columns ([#615](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/615)) -- Remove superfluous spaces and symbol on external links ([#614](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/614)) -- Escape all angle brackets with "santizeComments" ([#612](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/612)) -- Correctly handle quoted symbol names ([#611](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/611)) -- Correctly handle excludeScopesInPaths in windows ([#610](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/610)) - -## 4.0.1 (2024-05-07) - -### Patch Changes - -- Remove superfluous newlines from table column descriptions ([#591](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/591)). -- Handle multiple `@example` tags on same reflection. -- Fix missing extended by definitions. -- Escape Symbols with signatures correctly. - -## 4.0.0 (2024-05-03) - -> v4 is a major release that includes a number of bug fixes, new features and UI improvements. - -### Architectural Changes - -- Handlebars as a dependency has been removed. -- Updated customization model with the ability to set hooks, events and custom theming. -- Exposed navigation structure. - -### Features - -- Updated output file structure. -- Improved and cleaner UI. -- A set of updated and additional new options with comprehensive documentation. -- Exported option types and JSON schema. - -### Structural Changes - -- Each module member is now output to its own file by default. See option `--outputFileStrategy`. To achieve the same output as v3 (whereby only Classes, Enums and Interfaces have their own file), set the option `membersWithOwnFile` option. -- Parameters are output as a list by default. To achieve the same output as v3 (where parameters are output as a table), use option `--parametersFormat=table`. - -### Breaking Changes - -- Because the file structure has changed you may need to update any cross references to files in your documentation. -- Setting `theme` to `"markdown"` is no longer required and should be removed. -- The option `indexTitle` has been removed. Please use the `"title.indexPage"` key with option `--textContentMappings`. -- The option `allReflectionsHaveOwnDocument` has been removed (this behaviour is now the default). Please see option `outputFileStrategy`](/docs/options#outputfilestrategy). -- The option `entryDocument` has been renamed to `entryFileName` to better reflect its purpose. -- The option `namedAnchors` has been renamed to `useHTMLAnchors` to better reflect its purpose. -- The option `hideInPageTOC` has been removed. In-page TOC are no longer included by default. You can include in-page TOCs by using `typedoc-plugin-remark` and the `remark-toc` plugin. -- The option `objectLiteralTypeDeclarationStyle` has been removed. Please use option `--typeDeclarationFormat=list`. - -### Bug Fixes - -- Duplication in callback/callable/function properties. ([#581](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/581)). -- @experimental / @internal annotations. ([#556](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/556)) -- Fix events output and strike-through deprecated items. ([#534](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/534)) -- Class static functions are no longer marked. ([#533](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/533)) -- @example block not rendered with Headline ([#501](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/501)) -- Support for categories ([#499](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/499)) -- Correctly resolve package readme urls from member pages. ([#483](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/483)) -- Add the ability to add a separate frontmatter for readme file. ([#469](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/469)) -- Items in tables are not linkable. ([#463](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/463)) -- Custom i18n texts. ([#458](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/458)) -- How to improve the formatting for types?. ([#456](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/456)) -- How to change title format. ([#450](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/450)) -- Export Docusaurus plugin options type. ([#440](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/440)) -- How to export interface as a table. ([#403](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/403)) -- Broken Link caused by Typescript class being defined in an index file. ([#402](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/403)) -- Markdown plugin inserts unnecessary escape characters. ([#398](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/398)) -- Potential bug with optional function argument. ([#396](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/396)) -- Respect monorepo `readmeFile` configuration ([#383](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/383)) -- Embed all objects under a Module/Namespace onto single page. ([#338](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/338)) -- Extra spaces when merging lines in a table. ([#331](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/331)) -- Does not support namespace (or module) and interface with same name. ([#300](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/300)) -- Integration with VitePress? ([#287](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/287)) -- Typedoc comments with text wrapped in `<` and `>` breaks Docusaurus Markdown parser. ([#276](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/276)) -- Navigation support? ([#262](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/262)) -- Sidebar Category Support? ([#213](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/213)) -- Properties as Table like function properties. ([#109](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/109)) -- Provide a link/excerpt/screenshot to a demo/example rendered output ([#102](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/102)) - ---- - -Earlier changelog entries can be found in `CHANGELOG_ARCHIVE.md`. diff --git a/docs/pages/docs/_meta.js b/docs/pages/docs/_meta.js index f4a8d0752..397720025 100644 --- a/docs/pages/docs/_meta.js +++ b/docs/pages/docs/_meta.js @@ -11,12 +11,12 @@ export default { title: 'Guides', }, 'typedoc-usage': '', + internationalization: '', 'customizing-output': '', '-- Support': { type: 'separator', title: 'Support', }, versioning: '', - CHANGELOG: '', - 'migration-guide': 'Migration Guide V4', + changelog: 'Changelog', }; diff --git a/docs/pages/docs/migration-guide.mdx b/docs/pages/docs/changelog/4.0.mdx similarity index 85% rename from docs/pages/docs/migration-guide.mdx rename to docs/pages/docs/changelog/4.0.mdx index 86d02a90b..67fe368f7 100644 --- a/docs/pages/docs/migration-guide.mdx +++ b/docs/pages/docs/changelog/4.0.mdx @@ -1,19 +1,19 @@ import { Callout } from 'nextra/components'; -# 🚀 Migration Guide V4 +# 4.0 (May 2024) - - v4 is a major release that includes a number of bug fixes, new features and UX - improvements. + + v4.0 is a major release that includes a number of bug fixes, new features and + UX improvements. -## 🏗 Architectural Changes +## Architectural Changes - Handlebars as a dependency has been removed. - Updated customization model with the ability to set hooks, events and custom theming. - Improved test and linting coverage. -## 🌟 New Features +## New Features - Updated output file structure. - Improved and cleaner UX configurable with options. @@ -22,13 +22,13 @@ import { Callout } from 'nextra/components'; - Ability to customize static text. - Comprehensive documentation and examples repository. -## 🏗️ Non-Breaking Changes +## Non-Breaking Changes - Each module member is now output to its own file by default. See [`outputFileStrategy`](/docs/options#outputfilestrategy). To achieve the same output as v3 (whereby only Classes, Enums and Interfaces have their own file), set the [`membersWithOwnFile`](/docs/options#memberswithownfile) option. - Parameters are output as a list by default. To achieve the same output as v3 (where parameters are output as a table), use [`parametersFormat=table`](/docs/options#parametersformat). - Comment `@` tags are now displayed as headings. -## 💥 Breaking Changes +## Breaking Changes - The output file structure has changed so you may need to update any cross references into your docs from external sources. - Setting `theme` to `"markdown"` is not required and should be removed. @@ -39,10 +39,16 @@ import { Callout } from 'nextra/components'; - The option `hideInPageTOC` has been removed. In-page TOC are no longer included by default. You can include in-page TOCs by using [typedoc-plugin-remark](/plugins/remark) and the [remark-toc](plugins/remark/suggested-plugins#remark-toc) plugin. - The option `objectLiteralTypeDeclarationStyle` has been removed. Please use [`typeDeclarationFormat=list`](/docs/options#typedeclarationformat). -## 🗨️ Feedback +## Feedback Feedback on the this release is welcome and encouraged. If you'd like to report a bug, raise a feature request or have any questions, please [open an issue](https://github.com/typedoc2md/typedoc-plugin-markdown/issues/new/choose). -## 👍 Thank You +## Thank You A big thank you to all the members of the community who helped make this release possible with direct contributions and providing invaluable user testing and feedback! + +--- + +Browse the [GitHub +changelog](https://github.com/typedoc2md/typedoc-plugin-markdown/blob/main/packages/typedoc-plugin-markdown/CHANGELOG.md) +for the full list of changes. diff --git a/docs/pages/docs/changelog/4.1.mdx b/docs/pages/docs/changelog/4.1.mdx new file mode 100644 index 000000000..10c88f947 --- /dev/null +++ b/docs/pages/docs/changelog/4.1.mdx @@ -0,0 +1,31 @@ +import { Callout } from 'nextra/components'; + +# 4.1 (June 2024) + + +v4.1 introduces [TypeDoc v0.26]() API and feature support and more. + + + +## New Features + +This release contains required internal api fixes and theme updates to support TypeDoc 0.26 in addition to some additional table options. New supported features includes: + +- **Localization**: Theme support for TypeDoc's 0.26 localization model. +- **Documents**: Theme support for TypeDoc's 0.26 @documents implementation. +- **HTML tables**: Pure markdown tables have a limitation whereby they can not contain block markdown elements. To work around this issue a new key `"htmlTable"` is exposed to format options which will wrap comments in an html table cell and all parsing is the responsibility of the host's markdown parser. + This means that elements such as code blocks can now render as intended inside table cells. Affected options are `parametersFormat`, `propertiesFormat`, `typeDeclarationFormat` and `enumMembersFormat`. +- **Column configuration**: The plugin now supports the ability to control what columns are displayed in output with the [`--tableColumnSettings`]() option. + +## Non-Breaking Changes + +- **Markdown tables**: All line breaks are now stripped from the existing `"table"` key. If you would like to preserve markdown block elements in tabular format please updated to use the `"htmlTable"` key. +- **Table header alignment**: The plugin now does not define any header alignment by default. This typically results in table headers visually appearing center aligned. If you would prefer left align headers please configure using the [`--tableColumnSettings `]() option. +- **Text labels**: The `--textContentMappings` option is now only used for configuring static text labels and placeholders where alternative content might be preferred. + All other general content labels are now controlled by the TypeDoc localization model. + +--- + +Browse the [GitHub +changelog](https://github.com/typedoc2md/typedoc-plugin-markdown/blob/main/packages/typedoc-plugin-markdown/CHANGELOG.md) +for the full list of changes. diff --git a/docs/pages/docs/changelog/_meta.js b/docs/pages/docs/changelog/_meta.js new file mode 100644 index 000000000..9a3e65f01 --- /dev/null +++ b/docs/pages/docs/changelog/_meta.js @@ -0,0 +1,4 @@ +export default { + 4.1: '', + '4.0': '', +}; diff --git a/docs/pages/docs/internationalization.mdx b/docs/pages/docs/internationalization.mdx new file mode 100644 index 000000000..93fe4cdd0 --- /dev/null +++ b/docs/pages/docs/internationalization.mdx @@ -0,0 +1,3 @@ +# Internationalization + +Please follow the TypeDoc documentation for [Internationalization](https://typedoc.org/guides/options/#internationalization) for more information. diff --git a/docs/pages/docs/options.mdx b/docs/pages/docs/options.mdx index 100d4968e..a7bb74415 100644 --- a/docs/pages/docs/options.mdx +++ b/docs/pages/docs/options.mdx @@ -7,47 +7,39 @@ import { Callout, FileTree } from "nextra/components"; [TypeDoc Usage](/docs/typedoc-usage)). -## File Options - -Options that are used to configure how files are output. - -- [--outputFileStrategy](./options/file-options.mdx#--outputfilestrategy) -- [--membersWithOwnFile](./options/file-options.mdx#--memberswithownfile) -- [--flattenOutputFiles](./options/file-options.mdx#--flattenoutputfiles) -- [--fileExtension](./options/file-options.mdx#--fileextension) -- [--entryFileName](./options/file-options.mdx#--entryfilename) -- [--entryModule](./options/file-options.mdx#--entrymodule) -- [--excludeScopesInPaths](./options/file-options.mdx#--excludescopesinpaths) -- [--mergeReadme](./options/file-options.mdx#--mergereadme) -- [--inlineDocuments](./options/file-options.mdx#--inlinedocuments) - -## Display Options - -Options that are used to configure how the output is structured and displayed . - -- [--hidePageHeader](./options/display-options.mdx#--hidepageheader) -- [--hidePageTitle](./options/display-options.mdx#--hidepagetitle) -- [--hideBreadcrumbs](./options/display-options.mdx#--hidebreadcrumbs) -- [--hideGroupHeadings](./options/display-options.mdx#--hidegroupheadings) -- [--useCodeBlocks](./options/display-options.mdx#--usecodeblocks) -- [--expandObjects](./options/display-options.mdx#--expandobjects) -- [--expandParameters](./options/display-options.mdx#--expandparameters) -- [--parametersFormat](./options/display-options.mdx#--parametersformat) -- [--propertiesFormat](./options/display-options.mdx#--propertiesformat) -- [--enumMembersFormat](./options/display-options.mdx#--enummembersformat) -- [--typeDeclarationFormat](./options/display-options.mdx#--typedeclarationformat) -- [--indexFormat](./options/display-options.mdx#--indexformat) -- [--tableColumnVisibility](./options/display-options.mdx#--tablecolumnvisibility) -- [--leftAlignTableHeaders](./options/display-options.mdx#--leftaligntableheaders) - -## Utility Options - -Options that are used for general configuration and utility purposes. - -- [--publicPath](./options/utility-options.mdx#--publicpath) -- [--sanitizeComments](./options/utility-options.mdx#--sanitizecomments) -- [--anchorPrefix](./options/utility-options.mdx#--anchorprefix) -- [--useHTMLAnchors](./options/utility-options.mdx#--usehtmlanchors) -- [--preserveAnchorCasing](./options/utility-options.mdx#--preserveanchorcasing) -- [--navigationModel](./options/utility-options.mdx#--navigationmodel) -- [~--textContentMappings~](./options/utility-options.mdx#--textcontentmappings) +## File Options Options + +- [--outputFileStrategy](./options/file options-options.mdx#--outputfilestrategy) +- [--membersWithOwnFile](./options/file options-options.mdx#--memberswithownfile) +- [--flattenOutputFiles](./options/file options-options.mdx#--flattenoutputfiles) +- [--fileExtension](./options/file options-options.mdx#--fileextension) +- [--entryFileName](./options/file options-options.mdx#--entryfilename) +- [--entryModule](./options/file options-options.mdx#--entrymodule) +- [--excludeScopesInPaths](./options/file options-options.mdx#--excludescopesinpaths) +- [--mergeReadme](./options/file options-options.mdx#--mergereadme) + +## Display Options Options + +- [--hidePageHeader](./options/display options-options.mdx#--hidepageheader) +- [--hidePageTitle](./options/display options-options.mdx#--hidepagetitle) +- [--hideBreadcrumbs](./options/display options-options.mdx#--hidebreadcrumbs) +- [--hideGroupHeadings](./options/display options-options.mdx#--hidegroupheadings) +- [--useCodeBlocks](./options/display options-options.mdx#--usecodeblocks) +- [--expandObjects](./options/display options-options.mdx#--expandobjects) +- [--expandParameters](./options/display options-options.mdx#--expandparameters) +- [--parametersFormat](./options/display options-options.mdx#--parametersformat) +- [--propertiesFormat](./options/display options-options.mdx#--propertiesformat) +- [--enumMembersFormat](./options/display options-options.mdx#--enummembersformat) +- [--typeDeclarationFormat](./options/display options-options.mdx#--typedeclarationformat) +- [--indexFormat](./options/display options-options.mdx#--indexformat) +- [--tableColumnSettings](./options/display options-options.mdx#--tablecolumnsettings) + +## Utility Options Options + +- [--publicPath](./options/utility options-options.mdx#--publicpath) +- [--sanitizeComments](./options/utility options-options.mdx#--sanitizecomments) +- [--anchorPrefix](./options/utility options-options.mdx#--anchorprefix) +- [--useHTMLAnchors](./options/utility options-options.mdx#--usehtmlanchors) +- [--preserveAnchorCasing](./options/utility options-options.mdx#--preserveanchorcasing) +- [--navigationModel](./options/utility options-options.mdx#--navigationmodel) +- [--textContentMappings](./options/utility options-options.mdx#--textcontentmappings) diff --git a/docs/pages/docs/options/_meta.js b/docs/pages/docs/options/_meta.js index 85bc7a149..4c4761fe7 100644 --- a/docs/pages/docs/options/_meta.js +++ b/docs/pages/docs/options/_meta.js @@ -1,5 +1,5 @@ export default { - "file-options": "", - "display-options": "", - "utility-options": "", + "file options-options": "", + "display options-options": "", + "utility options-options": "", }; diff --git a/docs/pages/docs/options/display options-options.mdx b/docs/pages/docs/options/display options-options.mdx new file mode 100644 index 000000000..1d99a1268 --- /dev/null +++ b/docs/pages/docs/options/display options-options.mdx @@ -0,0 +1,180 @@ +import { Callout, FileTree } from "nextra/components"; + +# Display Options Options + +## --hidePageHeader + +Do not print page header. + +> Accepts a boolean value. Defaults to `false`. + +```json filename="typedoc.json" +{ + "hidePageHeader": false +} +``` + +## --hidePageTitle + +Do not print page title. + +> Accepts a boolean value. Defaults to `false`. + +```json filename="typedoc.json" +{ + "hidePageTitle": false +} +``` + +## --hideBreadcrumbs + +Do not print breadcrumbs. + +> Accepts a boolean value. Defaults to `false`. + +```json filename="typedoc.json" +{ + "hideBreadcrumbs": false +} +``` + +## --hideGroupHeadings + + + Excludes grouping by kind so all members are rendered and sorted at the same + level. + + +> Accepts a boolean value. Defaults to `false`. + +```json filename="typedoc.json" +{ + "hideGroupHeadings": false +} +``` + +## --useCodeBlocks + +Wraps signatures and declarations in code blocks. + +> Accepts a boolean value. Defaults to `false`. + +```json filename="typedoc.json" +{ + "useCodeBlocks": false +} +``` + +## --expandObjects + +Expand objects inside declarations. + +> Accepts a boolean value. Defaults to `false`. + +```json filename="typedoc.json" +{ + "expandObjects": false +} +``` + +## --expandParameters + + + Expand parameters in signature parentheses to display type information. + + +> Accepts a boolean value. Defaults to `false`. + +```json filename="typedoc.json" +{ + "expandParameters": false +} +``` + +## --parametersFormat + + + Specify the render style of parameter and type parameter groups. + + +> Accepts one of `"list"` | `"table"` | `"htmlTable"`. Defaults to `"list"`. + +```json filename="typedoc.json" +{ + "parametersFormat": "list" +} +``` + +## --propertiesFormat + + + Specify the render style of property groups for interfaces and classes. + + +> Accepts one of `"list"` | `"table"` | `"htmlTable"`. Defaults to `"list"`. + +```json filename="typedoc.json" +{ + "propertiesFormat": "list" +} +``` + +## --enumMembersFormat + +Specify the render style of enumeration members. + +> Accepts one of `"list"` | `"table"` | `"htmlTable"`. Defaults to `"list"`. + +```json filename="typedoc.json" +{ + "enumMembersFormat": "list" +} +``` + +## --typeDeclarationFormat + + + Specify the render style for type declaration members. + + +> Accepts one of `"list"` | `"table"` | `"htmlTable"`. Defaults to `"list"`. + +```json filename="typedoc.json" +{ + "typeDeclarationFormat": "list" +} +``` + +## --indexFormat + +Specify the render format for index items. + +> Accepts either `"list"` or `"table"`. Defaults to `"list"`. + +```json filename="typedoc.json" +{ + "indexFormat": "list" +} +``` + +## --tableColumnSettings + + + Control header alignment and column visibility in tables. + + +> + +```json filename="typedoc.json" +{ + "tableColumnSettings": { + "hideDefaults": false, + "hideInherited": false, + "hideModifiers": false, + "hideOverrides": false, + "hideSources": false, + "hideValues": false, + "leftAlignHeaders": false + } +} +``` diff --git a/docs/pages/docs/options/display-options.mdx b/docs/pages/docs/options/display-options.mdx index 742534d8b..433d8eee4 100644 --- a/docs/pages/docs/options/display-options.mdx +++ b/docs/pages/docs/options/display-options.mdx @@ -47,10 +47,6 @@ import { Callout, FileTree } from "nextra/components"; > Accepts a boolean value. Defaults to `false`. -By default members are grouped by kind (eg Classes, Functions etc). - -This creates a flat structure where all members are displayed at the same heading level. - ```json filename="typedoc.json" { "hideGroupHeadings": false @@ -63,12 +59,6 @@ This creates a flat structure where all members are displayed at the same headin > Accepts a boolean value. Defaults to `false`. -This option can be used to improve readability and aesthetics when defining signatures and declarations. - -Please note that when this option is set to `true` it is not possible to link to other references. - -As a work around the [`@link`](https://typedoc.org/tags/link/) tag can be be used to manually reference types. - ```json filename="typedoc.json" { "useCodeBlocks": false @@ -81,10 +71,6 @@ As a work around the [`@link`](https://typedoc.org/tags/link/) tag can be be use > Accepts a boolean value. Defaults to `false`. -By default objects inside declarations are collapsed to preserve space and improve readability. - -This option should be set when a full object representation is preferred. - ```json filename="typedoc.json" { "expandObjects": false @@ -99,10 +85,6 @@ This option should be set when a full object representation is preferred. > Accepts a boolean value. Defaults to `false`. -By default parameters in signature definitions only display the parameter name so the output is more concise. - -This option should be set when a full type representation is preferred. - ```json filename="typedoc.json" { "expandParameters": false @@ -117,12 +99,6 @@ This option should be set when a full type representation is preferred. > Accepts one of `"list"` | `"table"` | `"htmlTable"`. Defaults to `"list"`. -This option specifies the output format for parameters and type parameters of functions and class methods: - -- **"list"**: parameters are output as bullet points in a linear list, suitable for more detailed comments. -- **"table"**: parameters are output within a markdown table, condensed into a single paragraph. -- **"htmlTable"**: parameters are output in an HTML table, enabling block elements to render in tabular format. - ```json filename="typedoc.json" { "parametersFormat": "list" @@ -137,12 +113,6 @@ This option specifies the output format for parameters and type parameters of fu > Accepts one of `"list"` | `"table"` | `"htmlTable"`. Defaults to `"list"`. -This option specifies the output format for class and interface properties: - -- **"list"**: properties are output in linear blocks with headings, suitable for more detailed comments. -- **"table"**: properties are output within a markdown table, condensed into a single paragraph. -- **"htmlTable"**: properties are output in an HTML table, enabling block elements to render in tabular format. - ```json filename="typedoc.json" { "propertiesFormat": "list" @@ -155,12 +125,6 @@ This option specifies the output format for class and interface properties: > Accepts one of `"list"` | `"table"` | `"htmlTable"`. Defaults to `"list"`. -This option specifies the output format for enumeration members: - -- **"list"**: members are output in linear blocks with headings, suitable for more detailed comments. -- **"table"**: members are output within a markdown table, condensed into a single paragraph. -- **"htmlTable"**: members are output in an HTML table, enabling block elements to render in tabular format. - ```json filename="typedoc.json" { "enumMembersFormat": "list" @@ -175,12 +139,6 @@ This option specifies the output format for enumeration members: > Accepts one of `"list"` | `"table"` | `"htmlTable"`. Defaults to `"list"`. -This option specifies the output format for type declaration: - -- **"list"**: declarations are output in linear blocks with headings, suitable for more detailed comments. -- **"table"**: declarations are output within a markdown table, condensed into a single paragraph. -- **"htmlTable"**: declarations are output in an HTML table, enabling block elements to render in tabular format. - ```json filename="typedoc.json" { "typeDeclarationFormat": "list" @@ -191,11 +149,7 @@ This option specifies the output format for type declaration: Specify the render format for index items. -> Accepts one of `"list"` | `"table"` | `"htmlTable"`. Defaults to `"list"`. - -This option renders index items either as a simple list or in a table with a description column exposing the comment summary. - -For a packages index page (when `--entryPointStrategy` equals `packages`), the package.json description will be displayed with an additional "Version" column (when `--includeVersion` equals true). +> Accepts either `"list"` or `"table"`. Defaults to `"list"`. ```json filename="typedoc.json" { @@ -203,7 +157,7 @@ For a packages index page (when `--entryPointStrategy` equals `packages`), the p } ``` -## --tableColumnVisibility +## --tableColumnSettings Control header alignment and column visibility in tables. @@ -211,34 +165,16 @@ For a packages index page (when `--entryPointStrategy` equals `packages`), the p > -By default, all available data for symbols are displayed in table columns. - -This option allows you to control the visibility of columns, prioritizing readability over displaying complete data. - ```json filename="typedoc.json" { - "tableColumnVisibility": { + "tableColumnSettings": { "hideDefaults": false, "hideInherited": false, "hideModifiers": false, "hideOverrides": false, - "hideSources": false + "hideSources": false, + "hideValues": false, + "leftAlignHeaders": false } } ``` - -## --leftAlignTableHeaders - -Left aligns items in table headers - -> Accepts a boolean value. Defaults to `false`. - -By default table alignment is not specified which means the table headings will typically be centred. - -This options can be used to specify left alignment for table headings. - -```json filename="typedoc.json" -{ - "leftAlignTableHeaders": false -} -``` diff --git a/docs/pages/docs/options/file options-options.mdx b/docs/pages/docs/options/file options-options.mdx new file mode 100644 index 000000000..fa3b7615f --- /dev/null +++ b/docs/pages/docs/options/file options-options.mdx @@ -0,0 +1,108 @@ +import { Callout, FileTree } from "nextra/components"; + +# File Options Options + +## --outputFileStrategy + +Determines how output files are generated. + +> Accepts either `"members"` or `"modules"`. Defaults to `"members"`. + +```json filename="typedoc.json" +{ + "outputFileStrategy": "members" +} +``` + +## --membersWithOwnFile + + + Determines which members are exported to their own file when + `outputFileStrategy` equals `members`. + + +> Accepts an array of the following values `"Enum"` `"Variable"` `"Function"` `"Class"` `"Interface"` `"TypeAlias"`. + +```json filename="typedoc.json" +{ + "membersWithOwnFile": ["Class", "Enum", "Interface"] +} +``` + +## --flattenOutputFiles + +Flatten output files to a single directory. + +> Accepts a boolean value. Defaults to `false`. + +```json filename="typedoc.json" +{ + "flattenOutputFiles": false +} +``` + +## --fileExtension + + + Specify the file extension for generated output files. + + +> Accepts a string value. Defaults to `".md"`. + +```json filename="typedoc.json" +{ + "fileExtension": ".mdx" +} +``` + +## --entryFileName + +The file name of the entry page. + +> Accepts a string value. Defaults to `"README"`. + +```json filename="typedoc.json" +{ + "entryFileName": "index" +} +``` + +## --entryModule + + + The name of a module that should act as the root page for the documentation. + + +> Accepts a string value. Defaults to `"undefined"`. + +```json filename="typedoc.json" +{ + "entryModule": "index" +} +``` + +## --excludeScopesInPaths + +Exclude writing @ scope directories in paths. + +> Accepts a boolean value. Defaults to `false`. + +```json filename="typedoc.json" +{ + "excludeScopesInPaths": false +} +``` + +## --mergeReadme + + + Merges the resolved readme into the project index page. + + +> Accepts a boolean value. Defaults to `false`. + +```json filename="typedoc.json" +{ + "mergeReadme": false +} +``` diff --git a/docs/pages/docs/options/file-options.mdx b/docs/pages/docs/options/file-options.mdx index 9e6ce2aca..1c950c70e 100644 --- a/docs/pages/docs/options/file-options.mdx +++ b/docs/pages/docs/options/file-options.mdx @@ -17,33 +17,7 @@ It is also possible to further refine what members are exported to individual fi The following keys are available: - **"members":** generates an individual file for each exported module member. This is the standard behavior of the HTML theme and the default setting of the plugin. - - - - - - - - - - - - - - - - - - - - - - **"modules"**: generates a single file for every Module or Namespace where all members are hoisted to a single module file. This creates a flat navigation structure and reduces the amount of files generated. - - - - - ```json filename="typedoc.json" { @@ -213,7 +187,11 @@ Ignored if `flattenOutputFiles` is set to `true`. > Accepts a boolean value. Defaults to `false`. -By default when a readme file is resolved, a separate readme page is created. This option appends the index page to the readme so only a single root page is generated. +By default when a readme file is resolved, a separate readme page is created. +This option appends the index page to the readme so only a single root page is generated. + +You can additionally configure the generated title with `"textContentMappings": { "title.indexPage" : "My API"}`. +See [`--textContentMappings`](/docs/options/utility-options#--textcontentmappings). This option has no effect when [`readme`](https://typedoc.org/options/input/#readme) is set to `"none"`. @@ -222,19 +200,3 @@ This option has no effect when [`readme`](https://typedoc.org/options/input/#rea "mergeReadme": false } ``` - -## --inlineDocuments - -Inline documents in pages. - -> Accepts a boolean value. Defaults to `false`. - -By default a documents indexes and separate documents pages are generated when using the `@document` tag. - -This option inlines the document into the page rather than generating a separate document page. - -```json filename="typedoc.json" -{ - "inlineDocuments": false -} -``` diff --git a/docs/pages/docs/options/utility options-options.mdx b/docs/pages/docs/options/utility options-options.mdx new file mode 100644 index 000000000..5a18431cc --- /dev/null +++ b/docs/pages/docs/options/utility options-options.mdx @@ -0,0 +1,104 @@ +import { Callout, FileTree } from "nextra/components"; + +# Utility Options Options + +## --publicPath + +Specify the base path for all urls. + +> Accepts a string value. Defaults to `"undefined"`. + +```json filename="typedoc.json" +{ + "publicPath": "http://abc.com" +} +``` + +## --sanitizeComments + +Sanitize HTML and JSX inside JsDoc comments. + +> Accepts a boolean value. Defaults to `false`. + +```json filename="typedoc.json" +{ + "sanitizeComments": false +} +``` + +## --anchorPrefix + + + Custom anchor prefix when anchoring to in-page symbols. + + +> Accepts a string value. Defaults to `"undefined"`. + +```json filename="typedoc.json" +{ + "anchorPrefix": "markdown-header" +} +``` + +## --useHTMLAnchors + +Add HTML named anchors to headings and table rows. + +> Accepts a boolean value. Defaults to `false`. + +```json filename="typedoc.json" +{ + "useHTMLAnchors": false +} +``` + +## --preserveAnchorCasing + + + Preserve anchor casing when generating link to symbols. + + +> Accepts a boolean value. Defaults to `false`. + +```json filename="typedoc.json" +{ + "preserveAnchorCasing": false +} +``` + +## --navigationModel + + + Configures how the navigation model will be generated. + + +> + +```json filename="typedoc.json" +{ + "navigationModel": { + "excludeGroups": false, + "excludeCategories": false, + "excludeFolders": false + } +} +``` + +## --textContentMappings + +Change specific text placeholders in the template. + +> + +```json filename="typedoc.json" +{ + "textContentMappings": { + "header.title": "{projectName} {version}", + "header.docs": "Docs", + "breadcrumbs.home": "{projectName} {version}", + "title.indexPage": "{projectName} {version}", + "title.memberPage": "{kind}: {name}", + "footer.text": "" + } +} +``` diff --git a/docs/pages/docs/options/utility-options.mdx b/docs/pages/docs/options/utility-options.mdx index 2b9ced3e9..31e92448d 100644 --- a/docs/pages/docs/options/utility-options.mdx +++ b/docs/pages/docs/options/utility-options.mdx @@ -8,8 +8,6 @@ import { Callout, FileTree } from "nextra/components"; > Accepts a string value. Defaults to `"undefined"`. -If undefined all urls will be relative. - ```json filename="typedoc.json" { "publicPath": "http://abc.com" @@ -22,18 +20,6 @@ If undefined all urls will be relative. > Accepts a boolean value. Defaults to `false`. -_Please note this options does not affect the rendering of inline code or code blocks (using single/triple backticks)._ - -By default all comments written inside JsDoc comments will be passed to the output as written, and parsers will interpret un-escaped angle brackets as HTML/JSX tags.. - -This option will escape angle brackets `<` `>` and curly braces `{` `}` written inside JsDoc comments. - -This option would typically be used when source code comes from an external library exposing the following potential issues: - -- Comments contain raw tags that should be interpreted as code examples. -- Comments contain invalid syntax that (in the case of MDX) will cause breaking parsing errors. -- Although most parsers use XSS filters, this option provides an additional layer of XSS security. - ```json filename="typedoc.json" { "sanitizeComments": false @@ -48,8 +34,6 @@ This option would typically be used when source code comes from an external libr > Accepts a string value. Defaults to `"undefined"`. -This option should be used when parsers require a custom anchor prefix. - ```json filename="typedoc.json" { "anchorPrefix": "markdown-header" @@ -62,11 +46,6 @@ This option should be used when parsers require a custom anchor prefix. > Accepts a boolean value. Defaults to `false`. -This option should be used if there are issues with anchoring to symbols within a page. - -- For markdown parsers that do not automatically assign header ids. -- When cross referencing symbols that are referenced in a table row. - ```json filename="typedoc.json" { "useHTMLAnchors": false @@ -81,10 +60,6 @@ This option should be used if there are issues with anchoring to symbols within > Accepts a boolean value. Defaults to `false`. -By default references to symbol anchor links are lowercased. - -This option can be used for engines that require the preservation of anchor link casing. - ```json filename="typedoc.json" { "preserveAnchorCasing": false @@ -99,31 +74,6 @@ This option can be used for engines that require the preservation of anchor link > -By default navigation is not written to file but can be consumed programmatically. -This is useful if you want to provide a custom sidebar/navigation implementation (if relevant to your environment). - -The navigation model can be accessed by utilizing the `postRenderAsyncJobs` on the renderer. - -The navigation is returned as `JSON` and can be mapped to a custom structure and written to a file. - -- `navigationModel.excludeGroups`: do not organise navigation by groups. -- `navigationModel.excludeCategories`: do not organise navigation by categories. -- `navigationModel.excludeFolders`: excludes unnecessary nesting with complex hierarchies. - -```ts filename="custom-plugin.ts" -import { MarkdownApplication } from "typedoc-plugin-markdown"; - -export function load(app: MarkdownApplication) { - app.renderer.postRenderAsyncJobs.push(async (renderer) => { - // The navigation JSON structure is available on the navigation object. - const navigation = renderer.navigation; - - // This can be parsed to something else or written straight to a file: - fs.writeFileSync("navigation.json", JSON.stringify(navigation)); - }); -} -``` - ```json filename="typedoc.json" { "navigationModel": { @@ -134,19 +84,21 @@ export function load(app: MarkdownApplication) { } ``` -## ~--textContentMappings~ - - - Deprecated: This option has been deprecated in favour of TypeDoc's 0.26 - localization feature. - +## --textContentMappings -> Accepts a key/value object. +Change specific text placeholders in the template. -This option enables changing static text rendered to the documentation. +> ```json filename="typedoc.json" { - "textContentMappings": {} + "textContentMappings": { + "header.title": "{projectName} {version}", + "header.docs": "Docs", + "breadcrumbs.home": "{projectName} {version}", + "title.indexPage": "{projectName} {version}", + "title.memberPage": "{kind}: {name}", + "footer.text": "" + } } ``` diff --git a/docs/theme.config.jsx b/docs/theme.config.jsx index 49139e8f3..25b704a79 100644 --- a/docs/theme.config.jsx +++ b/docs/theme.config.jsx @@ -35,7 +35,7 @@ export default { content: ( <> 🎉{' '} - + v4.1 released • Find out more! diff --git a/package-lock.json b/package-lock.json index 14e8873a8..f6c48564c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,23 +15,24 @@ "devtools/packages/*" ], "devDependencies": { - "@changesets/cli": "^2.27.2", + "@changesets/cli": "^2.27.5", "@commitlint/cli": "^19.3.0", "@commitlint/config-conventional": "^19.2.2", "@types/fs-extra": "^11.0.4", "@types/jest": "^29.5.12", - "@types/node": "^20.12.12", - "@typescript-eslint/eslint-plugin": "^7.9.0", - "@typescript-eslint/parser": "^7.9.0", + "@types/node": "^20.14.2", + "@typescript-eslint/eslint-plugin": "^7.12.0", + "@typescript-eslint/parser": "^7.12.0", + "barrelsby": "^2.8.1", "consola": "^3.2.3", "copyfiles": "^2.4.1", - "eslint": "8.57.0", + "eslint": "^8.57.0", "fs-extra": "^11.2.0", - "glob": "^10.3.15", + "glob": "^10.4.1", "husky": "^9.0.11", "jest": "^29.7.0", "markdownlint": "^0.34.0", - "prettier": "^3.2.5", + "prettier": "^3.3.1", "prettier-plugin-organize-imports": "^3.2.4", "remark": "^15.0.1", "remark-gfm": "^4.0.0", @@ -39,12 +40,12 @@ "remark-mdx": "^3.0.1", "remark-toc": "^9.0.0", "to-vfile": "^8.0.0", - "ts-jest": "^29.1.2", - "ts-json-schema-generator": "^2.1.1", + "ts-jest": "^29.1.4", + "ts-json-schema-generator": "^2.3.0", "ts-morph": "^22.0.0", "ts-node": "^10.9.2", "tsc-alias": "^1.8.10", - "typedoc": "^0.26.0-beta.1", + "typedoc": "^0.26.0-beta.2", "typescript": "^5.4.5", "unified-prettier": "^2.0.1" } @@ -2055,15 +2056,16 @@ "dev": true }, "node_modules/@changesets/apply-release-plan": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@changesets/apply-release-plan/-/apply-release-plan-7.0.1.tgz", - "integrity": "sha512-aPdSq/R++HOyfEeBGjEe6LNG8gs0KMSyRETD/J2092OkNq8mOioAxyKjMbvVUdzgr/HTawzMOz7lfw339KnsCA==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@changesets/apply-release-plan/-/apply-release-plan-7.0.3.tgz", + "integrity": "sha512-klL6LCdmfbEe9oyfLxnidIf/stFXmrbFO/3gT5LU5pcyoZytzJe4gWpTBx3BPmyNPl16dZ1xrkcW7b98e3tYkA==", "dev": true, "dependencies": { "@babel/runtime": "^7.20.1", - "@changesets/config": "^3.0.0", + "@changesets/config": "^3.0.1", "@changesets/get-version-range-type": "^0.4.0", "@changesets/git": "^3.0.0", + "@changesets/should-skip-package": "^0.1.0", "@changesets/types": "^6.0.0", "@manypkg/get-packages": "^1.1.3", "detect-indent": "^6.0.0", @@ -2105,14 +2107,15 @@ } }, "node_modules/@changesets/assemble-release-plan": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@changesets/assemble-release-plan/-/assemble-release-plan-6.0.0.tgz", - "integrity": "sha512-4QG7NuisAjisbW4hkLCmGW2lRYdPrKzro+fCtZaILX+3zdUELSvYjpL4GTv0E4aM9Mef3PuIQp89VmHJ4y2bfw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@changesets/assemble-release-plan/-/assemble-release-plan-6.0.2.tgz", + "integrity": "sha512-n9/Tdq+ze+iUtjmq0mZO3pEhJTKkku9hUxtUadW30jlN7kONqJG3O6ALeXrmc6gsi/nvoCuKjqEJ68Hk8RbMTQ==", "dev": true, "dependencies": { "@babel/runtime": "^7.20.1", "@changesets/errors": "^0.2.0", - "@changesets/get-dependents-graph": "^2.0.0", + "@changesets/get-dependents-graph": "^2.1.0", + "@changesets/should-skip-package": "^0.1.0", "@changesets/types": "^6.0.0", "@manypkg/get-packages": "^1.1.3", "semver": "^7.5.3" @@ -2128,23 +2131,24 @@ } }, "node_modules/@changesets/cli": { - "version": "2.27.2", - "resolved": "https://registry.npmjs.org/@changesets/cli/-/cli-2.27.2.tgz", - "integrity": "sha512-6/kADjKMOrlLwNr/Y5HAq7T9oGOA2Lq5A59AGtwQCCiXuSGp4EgszzdJFeBiF8pdz7Wn1HaLzSUBhAaNToEJqg==", + "version": "2.27.5", + "resolved": "https://registry.npmjs.org/@changesets/cli/-/cli-2.27.5.tgz", + "integrity": "sha512-UVppOvzCjjylBenFcwcZNG5IaZ8jsIaEVraV/pbXgukYNb0Oqa0d8UWb0LkYzA1Bf1HmUrOfccFcRLheRuA7pA==", "dev": true, "dependencies": { "@babel/runtime": "^7.20.1", - "@changesets/apply-release-plan": "^7.0.1", - "@changesets/assemble-release-plan": "^6.0.0", + "@changesets/apply-release-plan": "^7.0.3", + "@changesets/assemble-release-plan": "^6.0.2", "@changesets/changelog-git": "^0.2.0", - "@changesets/config": "^3.0.0", + "@changesets/config": "^3.0.1", "@changesets/errors": "^0.2.0", - "@changesets/get-dependents-graph": "^2.0.0", - "@changesets/get-release-plan": "^4.0.0", + "@changesets/get-dependents-graph": "^2.1.0", + "@changesets/get-release-plan": "^4.0.2", "@changesets/git": "^3.0.0", "@changesets/logger": "^0.1.0", "@changesets/pre": "^2.0.0", "@changesets/read": "^0.6.0", + "@changesets/should-skip-package": "^0.1.0", "@changesets/types": "^6.0.0", "@changesets/write": "^0.3.1", "@manypkg/get-packages": "^1.1.3", @@ -2185,13 +2189,13 @@ } }, "node_modules/@changesets/config": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@changesets/config/-/config-3.0.0.tgz", - "integrity": "sha512-o/rwLNnAo/+j9Yvw9mkBQOZySDYyOr/q+wptRLcAVGlU6djOeP9v1nlalbL9MFsobuBVQbZCTp+dIzdq+CLQUA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@changesets/config/-/config-3.0.1.tgz", + "integrity": "sha512-nCr8pOemUjvGJ8aUu8TYVjqnUL+++bFOQHBVmtNbLvKzIDkN/uiP/Z4RKmr7NNaiujIURHySDEGFPftR4GbTUA==", "dev": true, "dependencies": { "@changesets/errors": "^0.2.0", - "@changesets/get-dependents-graph": "^2.0.0", + "@changesets/get-dependents-graph": "^2.1.0", "@changesets/logger": "^0.1.0", "@changesets/types": "^6.0.0", "@manypkg/get-packages": "^1.1.3", @@ -2223,9 +2227,9 @@ } }, "node_modules/@changesets/get-dependents-graph": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@changesets/get-dependents-graph/-/get-dependents-graph-2.0.0.tgz", - "integrity": "sha512-cafUXponivK4vBgZ3yLu944mTvam06XEn2IZGjjKc0antpenkYANXiiE6GExV/yKdsCnE8dXVZ25yGqLYZmScA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@changesets/get-dependents-graph/-/get-dependents-graph-2.1.0.tgz", + "integrity": "sha512-QOt6pQq9RVXKGHPVvyKimJDYJumx7p4DO5MO9AhRJYgAPgv0emhNqAqqysSVKHBm4sxKlGN4S1zXOIb5yCFuhQ==", "dev": true, "dependencies": { "@changesets/types": "^6.0.0", @@ -2250,14 +2254,14 @@ } }, "node_modules/@changesets/get-release-plan": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@changesets/get-release-plan/-/get-release-plan-4.0.0.tgz", - "integrity": "sha512-9L9xCUeD/Tb6L/oKmpm8nyzsOzhdNBBbt/ZNcjynbHC07WW4E1eX8NMGC5g5SbM5z/V+MOrYsJ4lRW41GCbg3w==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@changesets/get-release-plan/-/get-release-plan-4.0.2.tgz", + "integrity": "sha512-rOalz7nMuMV2vyeP7KBeAhqEB7FM2GFPO5RQSoOoUKKH9L6wW3QyPA2K+/rG9kBrWl2HckPVES73/AuwPvbH3w==", "dev": true, "dependencies": { "@babel/runtime": "^7.20.1", - "@changesets/assemble-release-plan": "^6.0.0", - "@changesets/config": "^3.0.0", + "@changesets/assemble-release-plan": "^6.0.2", + "@changesets/config": "^3.0.1", "@changesets/pre": "^2.0.0", "@changesets/read": "^0.6.0", "@changesets/types": "^6.0.0", @@ -2361,6 +2365,17 @@ "node": ">=6 <7 || >=8" } }, + "node_modules/@changesets/should-skip-package": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@changesets/should-skip-package/-/should-skip-package-0.1.0.tgz", + "integrity": "sha512-FxG6Mhjw7yFStlSM7Z0Gmg3RiyQ98d/9VpQAZ3Fzr59dCOM9G6ZdYbjiSAt0XtFr9JR5U2tBaJWPjrkGGc618g==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.20.1", + "@changesets/types": "^6.0.0", + "@manypkg/get-packages": "^1.1.3" + } + }, "node_modules/@changesets/types": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/@changesets/types/-/types-6.0.0.tgz", @@ -5049,9 +5064,9 @@ "dev": true }, "node_modules/@shikijs/core": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.5.2.tgz", - "integrity": "sha512-wSAOgaz48GmhILFElMCeQypSZmj6Ru6DttOOtl3KNkdJ17ApQuGNCfzpk4cClasVrnIu45++2DBwG4LNMQAfaA==" + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.6.1.tgz", + "integrity": "sha512-CqYyepN4SnBopaoXYwng4NO8riB5ask/LTCkhOFq+GNGtr2X+aKeD767eYdqYukeixEUvv4bXdyTYVaogj7KBw==" }, "node_modules/@sideway/address": { "version": "4.1.5", @@ -5836,9 +5851,9 @@ "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==" }, "node_modules/@types/node": { - "version": "20.12.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.12.tgz", - "integrity": "sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==", + "version": "20.14.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.2.tgz", + "integrity": "sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -5986,16 +6001,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.9.0.tgz", - "integrity": "sha512-6e+X0X3sFe/G/54aC3jt0txuMTURqLyekmEHViqyA2VnxhLMpvA6nqmcjIy+Cr9tLDHPssA74BP5Mx9HQIxBEA==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.12.0.tgz", + "integrity": "sha512-7F91fcbuDf/d3S8o21+r3ZncGIke/+eWk0EpO21LXhDfLahriZF9CGj4fbAetEjlaBdjdSm9a6VeXbpbT6Z40Q==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "7.9.0", - "@typescript-eslint/type-utils": "7.9.0", - "@typescript-eslint/utils": "7.9.0", - "@typescript-eslint/visitor-keys": "7.9.0", + "@typescript-eslint/scope-manager": "7.12.0", + "@typescript-eslint/type-utils": "7.12.0", + "@typescript-eslint/utils": "7.12.0", + "@typescript-eslint/visitor-keys": "7.12.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -6019,15 +6034,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.9.0.tgz", - "integrity": "sha512-qHMJfkL5qvgQB2aLvhUSXxbK7OLnDkwPzFalg458pxQgfxKDfT1ZDbHQM/I6mDIf/svlMkj21kzKuQ2ixJlatQ==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.12.0.tgz", + "integrity": "sha512-dm/J2UDY3oV3TKius2OUZIFHsomQmpHtsV0FTh1WO8EKgHLQ1QCADUqscPgTpU+ih1e21FQSRjXckHn3txn6kQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "7.9.0", - "@typescript-eslint/types": "7.9.0", - "@typescript-eslint/typescript-estree": "7.9.0", - "@typescript-eslint/visitor-keys": "7.9.0", + "@typescript-eslint/scope-manager": "7.12.0", + "@typescript-eslint/types": "7.12.0", + "@typescript-eslint/typescript-estree": "7.12.0", + "@typescript-eslint/visitor-keys": "7.12.0", "debug": "^4.3.4" }, "engines": { @@ -6047,13 +6062,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.9.0.tgz", - "integrity": "sha512-ZwPK4DeCDxr3GJltRz5iZejPFAAr4Wk3+2WIBaj1L5PYK5RgxExu/Y68FFVclN0y6GGwH8q+KgKRCvaTmFBbgQ==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.12.0.tgz", + "integrity": "sha512-itF1pTnN6F3unPak+kutH9raIkL3lhH1YRPGgt7QQOh43DQKVJXmWkpb+vpc/TiDHs6RSd9CTbDsc/Y+Ygq7kg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.9.0", - "@typescript-eslint/visitor-keys": "7.9.0" + "@typescript-eslint/types": "7.12.0", + "@typescript-eslint/visitor-keys": "7.12.0" }, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -6064,13 +6079,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.9.0.tgz", - "integrity": "sha512-6Qy8dfut0PFrFRAZsGzuLoM4hre4gjzWJB6sUvdunCYZsYemTkzZNwF1rnGea326PHPT3zn5Lmg32M/xfJfByA==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.12.0.tgz", + "integrity": "sha512-lib96tyRtMhLxwauDWUp/uW3FMhLA6D0rJ8T7HmH7x23Gk1Gwwu8UZ94NMXBvOELn6flSPiBrCKlehkiXyaqwA==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.9.0", - "@typescript-eslint/utils": "7.9.0", + "@typescript-eslint/typescript-estree": "7.12.0", + "@typescript-eslint/utils": "7.12.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -6091,9 +6106,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.9.0.tgz", - "integrity": "sha512-oZQD9HEWQanl9UfsbGVcZ2cGaR0YT5476xfWE0oE5kQa2sNK2frxOlkeacLOTh9po4AlUT5rtkGyYM5kew0z5w==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.12.0.tgz", + "integrity": "sha512-o+0Te6eWp2ppKY3mLCU+YA9pVJxhUJE15FV7kxuD9jgwIAa+w/ycGJBMrYDTpVGUM/tgpa9SeMOugSabWFq7bg==", "dev": true, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -6104,13 +6119,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.9.0.tgz", - "integrity": "sha512-zBCMCkrb2YjpKV3LA0ZJubtKCDxLttxfdGmwZvTqqWevUPN0FZvSI26FalGFFUZU/9YQK/A4xcQF9o/VVaCKAg==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.12.0.tgz", + "integrity": "sha512-5bwqLsWBULv1h6pn7cMW5dXX/Y2amRqLaKqsASVwbBHMZSnHqE/HN4vT4fE0aFsiwxYvr98kqOWh1a8ZKXalCQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.9.0", - "@typescript-eslint/visitor-keys": "7.9.0", + "@typescript-eslint/types": "7.12.0", + "@typescript-eslint/visitor-keys": "7.12.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -6132,15 +6147,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.9.0.tgz", - "integrity": "sha512-5KVRQCzZajmT4Ep+NEgjXCvjuypVvYHUW7RHlXzNPuak2oWpVoD1jf5xCP0dPAuNIchjC7uQyvbdaSTFaLqSdA==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.12.0.tgz", + "integrity": "sha512-Y6hhwxwDx41HNpjuYswYp6gDbkiZ8Hin9Bf5aJQn1bpTs3afYY4GX+MPYxma8jtoIV2GRwTM/UJm/2uGCVv+DQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "7.9.0", - "@typescript-eslint/types": "7.9.0", - "@typescript-eslint/typescript-estree": "7.9.0" + "@typescript-eslint/scope-manager": "7.12.0", + "@typescript-eslint/types": "7.12.0", + "@typescript-eslint/typescript-estree": "7.12.0" }, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -6154,12 +6169,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.9.0.tgz", - "integrity": "sha512-iESPx2TNLDNGQLyjKhUvIKprlP49XNEK+MvIf9nIO7ZZaZdbnfWKHnXAgufpxqfA0YryH8XToi4+CjBgVnFTSQ==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.12.0.tgz", + "integrity": "sha512-uZk7DevrQLL3vSnfFl5bj4sL75qC9D6EdjemIdbtkuUmIheWpuiiylSY01JxJE7+zGrOWDZrp1WxOuDntvKrHQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.9.0", + "@typescript-eslint/types": "7.12.0", "eslint-visitor-keys": "^3.4.3" }, "engines": { @@ -7047,6 +7062,134 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, + "node_modules/barrelsby": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/barrelsby/-/barrelsby-2.8.1.tgz", + "integrity": "sha512-barN2MVKqUVwmjRy3JLSMYufrBDcdWUc2pjlR0V9P8S3aMvvJ4StFz1GJMzEi5GBoQlnBIWOcCxBDzI2xfaaGw==", + "dev": true, + "dependencies": { + "@types/yargs": "^17.0.10", + "signale": "^1.4.0", + "yargs": "^17.4.1" + }, + "bin": { + "barrelsby": "bin/cli.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/barrelsby/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/barrelsby/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/barrelsby/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/barrelsby/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/barrelsby/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/barrelsby/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/barrelsby/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/barrelsby/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/barrelsby/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/batch": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", @@ -10467,6 +10610,18 @@ "bser": "2.1.1" } }, + "node_modules/figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -11282,16 +11437,16 @@ "dev": true }, "node_modules/glob": { - "version": "10.3.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.15.tgz", - "integrity": "sha512-0c6RlJt1TICLyvJYIApxb8GsXoai0KUP7AxKKAtsYXdgJR1mGEUa7DgwShbdk1nly0PYoZj01xd4hzbq3fsjpw==", + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.1.tgz", + "integrity": "sha512-2jelhlq3E4ho74ZyVLN03oKdAZVUa6UDZzFLVH1H7dnoax+y9qyaq8zBkfDIggjniU19z0wU18y16jMB2eyVIw==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.3.6", - "minimatch": "^9.0.1", - "minipass": "^7.0.4", - "path-scurry": "^1.11.0" + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" @@ -13072,9 +13227,9 @@ } }, "node_modules/jackspeak": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", - "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.0.tgz", + "integrity": "sha512-JVYhQnN59LVPFCEcVa2C3CrEKYacvjRfqIQl+h8oi91aLYQVWRYbxjPcv1bUiUy/kLmQaANrYfNMCO3kuEDHfw==", "dev": true, "dependencies": { "@isaacs/cliui": "^8.0.2" @@ -14899,6 +15054,12 @@ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -15060,6 +15221,52 @@ "uc.micro": "^2.0.0" } }, + "node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dev": true, + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/load-yaml-file": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/load-yaml-file/-/load-yaml-file-0.2.0.tgz", @@ -16664,9 +16871,9 @@ } }, "node_modules/minipass": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.1.tgz", - "integrity": "sha512-UZ7eQ+h8ywIRAW1hIEl2AqdwzJucU/Kp59+8kkZeSvafXhZjul247BvIJjEVFVeON6d7lM46XX1HXCduKAS8VA==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true, "engines": { "node": ">=16 || 14 >=14.17" @@ -17384,6 +17591,86 @@ "node": ">= 6" } }, + "node_modules/pkg-conf": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-2.1.0.tgz", + "integrity": "sha512-C+VUP+8jis7EsQZIhDYmS5qlNtjv2yP4SNtjXK9AP1ZcTRlnSfuumaTnRfYZnYgUUYVIKqL0fRvmUGDV2fmp6g==", + "dev": true, + "dependencies": { + "find-up": "^2.0.0", + "load-json-file": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "dev": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -18211,9 +18498,9 @@ } }, "node_modules/prettier": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", - "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.1.tgz", + "integrity": "sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -20137,11 +20424,11 @@ } }, "node_modules/shiki": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.5.2.tgz", - "integrity": "sha512-fpPbuSaatinmdGijE7VYUD3hxLozR3ZZ+iAx8Iy2X6REmJGyF5hQl94SgmiUNTospq346nXUVZx0035dyGvIVw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.6.1.tgz", + "integrity": "sha512-1Pu/A1rtsG6HZvQm4W0NExQ45e02og+rPog7PDaFDiMumZgOYnZIu4JtGQeAIfMwdbKSjJQoCUr79vDLKUUxWA==", "dependencies": { - "@shikijs/core": "1.5.2" + "@shikijs/core": "1.6.1" } }, "node_modules/side-channel": { @@ -20174,6 +20461,20 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/signale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/signale/-/signale-1.4.0.tgz", + "integrity": "sha512-iuh+gPf28RkltuJC7W5MRi6XAjTDCAPC/prJUpQoG4vIP3MJZ+GTydVnodXA7pwvTKb2cA0m9OFZW/cdWy/I/w==", + "dev": true, + "dependencies": { + "chalk": "^2.3.2", + "figures": "^2.0.0", + "pkg-conf": "^2.1.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/sirv": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz", @@ -21361,9 +21662,9 @@ } }, "node_modules/ts-jest": { - "version": "29.1.2", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", - "integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", + "version": "29.1.4", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.4.tgz", + "integrity": "sha512-YiHwDhSvCiItoAgsKtoLFCuakDzDsJ1DLDnSouTaTmdOcOwIkSzbLXduaQ6M5DRVhuZC/NYaaZ/mtHbWMv/S6Q==", "dev": true, "dependencies": { "bs-logger": "0.x", @@ -21379,10 +21680,11 @@ "ts-jest": "cli.js" }, "engines": { - "node": "^16.10.0 || ^18.0.0 || >=20.0.0" + "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0" }, "peerDependencies": { "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/transform": "^29.0.0", "@jest/types": "^29.0.0", "babel-jest": "^29.0.0", "jest": "^29.0.0", @@ -21392,6 +21694,9 @@ "@babel/core": { "optional": true }, + "@jest/transform": { + "optional": true + }, "@jest/types": { "optional": true }, @@ -21413,9 +21718,9 @@ } }, "node_modules/ts-json-schema-generator": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ts-json-schema-generator/-/ts-json-schema-generator-2.1.1.tgz", - "integrity": "sha512-ha5/w3A2APOOn9ET2CfunEXdVOnKmjISTGcxhCkDszmrsRWFfG5F+re5U5onLXo665sZ4BuE2g5jZAjC+CUcgA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/ts-json-schema-generator/-/ts-json-schema-generator-2.3.0.tgz", + "integrity": "sha512-t4lBQAwZc0sOJq9LJt3NgbznIcslVnm0JeEMFq8qIRklpMRY8jlYD0YmnRWbqBKANxkby91P1XanSSlSOFpUmg==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.15", @@ -21424,6 +21729,7 @@ "json5": "^2.2.3", "normalize-path": "^3.0.0", "safe-stable-stringify": "^2.4.3", + "tslib": "^2.6.2", "typescript": "^5.4.5" }, "bin": { @@ -21846,14 +22152,14 @@ } }, "node_modules/typedoc": { - "version": "0.26.0-beta.1", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.0-beta.1.tgz", - "integrity": "sha512-bnTZHxgvGQusWGEZyyzzaxD6Q1+8UQcEksT3PmN8jtgpWu1b1/Kb2Ib4jbpErHUabMR0+9088EH5eFolMN0RQA==", + "version": "0.26.0-beta.2", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.0-beta.2.tgz", + "integrity": "sha512-sFVUArw13cF8K7jeayUXyVCby9pRsEdjkQSvgnRxL8Wzuow9G7xlrXBhWU1BFBoGK8RC25hXD/4oJmMQhnnEnQ==", "dependencies": { "lunr": "^2.3.9", "markdown-it": "^14.1.0", "minimatch": "^9.0.4", - "shiki": "^1.4.0", + "shiki": "^1.6.0", "yaml": "^2.4.2" }, "bin": { @@ -23378,7 +23684,7 @@ } }, "packages/typedoc-gitlab-wiki-theme": { - "version": "2.0.0", + "version": "2.0.1", "license": "MIT", "peerDependencies": { "typedoc-plugin-markdown": ">=4.0.0" @@ -23395,7 +23701,7 @@ } }, "packages/typedoc-plugin-markdown": { - "version": "4.0.2", + "version": "4.0.3", "license": "MIT", "engines": { "node": ">= 18" @@ -23405,7 +23711,7 @@ } }, "packages/typedoc-plugin-remark": { - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "dependencies": { "remark": "^15.0.1", diff --git a/package.json b/package.json index 08cbe377b..94b606825 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,8 @@ ], "scripts": { "docs": "ts-node ./devtools/scripts/generate-readmes && node ./devtools/scripts/tocs.mjs", + "devdocs": "typedoc", + "devdocs:html": "typedoc --options typedoc.html.json", "build-all": "npm run build --workspaces --if-present", "test-all": "npm run test --workspaces --if-present", "prerelease": "npm run build-all", @@ -19,23 +21,24 @@ "prepare": "husky" }, "devDependencies": { - "@changesets/cli": "^2.27.2", + "@changesets/cli": "^2.27.5", "@commitlint/cli": "^19.3.0", "@commitlint/config-conventional": "^19.2.2", "@types/fs-extra": "^11.0.4", "@types/jest": "^29.5.12", - "@types/node": "^20.12.12", - "@typescript-eslint/eslint-plugin": "^7.9.0", - "@typescript-eslint/parser": "^7.9.0", + "@types/node": "^20.14.2", + "@typescript-eslint/eslint-plugin": "^7.12.0", + "@typescript-eslint/parser": "^7.12.0", + "barrelsby": "^2.8.1", "consola": "^3.2.3", "copyfiles": "^2.4.1", - "eslint": "8.57.0", + "eslint": "^8.57.0", "fs-extra": "^11.2.0", - "glob": "^10.3.15", + "glob": "^10.4.1", "husky": "^9.0.11", "jest": "^29.7.0", "markdownlint": "^0.34.0", - "prettier": "^3.2.5", + "prettier": "^3.3.1", "prettier-plugin-organize-imports": "^3.2.4", "remark": "^15.0.1", "remark-gfm": "^4.0.0", @@ -43,12 +46,12 @@ "remark-mdx": "^3.0.1", "remark-toc": "^9.0.0", "to-vfile": "^8.0.0", - "ts-jest": "^29.1.2", - "ts-json-schema-generator": "^2.1.1", + "ts-jest": "^29.1.4", + "ts-json-schema-generator": "^2.3.0", "ts-morph": "^22.0.0", "ts-node": "^10.9.2", "tsc-alias": "^1.8.10", - "typedoc": "^0.26.0-beta.1", + "typedoc": "^0.26.0-beta.2", "typescript": "^5.4.5", "unified-prettier": "^2.0.1" } diff --git a/packages/docusaurus-plugin-typedoc/package.json b/packages/docusaurus-plugin-typedoc/package.json index ddc6f0d2d..bdd0fbf4e 100644 --- a/packages/docusaurus-plugin-typedoc/package.json +++ b/packages/docusaurus-plugin-typedoc/package.json @@ -14,7 +14,7 @@ "url": "git+https://github.com/typedoc2md/typedoc-plugin-markdown.git", "directory": "packages/docusaurus-plugin-typedoc" }, - "homepage": "http://typedoc.org/plugins/docusaurus", + "homepage": "http://typedoc-plugin-markdown.org/plugins/docusaurus", "peerDependencies": { "typedoc-plugin-markdown": ">=4.0.0" }, diff --git a/packages/docusaurus-plugin-typedoc/test/specs/__snapshots__/docusaurus.spec.ts.snap b/packages/docusaurus-plugin-typedoc/test/specs/__snapshots__/docusaurus.spec.ts.snap index a30259b8c..243ec0ec0 100644 --- a/packages/docusaurus-plugin-typedoc/test/specs/__snapshots__/docusaurus.spec.ts.snap +++ b/packages/docusaurus-plugin-typedoc/test/specs/__snapshots__/docusaurus.spec.ts.snap @@ -64,7 +64,7 @@ Links using \`{@link}\` inline tags. - [Links to CommentInterface.prop](index.md#prop) - [Links to CommentInterface.propb](index.md#propb) -#### Extended By +#### Extended by - [\`CommentInterfaceExtended\`](index.md#commentinterfaceextended) diff --git a/packages/typedoc-plugin-markdown/.docs/plugins/typedoc-default-values.js b/packages/typedoc-plugin-markdown/.docs/plugins/typedoc-default-values.js new file mode 100644 index 000000000..db7ff15c8 --- /dev/null +++ b/packages/typedoc-plugin-markdown/.docs/plugins/typedoc-default-values.js @@ -0,0 +1,41 @@ +const { Converter, TypeScript } = require('typedoc'); + +exports.load = function ({ application }) { + /** @type {Map} */ + const defaultValues = new Map(); + + const printer = TypeScript.createPrinter({ + removeComments: true, + omitTrailingSemicolon: true, + }); + + application.converter.on( + Converter.EVENT_CREATE_DECLARATION, + (_context, reflection) => { + const node = + reflection.project.getSymbolFromReflection(reflection) + ?.declarations?.[0]; + if (!node || !node.initializer) return; + + if ( + node.initializer.kind === TypeScript.SyntaxKind.ObjectLiteralExpression + ) { + defaultValues.set( + reflection, + printer.printNode( + TypeScript.EmitHint.Expression, + node.initializer, + node.getSourceFile(), + ), + ); + } + }, + ); + + application.converter.on(Converter.EVENT_RESOLVE_BEGIN, () => { + for (const [refl, init] of defaultValues) { + refl.defaultValue = init; + } + defaultValues.clear(); + }); +}; diff --git a/packages/typedoc-plugin-markdown/.docs/plugins/typedoc-symbol-resolver.mjs b/packages/typedoc-plugin-markdown/.docs/plugins/typedoc-symbol-resolver.mjs deleted file mode 100644 index eb21a2a95..000000000 --- a/packages/typedoc-plugin-markdown/.docs/plugins/typedoc-symbol-resolver.mjs +++ /dev/null @@ -1,18 +0,0 @@ -// @ts-check - -/** - * Local plugin to tweak TypeDoc output for nextra docs - * - * @param {import("typedoc-plugin-markdown").MarkdownApplication} app - */ -export function load(app) { - app.converter.addUnknownSymbolResolver((ref) => { - if (ref?.symbolReference?.path && ref.moduleSource !== 'typedoc') { - const name = ref?.symbolReference?.path[0].path; - return { - target: `https://typedoc.org/api/classes/${name}`, - caption: name, - }; - } - }); -} diff --git a/packages/typedoc-plugin-markdown/.docs/typedoc.dev.json b/packages/typedoc-plugin-markdown/.docs/typedoc.dev.json new file mode 100644 index 000000000..5b8ff2946 --- /dev/null +++ b/packages/typedoc-plugin-markdown/.docs/typedoc.dev.json @@ -0,0 +1,115 @@ +{ + "entryPoints": [ + "../src/app", + "../src/options", + "../src/internationalization", + "../src/theme", + "../src/libs" + ], + + "sortEntryPoints": false, + "sort": ["source-order"], + "excludeReferences": true, + "plugin": [ + "typedoc-plugin-markdown", + "typedoc-plugin-remark", + "./plugins/typedoc-default-values.js" + ], + "remarkPlugins": [ + [ + "remark-toc", + { + "heading": "Table of Contents", + "tight": true, + "maxDepth": 2, + "skip": "Enumeration Members|Type declaration|Defined in|Parameters|Remarks|See|Returns" + } + ] + ], + "groupOrder": [ + "Functions", + "Namespaces", + "Enumerations", + "Classes", + "Interfaces", + "*" + ], + + "out": "./devdocs", + "useCodeBlocks": true, + "indexFormat": "table", + "expandParameters": false, + "hideGroupHeadings": true, + "parametersFormat": "table", + "enumMembersFormat": "table", + "outputFileStrategy": "members", + "membersWithOwnFile": ["Class", "Interface", "TypeAlias", "Enum"], + "includeVersion": true, + "readme": "none", + "mergeReadme": true, + "categorizeByGroup": false, + "categoryOrder": [ + "Application", + "Theme", + "Options", + "Page Partials", + "Container Partials", + "Member Partials", + "Comment Partials", + "Type Partials", + "*" + ], + "excludeExternals": true, + "typeDeclarationFormat": "list", + "tableColumnSettings": { + "hideSources": true + }, + "externalSymbolLinkMappings": { + "typedoc": { + "ArrayType": "https://typedoc.org/api/types/Models.ArrayType.html", + "Application": "https://typedoc.org/api/classes/Application.html", + "Comment": "https://typedoc.org/api/types/Models.Comment.html", + "CommentDisplayPart": "https://typedoc.org/api/types/Models.CommentDisplayPart.html", + "ConditionalType": "https://typedoc.org/api/types/Models.ConditionalType.html", + "ContainerReflection": "https://typedoc.org/api/classes/Models.ContainerReflection.html", + "DeclarationHierarchy": "https://typedoc.org/api/classes/Models.DeclarationHierarchy.html", + "DeclarationReflection": "https://typedoc.org/api/classes/Models.DeclarationReflection.html", + "DefaultThemeRenderContext": "https://typedoc.org/api/classes/DefaultThemeRenderContext.html", + "Event": "https://typedoc.org/api/classes/Event.html", + "EventHooks": "https://typedoc.org/api/classes/EventHooks.html", + "IndexedAccessType": "https://typedoc.org/api/types/Models.IndexedAccessType.html", + "InferredType": "https://typedoc.org/api/types/Models.InferredType.html", + "IntersectionType": "https://typedoc.org/api/types/Models.IntersectionType.html", + "IntrinsicType": "https://typedoc.org/api/types/Models.IntrinsicType.html", + "LiteralType": "https://typedoc.org/api/types/Models.LiteralType.html", + "NamedTupleMember": "https://typedoc.org/api/types/Models.NamedTupleMember.html", + "ManuallyValidatedOption": "https://typedoc.org/api/types/Configuration.ManuallyValidatedOption.html", + "Options": "https://typedoc.org/api/classes/Configuration.Options.html", + "PageEvent": "https://typedoc.org/api/classes/PageEvent.html", + "ParameterReflection": "https://typedoc.org/api/classes/Models.ParameterReflection.html", + "ProjectReflection": "https://typedoc.org/api/classes/Models.ProjectReflection.html", + "ReferenceReflection": "https://typedoc.org/api/classes/Models.ReferenceReflection.html", + "ReferenceType": "https://typedoc.org/api/classes/Models.ReferenceType.html", + "Renderer": "https://typedoc.org/api/classes/Renderer.html", + "RendererEvent": "https://typedoc.org/api/classes/RendererEvent.html", + "RenderTemplate": "https://typedoc.org/api/types/RenderTemplate.html", + "Reflection": "https://typedoc.org/api/classes/Models.Reflection.html", + "ReflectionCategory": "https://typedoc.org/api/types/Models.ReflectionCategory.html", + "ReflectionFlags": "https://typedoc.org/api/classes/Models.ReflectionFlags.html", + "ReflectionGroup": "https://typedoc.org/api/classes/Models.ReflectionGroup.html", + "ReflectionKind": "https://typedoc.org/api/enums/Models.ReflectionKind-1.html", + "ReflectionType": "https://typedoc.org/api/classes/Models.ReflectionType.html", + "SignatureReflection": "https://typedoc.org/api/classes/Models.SignatureReflection.html", + "SomeType": "https://typedoc.org/api/classes/Models.SomeType.html", + "TypeParameterReflection": "https://typedoc.org/api/classes/Models.TypeParameterReflection.html", + "Theme": "https://typedoc.org/api/classes/Theme.html", + "TypeDocOptions": "https://typedoc.org/api/interfaces/TypeDocOptions.html", + "TypeOperatorType": "https://typedoc.org/api/interfaces/TypeOperatorType.html", + "TupleType": "https://typedoc.org/api/classes/Models.TupleType.html", + "QueryType": "https://typedoc.org/api/types/Models.QueryType.html", + "UnknownType": "https://typedoc.org/api/types/Models.UnknownType.html", + "UnionType": "https://typedoc.org/api/types/Models.UnionType.html", + "UrlMapping": "https://typedoc.org/api/classes/UrlMapping.html" + } + } +} diff --git a/packages/typedoc-plugin-markdown/.docs/typedoc.html.json b/packages/typedoc-plugin-markdown/.docs/typedoc.html.json new file mode 100644 index 000000000..63bbe519b --- /dev/null +++ b/packages/typedoc-plugin-markdown/.docs/typedoc.html.json @@ -0,0 +1,88 @@ +{ + "entryPoints": [ + "../src/bootstrap.ts", + "../src/app", + "../src/options", + "../src/internationalization", + "../src/theme", + "../src/libs", + "../src/types" + ], + "plugin": [ + "./plugins/typedoc-nextra.mjs", + "./plugins/typedoc-ignore-typeparam.mjs" + ], + "out": "./html", + "sortEntryPoints": false, + "name": "API", + "readme": "none", + "sort": ["required-first", "source-order"], + "includeVersion": false, + "categoryOrder": [ + "Application", + "Theme", + "Options", + "Page Partials", + "Container Partials", + "Member Partials", + "Comment Partials", + "Type Partials", + "*" + ], + "disableSources": true, + "excludeInternal": true, + "excludeExternals": true, + "excludePrivate": true, + "navigation": { + "includeCategories": true, + "includeGroups": false + }, + "externalSymbolLinkMappings": { + "typedoc": { + "ArrayType": "https://typedoc.org/api/types/Models.ArrayType.html", + "Application": "https://typedoc.org/api/classes/Application.html", + "Comment": "https://typedoc.org/api/types/Models.Comment.html", + "CommentDisplayPart": "https://typedoc.org/api/types/Models.CommentDisplayPart.html", + "ConditionalType": "https://typedoc.org/api/types/Models.ConditionalType.html", + "ContainerReflection": "https://typedoc.org/api/classes/Models.ContainerReflection.html", + "DeclarationHierarchy": "https://typedoc.org/api/classes/Models.DeclarationHierarchy.html", + "DeclarationReflection": "https://typedoc.org/api/classes/Models.DeclarationReflection.html", + "DefaultThemeRenderContext": "https://typedoc.org/api/classes/DefaultThemeRenderContext.html", + "Event": "https://typedoc.org/api/classes/Event.html", + "EventHooks": "https://typedoc.org/api/classes/EventHooks.html", + "IndexedAccessType": "https://typedoc.org/api/types/Models.IndexedAccessType.html", + "InferredType": "https://typedoc.org/api/types/Models.InferredType.html", + "IntersectionType": "https://typedoc.org/api/types/Models.IntersectionType.html", + "IntrinsicType": "https://typedoc.org/api/types/Models.IntrinsicType.html", + "LiteralType": "https://typedoc.org/api/types/Models.LiteralType.html", + "NamedTupleMember": "https://typedoc.org/api/types/Models.NamedTupleMember.html", + "ManuallyValidatedOption": "https://typedoc.org/api/types/Configuration.ManuallyValidatedOption.html", + "Options": "https://typedoc.org/api/classes/Configuration.Options.html", + "PageEvent": "https://typedoc.org/api/classes/PageEvent.html", + "ParameterReflection": "https://typedoc.org/api/classes/Models.ParameterReflection.html", + "ProjectReflection": "https://typedoc.org/api/classes/Models.ProjectReflection.html", + "ReferenceReflection": "https://typedoc.org/api/classes/Models.ReferenceReflection.html", + "ReferenceType": "https://typedoc.org/api/classes/Models.ReferenceType.html", + "Renderer": "https://typedoc.org/api/classes/Renderer.html", + "RendererEvent": "https://typedoc.org/api/classes/RendererEvent.html", + "RenderTemplate": "https://typedoc.org/api/types/RenderTemplate.html", + "Reflection": "https://typedoc.org/api/classes/Models.Reflection.html", + "ReflectionCategory": "https://typedoc.org/api/types/Models.ReflectionCategory.html", + "ReflectionFlags": "https://typedoc.org/api/classes/Models.ReflectionFlags.html", + "ReflectionGroup": "https://typedoc.org/api/classes/Models.ReflectionGroup.html", + "ReflectionKind": "https://typedoc.org/api/enums/Models.ReflectionKind-1.html", + "ReflectionType": "https://typedoc.org/api/classes/Models.ReflectionType.html", + "SignatureReflection": "https://typedoc.org/api/classes/Models.SignatureReflection.html", + "SomeType": "https://typedoc.org/api/classes/Models.SomeType.html", + "TypeParameterReflection": "https://typedoc.org/api/classes/Models.TypeParameterReflection.html", + "Theme": "https://typedoc.org/api/classes/Theme.html", + "TypeDocOptions": "https://typedoc.org/api/interfaces/TypeDocOptions.html", + "TypeOperatorType": "https://typedoc.org/api/interfaces/TypeOperatorType.html", + "TupleType": "https://typedoc.org/api/classes/Models.TupleType.html", + "QueryType": "https://typedoc.org/api/types/Models.QueryType.html", + "UnknownType": "https://typedoc.org/api/types/Models.UnknownType.html", + "UnionType": "https://typedoc.org/api/types/Models.UnionType.html", + "UrlMapping": "https://typedoc.org/api/classes/UrlMapping.html" + } + } +} diff --git a/packages/typedoc-plugin-markdown/.docs/typedoc.json b/packages/typedoc-plugin-markdown/.docs/typedoc.json index baaa0cd61..c788097e7 100644 --- a/packages/typedoc-plugin-markdown/.docs/typedoc.json +++ b/packages/typedoc-plugin-markdown/.docs/typedoc.json @@ -1,5 +1,5 @@ { - "entryPoints": ["../src/public-api.ts"], + "entryPoints": ["../src/index.ts"], "plugin": [ "typedoc-plugin-markdown", "./plugins/typedoc-nextra.mjs", @@ -9,14 +9,22 @@ "publicPath": "/api-docs", "indexFormat": "table", "mergeReadme": true, - "leftAlignTableHeaders": true, "entryFileName": "index.md", "hideBreadcrumbs": true, "hidePageHeader": true, - "excludeGroups": true, + "excludeGroups": false, + "expandObjects": true, "parametersFormat": "table", + "expandParameters": false, + "tableColumnSettings": { + "hideOverrides": true, + "hideModifiers": true, + "hideDefaults": true, + "hideSources": true, + "leftAlignHeaders": true + }, "outputFileStrategy": "members", - "useCodeBlocks": false, + "useCodeBlocks": true, "textContentMappings": { "title.memberPage": "{name}" }, diff --git a/packages/typedoc-plugin-markdown/.scripts/prebuild-kinds.ts b/packages/typedoc-plugin-markdown/.scripts/prebuild-kinds.ts deleted file mode 100644 index ab20b3aca..000000000 --- a/packages/typedoc-plugin-markdown/.scripts/prebuild-kinds.ts +++ /dev/null @@ -1,90 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import * as prettier from 'prettier'; -import { ReflectionKind } from 'typedoc'; - -export async function prebuildKinds() { - const themeRenderKindConstantsFile = path.join( - __dirname, - '..', - 'src', - 'options', - 'text-mappings', - 'kind-defaults.ts', - ); - - const kinds = [ - { key: 'accessor', kind: ReflectionKind.Accessor }, - { key: 'class', kind: ReflectionKind.Class }, - { key: 'constructor', kind: ReflectionKind.Constructor }, - { key: 'enum', kind: ReflectionKind.Enum }, - { key: 'enumMember', kind: ReflectionKind.EnumMember }, - { key: 'event', kind: undefined }, - { key: 'function', kind: ReflectionKind.Function }, - { key: 'interface', kind: ReflectionKind.Interface }, - { key: 'method', kind: ReflectionKind.Method }, - { key: 'module', kind: ReflectionKind.Module }, - { key: 'namespace', kind: ReflectionKind.Namespace }, - { key: 'variable', kind: ReflectionKind.Variable }, - { key: 'parameter', kind: ReflectionKind.Parameter }, - { key: 'property', kind: ReflectionKind.Property }, - { key: 'reference', kind: ReflectionKind.Reference }, - { key: 'typeAlias', kind: ReflectionKind.TypeAlias }, - { key: 'typeParameter', kind: ReflectionKind.TypeParameter }, - ]; - - const kindsString: string[] = []; - - const capitalize = (s: string) => s && s[0].toUpperCase() + s.slice(1); - - const singularString = (kind: any) => - kind.kind ? ReflectionKind.singularString(kind.kind) : capitalize(kind.key); - - const pluralString = (kind: any) => - kind.kind - ? ReflectionKind.pluralString(kind.kind) - : `${capitalize(kind.key)}s`; - - kindsString.push(` - // THIS FILE IS AUTOGENERATED - DO NOT EDIT DIRECTLY - - export const KIND_DEFAULTS: Record = { - ${kinds - .map((kind) => { - return ` - 'kind.${kind.key}.singular':'${singularString(kind)}', - 'kind.${kind.key}.plural':'${pluralString(kind)}' - `; - }) - .join(',')} - } - `); - - kindsString.push(` - export const SINGULAR_KIND_KEY_MAP: Record = { - ${kinds - .map((kind) => { - return `['${singularString(kind)}']: 'kind.${kind.key}.singular'`; - }) - .join(',')} - } - `); - - kindsString.push(` - export const PLURAL_KIND_KEY_MAP: Record= { - ${kinds - .map((kind) => { - return `['${pluralString(kind)}']: 'kind.${kind.key}.plural'`; - }) - .join(',')} - } - `); - - const formattedKinds = await prettier.format(kindsString.join('\n'), { - parser: 'typescript', - singleQuote: true, - trailingComma: 'all', - }); - - fs.writeFileSync(themeRenderKindConstantsFile, formattedKinds); -} diff --git a/packages/typedoc-plugin-markdown/.scripts/prebuild-resources.ts b/packages/typedoc-plugin-markdown/.scripts/prebuild-resources.ts index 2c7bd7816..e66ad15ec 100644 --- a/packages/typedoc-plugin-markdown/.scripts/prebuild-resources.ts +++ b/packages/typedoc-plugin-markdown/.scripts/prebuild-resources.ts @@ -7,11 +7,9 @@ const project = new Project({ tsConfigFilePath: 'tsconfig.json', }); -const resourcesPath = path.join(__dirname, '..', 'src', 'theme', 'resources'); +const resourcesPath = path.join(__dirname, '..', 'src', 'theme', 'context'); export async function prebuildResources() { - writeLibsBarrelsFile('markdown'); - writeLibsBarrelsFile('utils'); writeResourcesFile(); } @@ -37,23 +35,27 @@ function getSymbols(files: string[], type: string, thePath = resourcesPath) { ?.getParameters() .filter((parameter) => parameter.getName() !== 'context') .map((parameter) => { - const typeunions = parameter - .getType() - .getText() - .split('|') - .map((unions) => { - const union = unions.split('.'); - const isKeyOf = union[0].startsWith('keyof'); - if (union[1] && union[1].startsWith('MarkdownPageEvent')) { - return `MarkdownPageEvent<${union[union.length - 1]}`; - } - const typeParts: string[] = []; - if (isKeyOf) { - typeParts.push('keyof'); - } - typeParts.push(union[union.length - 1]); - return typeParts.join(' '); - }); + let parameterTextType = parameter.getType().getText(); + if (parameterTextType.startsWith('{')) { + parameterTextType = parameterTextType.replace( + /import\(".*"\)\.([a-zA-Z_][a-zA-Z0-9_]*)/g, + '$1', + ); + } + const typeunions = parameterTextType.split('|').map((unions) => { + const union = unions.split('.'); + const isKeyOf = union[0].startsWith('keyof'); + if (union[1] && union[1].startsWith('MarkdownPageEvent')) { + return `MarkdownPageEvent<${union[union.length - 1]}`; + } + const typeParts: string[] = []; + if (isKeyOf) { + typeParts.push('keyof'); + } + typeParts.push(union[union.length - 1]); + return typeParts.join(' '); + }); + const name = parameter.getName(); const isOptional = parameter.isOptional(); const initializer = parameter.getInitializer(); @@ -102,53 +104,14 @@ function getReturnType(returnTypeParts?: string) { .join('|'); } -function writeLibsBarrelsFile(resourceType: string) { - const libsPath = path.join(__dirname, '..', 'src', 'libs'); - const folder = path.join(libsPath, resourceType); - const files = fs - .readdirSync(folder) - .map((partialsFile) => path.parse(partialsFile).name) - .filter((file) => file !== 'index' && !file.endsWith('spec')); - - const symbols = getSymbols(files, resourceType, libsPath); - const barrelsFile = path.join( - __dirname, - '..', - 'src', - 'libs', - resourceType, - 'index.ts', - ); - - const barrelsFileComments = fs.existsSync(barrelsFile) - ? fs - .readFileSync(barrelsFile) - .toString() - .match(/\/\*[\s\S]*?\*\//) - : null; - - const out: string[] = [ - `${barrelsFileComments ? barrelsFileComments[0] : ''} - -// PLEASE NOTE: THE CONTENTS OF THE FILE BELOW THIS POINT IS AUTO GENERATED! -`, - ]; - - files.forEach((file, index) => { - out.push(`export { ${symbols[index].symbolName} } from './${file}';`); - }); - - fs.outputFileSync(barrelsFile, out.join('\n').trim() + '\n'); -} - async function writeResourcesFile() { const resourcesFile = path.join( __dirname, '..', 'src', 'theme', - 'resources', - 'index.ts', + 'context', + 'resources.ts', ); fs.rmSync(resourcesFile, { force: true }); @@ -188,19 +151,14 @@ async function writeResourcesFile() { ]; const out = `// THIS FILE IS AUTO GENERATED. DO NOT EDIT DIRECTLY. -import { MarkdownPageEvent } from '@plugin/app/events'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownPageEvent } from 'app/events'; +import { MarkdownThemeContext } from 'theme'; import {${typedocTypes.join(',')}} from 'typedoc'; - - -${getResourceImports('templates')} -${getResourceImports('partials')} -${getResourceImports('helpers')} +import { templates, partials, helpers } from './index'; ${getResources('templates')} ${getResources('partials')} ${getResources('helpers')} - `; const formattedOut = await prettier.format(out, { @@ -208,43 +166,33 @@ ${getResources('helpers')} singleQuote: true, trailingComma: 'all', }); - fs.writeFileSync(resourcesFile, formattedOut); -} -function getResourceImports(resourceType: string) { - const files = getFiles(resourceType).filter( - (file) => file !== 'index' && !file.endsWith('spec'), - ); - const symbols = getSymbols(files, resourceType); - return files - .map((file, index) => { - return `import {${symbols[index].symbolName} } from './${resourceType}/${file}'; - `; - }) - .join(''); + fs.writeFileSync(resourcesFile, formattedOut); } function getResources(resourceType: string, binding = true) { const files = getFiles(resourceType).filter( - (file) => file !== 'index' && !file.endsWith('spec'), + (file) => file !== 'index' && file !== '_index' && !file.endsWith('spec'), ); const symbols = getSymbols(files, resourceType); return ` - - export const ${resourceType} = (${binding ? `context: MarkdownThemeContext` : ''}) => { + export const resource${resourceType.charAt(0).toUpperCase()}${resourceType.slice(1)} = (${binding ? `context: MarkdownThemeContext` : ''}) => { return { ${symbols .map((symbol) => { return ` ${symbol.jsDocs} + /** @ignore **/ ${symbol.symbolName}: (${symbol.params ?.filter((param) => param.name !== 'this') .map( (param) => `${param.name}${param.isOptional && !param.hasInitializer ? '?' : ''}:${param.type}${param.hasInitializer ? `=${param.defaultValue}` : ''}`, ) - .join(',')}) => ${symbol.symbolName}.apply(context,[${symbol.params + .join( + ',', + )}) => ${resourceType}.${symbol.symbolName}.apply(context,[${symbol.params ?.filter((param) => param.name !== 'this') .map((param) => param.name) .join(',')}]) as ${symbol.returnType} diff --git a/packages/typedoc-plugin-markdown/DEVELOP.md b/packages/typedoc-plugin-markdown/DEVELOP.md new file mode 100644 index 000000000..5f84a19c1 --- /dev/null +++ b/packages/typedoc-plugin-markdown/DEVELOP.md @@ -0,0 +1,9 @@ +# typedoc-plugin-markdown + +This guide will help you get started: + +The code is divided into some understandable areas. + +- Have a look at the { @link bootstrap } module to see how plugin is initialized. +- See the { @link theme } module contains the custom Markdown theme that is exposed. +- The { @link libs } module contains general pure methods and functions. diff --git a/packages/typedoc-plugin-markdown/OPTIONS.md b/packages/typedoc-plugin-markdown/OPTIONS.md new file mode 100644 index 000000000..799989fa4 --- /dev/null +++ b/packages/typedoc-plugin-markdown/OPTIONS.md @@ -0,0 +1,14 @@ +--- +title: Adding Options +description: This doc describes how to add options +--- + +# Adding Options + +This guide will help you get started: + +The code is divided into some understandable areas. + +- Have a look at the { @link bootstrap } module to see how plugin is initialized. +- See the { @link theme } module contains the custom Markdown theme that is exposed. +- The { @link libs } module contains general pure methods and functions. diff --git a/packages/typedoc-plugin-markdown/barrelsby.config.json b/packages/typedoc-plugin-markdown/barrelsby.config.json new file mode 100644 index 000000000..b68b61472 --- /dev/null +++ b/packages/typedoc-plugin-markdown/barrelsby.config.json @@ -0,0 +1,15 @@ +{ + "delete": true, + "directory": [ + "./src/libs/markdown", + "./src/libs/utils", + "./src/theme/context/templates", + "./src/theme/context/partials", + "./src/theme/context/helpers" + ], + "exclude": ".*\\.spec\\.ts|^index\\.ts$", + "location": "top", + "name": "_index.ts", + "singleQuotes": true, + "noHeader": true +} diff --git a/packages/typedoc-plugin-markdown/package.json b/packages/typedoc-plugin-markdown/package.json index 8452738a2..53da5cafc 100644 --- a/packages/typedoc-plugin-markdown/package.json +++ b/packages/typedoc-plugin-markdown/package.json @@ -9,7 +9,7 @@ "scripts": { "lint": "eslint ./src --ext .ts", "prepublishOnly": "npm run lint && npm run build", - "prebuild": "rm -rf dist && prebuild-options && ts-node ./.scripts/prebuild", + "prebuild": "rm -rf dist && barrelsby -c barrelsby.config.json && prebuild-options && ts-node ./.scripts/prebuild", "build": "tsc && tsc-alias", "build-and-run": "npm run build && npm run pretest", "pretest": "fixtures -c ./test/fixtures/config.ts", @@ -19,7 +19,9 @@ "test:update": "npm run build && npm run test -- -u", "support": "npm run schema && npm run docs", "schema": "ts-node ./.scripts/schema/generate-schema.ts", - "docs": "npm run build && typedoc --options ./.docs/typedoc.json" + "docs": "npm run build && typedoc --options ./.docs/typedoc.json", + "docs:html": "typedoc --options ./.docs/typedoc.html.json", + "docs:dev": "npm run build && typedoc --options ./.docs/typedoc.dev.json" }, "author": "Thomas Grey", "license": "MIT", diff --git a/packages/typedoc-plugin-markdown/src/defs/typedoc.d.ts b/packages/typedoc-plugin-markdown/src/_typedoc.d.ts similarity index 74% rename from packages/typedoc-plugin-markdown/src/defs/typedoc.d.ts rename to packages/typedoc-plugin-markdown/src/_typedoc.d.ts index d619d7734..e554b6855 100644 --- a/packages/typedoc-plugin-markdown/src/defs/typedoc.d.ts +++ b/packages/typedoc-plugin-markdown/src/_typedoc.d.ts @@ -1,6 +1,5 @@ // THIS FILE IS AUTO GENERATED FROM THE OPTIONS CONFIG. DO NOT EDIT DIRECTLY. import { ManuallyValidatedOption } from 'typedoc'; -import { TextContentMappings } from '../options/option-types'; declare module 'typedoc' { export interface TypeDocOptionMap { anchorPrefix: string; @@ -17,9 +16,7 @@ declare module 'typedoc' { hideGroupHeadings: boolean; hidePageHeader: boolean; hidePageTitle: boolean; - indexFormat: 'list' | 'table' | 'htmlTable'; - inlineDocuments: boolean; - leftAlignTableHeaders: boolean; + indexFormat: 'list' | 'table'; membersWithOwnFile: ( | 'Enum' | 'Variable' @@ -40,14 +37,23 @@ declare module 'typedoc' { propertiesFormat: 'list' | 'table' | 'htmlTable'; publicPath: string; sanitizeComments: boolean; - tableColumnVisibility: { + tableColumnSettings: { hideDefaults: boolean; hideInherited: boolean; hideModifiers: boolean; hideOverrides: boolean; hideSources: boolean; + hideValues: boolean; + leftAlignHeaders: boolean; }; - textContentMappings: ManuallyValidatedOption>; + textContentMappings: ManuallyValidatedOption<{ + 'header.title': string; + 'header.docs': string; + 'breadcrumbs.home': string; + 'title.indexPage': string; + 'title.memberPage': string; + 'footer.text': string; + }>; typeDeclarationFormat: 'list' | 'table' | 'htmlTable'; useCodeBlocks: boolean; useHTMLAnchors: boolean; @@ -56,27 +62,17 @@ declare module 'typedoc' { // eslint-disable-next-line @typescript-eslint/no-namespace export namespace Internationalization { export interface TranslatableStrings { - theme_header_title: [string, string]; - theme_header_docs: []; - theme_breadcrumbs_home: [string, string]; - theme_title_index_page: [string, string]; - theme_title_member_page: [string, string]; - theme_title_module_page: [string]; - theme_footer_text: []; - theme_api_index: []; theme_default_value: []; + theme_default_type: []; theme_description: []; theme_event: []; theme_extends: []; theme_extended_by: []; - theme_flags: []; - theme_globals: []; theme_member: []; theme_member_plural: []; theme_modifier: []; theme_name: []; theme_packages: []; - theme_source: []; theme_type: []; theme_value: []; theme_version: []; diff --git a/packages/typedoc-plugin-markdown/src/app/_initialize.ts b/packages/typedoc-plugin-markdown/src/app/_initialize.ts new file mode 100644 index 000000000..532189964 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/app/_initialize.ts @@ -0,0 +1,122 @@ +/** + * Initialization and bootstrapping of the plugin. + * + * @module + */ + +import { MarkdownRendererHooks } from 'app/types'; +import { getTranslatable } from 'internationalization/translatable'; +import { declarations } from 'options'; +import { MarkdownTheme } from 'theme'; +import { + Application, + Context, + Converter, + DeclarationOption, + EventHooks, + Renderer, + Theme, +} from 'typedoc'; +import { + generateDocsOverride, + renderOverride, + resolvePackages, +} from './renderer'; + +/** + * This method is exposed to the `"plugin"` configuration option and contains all initialization functionality. + * + * @remarks + * + * The following initialization steps are taken in this method: + * + * **1. Declare options:** + * + * - Iterate over declaration definitions and to the container. + * + * **2. Replace default theme:** + * + * - Replace the default HTML theme the with the {@link MarkdownTheme} + * + * **3. Override TypeDoc methods:** + * + * - Intercept and modify some TypeDoc core methods that are coupled to the HTML theme. + * - TODO: Ideally there would be proper decoupling in the TypeDoc core between the {@link Application} and {@link Renderer} which requires further investigation. + * + * **4. Configure localization:** + * + * - Load the additional translations used by the theme for the selected language. + * + * @param app - When loaded TypeDoc provides an instance of the {@link Application} referred to as the `"pluginHost"`. + * + * @see https://typedoc.org/guides/development/#plugins. + * + */ +export function load(app: Application) { + /** + * ================== + * 1. Declare Options + * ================== + */ + Object.entries(declarations).forEach(([name, declaration]) => { + app.options.addDeclaration({ + name, + ...declaration, + } as DeclarationOption); + }); + + /** + * ================================================= + * 2. Replace default theme with the Markdown themes + * ================================================= + */ + + Object.defineProperty(app.renderer, 'themes', { + value: new Map Theme>([ + ['default', MarkdownTheme], + ]), + }); + + /** + * ================================================= + * 3. Intercept and modify some TypeDoc core methods + * ================================================= + */ + + Object.defineProperty(app, 'generateDocs', { + value: generateDocsOverride, + }); + + Object.defineProperty(app.renderer, 'render', { + value: renderOverride, + }); + + Object.defineProperty(app.renderer, 'markdownHooks', { + value: new EventHooks(), + }); + + /** + * ============================ + * 3. Configure localization + * ============================ + */ + app.converter.on(Converter.EVENT_BEGIN, () => { + app.internationalization.addTranslations( + app.options.getValue('lang'), + { ...getTranslatable(app) }, + true, + ); + }); + + /** + * ============================ + * 4. Apply any other behaviour + * ============================ + */ + + app.converter.on(Converter.EVENT_RESOLVE_END, (context: Context) => { + if (app.options.packageDir) { + resolvePackages(app, context, app.options.packageDir); + } + }); +} diff --git a/packages/typedoc-plugin-markdown/src/app/application.ts b/packages/typedoc-plugin-markdown/src/app/application.ts deleted file mode 100644 index 9aab428e4..000000000 --- a/packages/typedoc-plugin-markdown/src/app/application.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { MarkdownRendererEvent } from '@plugin/app/events/markdown-renderer-event'; -import { MarkdownTheme } from '@plugin/theme/markdown-theme'; -import { Application, EventHooks, Options, Renderer } from 'typedoc'; -import { MarkdownRendererHooks } from './renderer/markdown-renderer-hooks'; - -/** - * An extended typing of TypeDoc's Application instance. - * - * This is essentially a copy of the main class with the `renderer` property overridden to the custom {@link MarkdownRenderer}. - * - * ## Usage - * - * ```ts - * import {MarkdownApplication} from 'typedoc-plugin-markdown'; - * - * export function load(app: MarkdownApplication) { - * ... - * } - * ``` - * - * @category Application - */ -export interface MarkdownApplication extends Application { - renderer: MarkdownRenderer; -} - -/** - * An extended typing of TypeDoc's Renderer class. - * - * Includes updated typings for hooks and async jobs. - * - * ## Usage - * - * ```ts - * import { MarkdownApplication } from 'typedoc-plugin-markdown'; - * - * export function load(app: MarkdownApplication) { - * - * app.renderer.markdownHooks.on( - * 'page.begin', () => '> This is some markdown at the top of the page', - * ); - * - * app.renderer.preRenderAsyncJobs.push(async (event) => { - * await doSomethingAsync(event); - * }); - - * app.renderer.postRenderAsyncJobs.push(async (event) => { - * await doSomethingAsync(event); - * }); - * - * } - * ``` - * - * @category Application - */ -export interface MarkdownRenderer extends Renderer { - markdownHooks: EventHooks; - /** @internal */ - packagesMeta: Record; - /** @internal */ - defineTheme: ( - name: string, - theme: new (renderer: MarkdownRenderer) => MarkdownTheme, - ) => void; - preRenderAsyncJobs: Array<(output: MarkdownRendererEvent) => Promise>; - postRenderAsyncJobs: Array<(output: MarkdownRendererEvent) => Promise>; -} diff --git a/packages/typedoc-plugin-markdown/src/app/events/index.ts b/packages/typedoc-plugin-markdown/src/app/events/index.ts index 8432ba8e4..81fa0bf4c 100644 --- a/packages/typedoc-plugin-markdown/src/app/events/index.ts +++ b/packages/typedoc-plugin-markdown/src/app/events/index.ts @@ -1,2 +1,7 @@ -export { MarkdownPageEvent } from './markdown-page-event'; -export { MarkdownRendererEvent } from './markdown-renderer-event'; +/** + * Contains all the events and overrides of the typedoc Application. + * + * @module + */ +export * from './markdown-page-event'; +export * from './markdown-renderer-event'; diff --git a/packages/typedoc-plugin-markdown/src/app/events/markdown-page-event.ts b/packages/typedoc-plugin-markdown/src/app/events/markdown-page-event.ts index bbe9e2b4e..e7a296497 100644 --- a/packages/typedoc-plugin-markdown/src/app/events/markdown-page-event.ts +++ b/packages/typedoc-plugin-markdown/src/app/events/markdown-page-event.ts @@ -3,7 +3,7 @@ import { Event, ProjectReflection, Reflection } from 'typedoc'; /** * An event emitted by before and after the markup of a page is rendered. * - * ## Usage + * @example * * ```ts * export function load(app: MarkdownApplication) { @@ -13,35 +13,35 @@ import { Event, ProjectReflection, Reflection } from 'typedoc'; * }); * ``` * - * @category Application */ export class MarkdownPageEvent< /** @ignore **/ Model = Reflection, > extends Event { /** - * The project the renderer is currently processing. + * The {@linkcode typedoc!ProjectReflection ProjectReflection} instance the renderer is currently processing. */ project!: ProjectReflection; /** - * The model that should be rendered on this page. + * The model that that is being rendered on this page. + * Either a {@linkcode typedoc!DeclarationReflection DeclarationReflection} or {@linkcode typedoc!ProjectReflection ProjectReflection}. */ readonly model: Model; /** - * The final markdown content of this page. + * The final markdown `string` content of the page. * * Should be rendered by layout templates and can be modified by plugins. */ contents?: string; /** - * The url this page will be located at. + * The url `string` of the page. */ url!: string; /** - * The filename the page will be written to. + * The complete `string` filename where the file will be written.. */ filename!: string; diff --git a/packages/typedoc-plugin-markdown/src/app/events/markdown-renderer-event.ts b/packages/typedoc-plugin-markdown/src/app/events/markdown-renderer-event.ts index a58034dca..0f23a74bd 100644 --- a/packages/typedoc-plugin-markdown/src/app/events/markdown-renderer-event.ts +++ b/packages/typedoc-plugin-markdown/src/app/events/markdown-renderer-event.ts @@ -1,29 +1,17 @@ -/** - * Extends the RendererEvent from TypeDoc to expose navigation property. - * - */ - -import { MarkdownPageEvent } from '@plugin/app/events/markdown-page-event'; -import { - NavigationItem, - RenderTemplate, - UrlMapping, -} from '@plugin/theme/theme-types'; +import { MarkdownPageEvent } from 'app/events'; import * as path from 'path'; +import { NavigationItem, RenderTemplate, UrlMapping } from 'theme/types'; import { Event, ProjectReflection, Reflection } from 'typedoc'; /** * An event emitted at the beginning and end of the rendering process. * - * ## Usage - * * ```ts * app.renderer.on(MarkdownRendererEvent.BEGIN, (event) => { * console.log(`Render Starting for ${event.project.name}!`); * }); * ``` * - * @category Application */ export class MarkdownRendererEvent extends Event { /** diff --git a/packages/typedoc-plugin-markdown/src/app/index.ts b/packages/typedoc-plugin-markdown/src/app/index.ts new file mode 100644 index 000000000..e1535daae --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/app/index.ts @@ -0,0 +1,9 @@ +/** + * Contains all the events and overrides of the typedoc Application. + * + * @module + */ +export * as initialize from './_initialize'; +export * as events from './events'; +export * as renderer from './renderer'; +export * as types from './types'; diff --git a/packages/typedoc-plugin-markdown/src/app/renderer/overrides.ts b/packages/typedoc-plugin-markdown/src/app/renderer.ts similarity index 76% rename from packages/typedoc-plugin-markdown/src/app/renderer/overrides.ts rename to packages/typedoc-plugin-markdown/src/app/renderer.ts index 56528f0e8..334d0ac7c 100644 --- a/packages/typedoc-plugin-markdown/src/app/renderer/overrides.ts +++ b/packages/typedoc-plugin-markdown/src/app/renderer.ts @@ -1,9 +1,17 @@ -import { MarkdownPageEvent } from '@plugin/app/events/markdown-page-event'; -import { MarkdownRendererEvent } from '@plugin/app/events/markdown-renderer-event'; +/** + * Contains override methods to decouple HTML logic from the TypeDoc's Renderer} + * + * + * @module + */ + +import { MarkdownPageEvent, MarkdownRendererEvent } from 'app/events'; +import { MarkdownRenderer } from 'app/types'; import * as fs from 'fs'; import * as path from 'path'; import { Application, + Context, DeclarationReflection, DocumentReflection, ProjectReflection, @@ -11,19 +19,14 @@ import { Renderer, } from 'typedoc'; -/** - * Contains functionality to decouple HTML logic from the TypeDoc's {@link Renderer}. - * - * @todo Investigate ways to properly decouple HTML logic from the TypeDoc renderer. - * - * @module - */ - /** * Replacement of TypeDoc's {@link Application.generateDocs} method to decouple HTML logic. * */ -export async function generateDocs(project: ProjectReflection, out: string) { +export async function generateDocsOverride( + project: ProjectReflection, + out: string, +) { const start = Date.now(); await this.renderer.render(project, out); if (this.logger.hasErrors()) { @@ -45,7 +48,7 @@ export async function generateDocs(project: ProjectReflection, out: string) { * - Removes hooks logic that are jsx specific. * - Adds any logic specific to markdown rendering. */ -export async function render( +export async function renderOverride( project: ProjectReflection, outputDirectory: string, ) { @@ -86,7 +89,7 @@ export async function render( this.preRenderAsyncJobs = []; - if (!output.isDefaultPrevented) { + if (!output.isDefaultPrevented()) { this.application.logger.verbose( `There are ${output.urls?.length} pages to write.`, ); @@ -103,7 +106,7 @@ export async function render( this.trigger(MarkdownPageEvent.BEGIN, page); - if (page.isDefaultPrevented) { + if (page.isDefaultPrevented()) { return false; } @@ -115,7 +118,7 @@ export async function render( this.trigger(MarkdownPageEvent.END, page); - if (page.isDefaultPrevented) { + if (page.isDefaultPrevented()) { return false; } @@ -136,6 +139,36 @@ export async function render( this.theme = void 0; } +/** + * Currently options set for packages are only stored on the converter and are destroyed before being passed to the Renderer. + * + * By intercepting the package options set in the converter and storing them on the renderer we can use them later in the theme. + * + */ +export function resolvePackages( + app: Application, + context: Context, + packageDir: string, +) { + const packageJsonContents = fs + .readFileSync(path.join(packageDir, 'package.json')) + .toString(); + + const packageJson = packageJsonContents + ? JSON.parse(packageJsonContents) + : {}; + + const renderer = app.renderer as MarkdownRenderer; + + renderer.packagesMeta = { + ...(renderer.packagesMeta || {}), + [context.project.name]: { + description: packageJson.description, + options: app.options, + }, + }; +} + /** * Some useful utility functions - essentially cherry picked from: * diff --git a/packages/typedoc-plugin-markdown/src/app/renderer/index.ts b/packages/typedoc-plugin-markdown/src/app/renderer/index.ts deleted file mode 100644 index 7809a42cf..000000000 --- a/packages/typedoc-plugin-markdown/src/app/renderer/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './markdown-renderer-hooks'; -export * from './overrides'; -export * from './packages'; diff --git a/packages/typedoc-plugin-markdown/src/app/renderer/packages.ts b/packages/typedoc-plugin-markdown/src/app/renderer/packages.ts deleted file mode 100644 index 3c9254d8c..000000000 --- a/packages/typedoc-plugin-markdown/src/app/renderer/packages.ts +++ /dev/null @@ -1,28 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import { Application, Context } from 'typedoc'; -import { MarkdownRenderer } from '../application'; - -export function resolvePackages( - app: Application, - context: Context, - packageDir: string, -) { - const packageJsonContents = fs - .readFileSync(path.join(packageDir, 'package.json')) - .toString(); - - const packageJson = packageJsonContents - ? JSON.parse(packageJsonContents) - : {}; - - const renderer = app.renderer as MarkdownRenderer; - - renderer.packagesMeta = { - ...(renderer.packagesMeta || {}), - [context.project.name]: { - description: packageJson.description, - options: app.options, - }, - }; -} diff --git a/packages/typedoc-plugin-markdown/src/app/translatable.ts b/packages/typedoc-plugin-markdown/src/app/translatable.ts deleted file mode 100644 index 86f481f02..000000000 --- a/packages/typedoc-plugin-markdown/src/app/translatable.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { Application } from 'typedoc'; - -export function getTranslatable(app: Application) { - // read text content mappings for backward compatibility - const textContentMappings = app.options.getValue('textContentMappings'); - return { ...translatable, ...serializeTextContent(textContentMappings) }; -} - -export const translatable = { - // header - theme_header_title: '{0} {1}', // {projectName} {version}, - theme_header_docs: 'Docs', // displayed in the header when readme is resolved - - // breadcrumbs - theme_breadcrumbs_home: '{0} {1}', // {projectName} {version}, - - // titles - theme_title_index_page: '{0} {1}', // {projectName} {version}, - theme_title_member_page: '{0}: {1}', // {kind}: {name} - theme_title_module_page: '{0}', // {name}, - - // footer - theme_footer_text: '', - - // generic labels - theme_api_index: 'API Index', - theme_default_value: 'Default Value', - theme_description: 'Description', - theme_event: 'Event', - theme_extends: 'Extends', - theme_extended_by: 'Extended By', - theme_flags: 'Flags', - theme_globals: 'Globals', - theme_member: 'Member', - theme_member_plural: 'Members', - theme_modifier: 'Modifier', - theme_name: 'Name', - theme_packages: 'Packages', - theme_source: 'Source', - theme_type: 'Type', - theme_value: 'Value', - theme_version: 'Version', -}; - -/** - * textContentMappings is now deprecated. - * - * This method maps textContentMappings to translatable object to avoid a breaking options change. - * - * This method will be removed once textContentMappings is removed from options declaration. - * - */ -function serializeTextContent(textContentMappings: any) { - const output: { [key: string]: string } = {}; - for (const [key, value] of Object.entries(textContentMappings)) { - const newKey = 'theme_' + camelToSnakeCase(key.replace(/\./g, '_')); - let newValue = (value as any) - .replace(/{version}/g, '{1}') - .replace(/{kind}/g, '{0}') - .replace(/{projectName}/g, '{0}'); - if (newKey === 'theme_title_member_page') { - newValue = newValue.replace(/{name}/g, '{1}'); - } else { - newValue = newValue.replace(/{name}/g, '{0}'); - } - output[newKey] = newValue; - } - return output; -} - -function camelToSnakeCase(str: string) { - return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`); -} diff --git a/packages/typedoc-plugin-markdown/src/app/types/index.ts b/packages/typedoc-plugin-markdown/src/app/types/index.ts new file mode 100644 index 000000000..d0fa5478e --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/app/types/index.ts @@ -0,0 +1,8 @@ +/** + * Types used for the app. + * + * @module + */ +export * from './markdown-application'; +export * from './markdown-renderer'; +export * from './markdown-renderer-hooks'; diff --git a/packages/typedoc-plugin-markdown/src/app/types/markdown-application.ts b/packages/typedoc-plugin-markdown/src/app/types/markdown-application.ts new file mode 100644 index 000000000..51a272422 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/app/types/markdown-application.ts @@ -0,0 +1,23 @@ +import { Application } from 'typedoc'; +import { MarkdownRenderer } from './markdown-renderer'; + +/** + * This interface is essentially an extended typing of TypeDoc's {@linkcode typedoc!Application Application} instance. + * + * @example + * + * ```ts + * import { MarkdownApplication } from 'typedoc-plugin-markdown'; + * + * export function load(app: MarkdownApplication) { + * ... + * } + * ``` + * + */ +export interface MarkdownApplication extends Application { + /** + * Re-types the `renderer` instance to {@linkcode MarkdownRenderer }. + */ + renderer: MarkdownRenderer; +} diff --git a/packages/typedoc-plugin-markdown/src/app/renderer/markdown-renderer-hooks.ts b/packages/typedoc-plugin-markdown/src/app/types/markdown-renderer-hooks.ts similarity index 91% rename from packages/typedoc-plugin-markdown/src/app/renderer/markdown-renderer-hooks.ts rename to packages/typedoc-plugin-markdown/src/app/types/markdown-renderer-hooks.ts index 823a80da9..e470398f9 100644 --- a/packages/typedoc-plugin-markdown/src/app/renderer/markdown-renderer-hooks.ts +++ b/packages/typedoc-plugin-markdown/src/app/types/markdown-renderer-hooks.ts @@ -1,9 +1,9 @@ -import { MarkdownThemeContext } from 'public-api'; +import { MarkdownThemeContext } from 'theme'; /** * Describes the hooks available to inject output in the markdown theme. * - * ## Usage + * @example * * ```ts * app.renderer.markdownHooks.on( @@ -12,7 +12,6 @@ import { MarkdownThemeContext } from 'public-api'; * ); * ``` * - * @category Application */ export interface MarkdownRendererHooks { /** diff --git a/packages/typedoc-plugin-markdown/src/app/types/markdown-renderer.ts b/packages/typedoc-plugin-markdown/src/app/types/markdown-renderer.ts new file mode 100644 index 000000000..1693605b6 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/app/types/markdown-renderer.ts @@ -0,0 +1,52 @@ +import { MarkdownRendererEvent } from 'app/events'; +import { MarkdownTheme } from 'theme'; +import { EventHooks, Options, Renderer } from 'typedoc'; +import { MarkdownRendererHooks } from './markdown-renderer-hooks'; + +/** + * An extended typing of TypeDoc's {@linkcode typedoc!Renderer Renderer} class that includes updated typings for hooks and async jobs. + * + * @example + * + * ```ts + * import { MarkdownApplication } from 'typedoc-plugin-markdown'; + * + * export function load(app: MarkdownApplication) { + * + * app.renderer.markdownHooks.on( + * 'page.begin', () => '> This is some markdown at the top of the page', + * ); + * + * app.renderer.preRenderAsyncJobs.push(async (output: MarkdownRendererEvent) => { + * await doSomethingAsync(output); + * }); + + * app.renderer.postRenderAsyncJobs.push(async (output: MarkdownRendererEvent)) => { + * await doSomethingAsync(output); + * }); + * + * } + * ``` + * + */ +export interface MarkdownRenderer extends Renderer { + /** + * Replaces the event hooks typings the {@linkcode MarkdownRendererHooks} used by the plugin. + */ + markdownHooks: EventHooks; + /** @internal */ + packagesMeta: Record; + /** @internal */ + defineTheme: ( + name: string, + theme: new (renderer: MarkdownRenderer) => MarkdownTheme, + ) => void; + /** + * Re-types the returned argument argument to {@linkcode MarkdownRendererEvent}. + */ + preRenderAsyncJobs: Array<(output: MarkdownRendererEvent) => Promise>; + /** + * Re-types the returned argument argument to {@linkcode MarkdownRendererEvent}. + */ + postRenderAsyncJobs: Array<(output: MarkdownRendererEvent) => Promise>; +} diff --git a/packages/typedoc-plugin-markdown/src/index.ts b/packages/typedoc-plugin-markdown/src/index.ts index c156e4cf9..76c805c06 100644 --- a/packages/typedoc-plugin-markdown/src/index.ts +++ b/packages/typedoc-plugin-markdown/src/index.ts @@ -1,111 +1,14 @@ -import { - MarkdownRendererHooks, - generateDocs, - render, - resolvePackages, -} from '@plugin/app/renderer'; -import * as declarations from '@plugin/options/declarations'; -import { MarkdownTheme } from '@plugin/theme'; -import { - Application, - Context, - Converter, - DeclarationOption, - EventHooks, - Renderer, - Theme, -} from 'typedoc'; +import { Application } from 'typedoc'; +import { initialize } from './app'; /** - * The function that is called by TypeDoc to bootstrap the plugin. https://typedoc.org/guides/development/#plugins. - * - * Here we expose additional TypeDoc options and make some adjustments. - * - * This method is not intended to be consumed in any other context that via the `plugin` option. - * - * @ignore + * Plugin load */ export function load(app: Application) { - /** - * ==================== - * 1. Bootstrap Options - * ==================== - */ - - /** - * Iterate over declaration definitions and to the container. - */ - Object.entries(declarations).forEach(([name, declaration]) => { - app.options.addDeclaration({ - name, - ...declaration, - } as DeclarationOption); - }); - - /** - * ========================================= - * 2. Extend locale with plugin translations - * ========================================= - */ - //app.internationalization.addTranslations('en', getTranslatable(app)); - - /** - * ================================================= - * 3. Intercept and modify some TypeDoc core methods - * ================================================= - * - * Currently the TypeDoc {@link Renderer} class is quite coupled to the HTML theme so we override a couple of core methods. - * - * @todo Ideally there would be proper decoupling in the TypeDoc core between the {@link Application} and {@link Renderer} which requires further investigation. - * - */ - - /** - * Replace the default HTML theme the with the {@link MarkdownTheme} - */ - Object.defineProperty(app.renderer, 'themes', { - value: new Map Theme>([ - ['default', MarkdownTheme], - ]), - }); - - /** - * Replace TypeDoc's {@link app.generateDocs} method with our own {@link generateDocs} method. - */ - Object.defineProperty(app, 'generateDocs', { value: generateDocs }); - - /** - * Replace TypeDoc's {@link app.renderer.render} method with our own {@link render} method. - */ - Object.defineProperty(app.renderer, 'render', { - value: render, - }); - - /** - * This is used to hook into the TypeDoc rendering system. - */ - Object.defineProperty(app.renderer, 'markdownHooks', { - value: new EventHooks(), - }); - - /** - * ============================ - * 3. Apply any other behaviour - * ============================ - */ - - /** - * Currently options set for packages are only stored on the converter and are destroyed before being passed to the {@link Renderer}. - * - * By intercepting the package options set in the converter and storing them on the renderer we can use them later in the theme. - * - * @todo Ideally this functionality would be available in TypeDoc core - to investigate. - */ - app.converter.on(Converter.EVENT_RESOLVE_END, (context: Context) => { - if (app.options.packageDir) { - resolvePackages(app, context, app.options.packageDir); - } - }); + initialize.load(app); } +/** + * Export anything that is available publicly + */ export * from 'public-api'; diff --git a/packages/typedoc-plugin-markdown/src/internationalization/index.ts b/packages/typedoc-plugin-markdown/src/internationalization/index.ts new file mode 100644 index 000000000..828f555ca --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/internationalization/index.ts @@ -0,0 +1,8 @@ +/** + * Exposes additional i18n keys and translations used by the theme. + * + * @module + */ +export * as locales from './locales'; +export * as translatable from './translatable'; +export * as types from './types'; diff --git a/packages/typedoc-plugin-markdown/src/internationalization/locales/en.ts b/packages/typedoc-plugin-markdown/src/internationalization/locales/en.ts new file mode 100644 index 000000000..91b46d712 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/internationalization/locales/en.ts @@ -0,0 +1,22 @@ +import { TranslatableStrings } from 'internationalization/types'; + +export const translatable: TranslatableStrings = { + /** + * String for default value + */ + theme_default_value: 'Default value', + theme_default_type: 'Default type', + theme_description: 'Description', + theme_event: 'Event', + theme_extends: 'Extends', + theme_extended_by: 'Extended by', + theme_member: 'Member', + theme_member_plural: 'Members', + theme_modifier: 'Modifier', + theme_name: 'Name', + theme_packages: 'Packages', + theme_type: 'Type', + theme_value: 'Value', + theme_version: 'Version', +}; +export default translatable; diff --git a/packages/typedoc-plugin-markdown/src/internationalization/locales/index.ts b/packages/typedoc-plugin-markdown/src/internationalization/locales/index.ts new file mode 100644 index 000000000..0456c0b9f --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/internationalization/locales/index.ts @@ -0,0 +1,10 @@ +/** + * List of plugin specific translations per locale. + * + * @module + */ + +import en from './en'; +import ko from './ko'; + +export { en, ko }; diff --git a/packages/typedoc-plugin-markdown/src/internationalization/locales/ko.ts b/packages/typedoc-plugin-markdown/src/internationalization/locales/ko.ts new file mode 100644 index 000000000..b61ebc3f1 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/internationalization/locales/ko.ts @@ -0,0 +1,20 @@ +import { TranslatableStrings } from 'internationalization/types'; + +export const translatable: Partial = { + theme_default_value: '기본 값', + theme_default_type: '기본 유형', + theme_description: '설명', + theme_event: '이벤트', + theme_extends: '확장', + theme_extended_by: '에 의해 확장됨', + theme_member: '멤버', + theme_member_plural: '멤버들', + theme_modifier: '수정자', + theme_name: '이름', + theme_packages: '패키지', + theme_type: '유형', + theme_value: '값', + theme_version: '버전', +}; + +export default translatable; diff --git a/packages/typedoc-plugin-markdown/src/internationalization/translatable.ts b/packages/typedoc-plugin-markdown/src/internationalization/translatable.ts new file mode 100644 index 000000000..179fc858a --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/internationalization/translatable.ts @@ -0,0 +1,26 @@ +/** + * Translations methods. + * + * @module + */ +import { locales } from 'internationalization'; +import { Application } from 'typedoc'; + +/** + * Returns subset of translatable strings for the plugin. + * + * These will then be merged with the main set of TypeDoc string. + */ +export function getTranslatable(app: Application) { + const LOCALES = { + en: locales.en, + ko: locales.ko, + }; + return { + ...LOCALES['en'], + ...(app.lang !== 'en' && Object.keys(LOCALES).includes(app.lang) + ? { ...LOCALES[app.lang] } + : {}), + ...app.options.getValue('locales')[app.lang], + }; +} diff --git a/packages/typedoc-plugin-markdown/src/internationalization/types.ts b/packages/typedoc-plugin-markdown/src/internationalization/types.ts new file mode 100644 index 000000000..f855f1d05 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/internationalization/types.ts @@ -0,0 +1,25 @@ +/** + * Internationalization types. + * + * @module + */ + +/** + * The model of translatable strings specific to the Markdown theme. + */ +export interface TranslatableStrings { + theme_default_value: string; + theme_default_type: string; + theme_description: string; + theme_event: string; + theme_extends: string; + theme_extended_by: string; + theme_member: string; + theme_member_plural: string; + theme_modifier: string; + theme_name: string; + theme_packages: string; + theme_type: string; + theme_value: string; + theme_version: string; +} diff --git a/packages/typedoc-plugin-markdown/src/libs/index.ts b/packages/typedoc-plugin-markdown/src/libs/index.ts new file mode 100644 index 000000000..d7e40aada --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/libs/index.ts @@ -0,0 +1,7 @@ +/** + * General pure library functions to be consumed across the plugin. + * + * @module + */ +export * as markdown from './markdown'; +export * as utils from './utils'; diff --git a/packages/typedoc-plugin-markdown/src/libs/markdown/_index.ts b/packages/typedoc-plugin-markdown/src/libs/markdown/_index.ts new file mode 100644 index 000000000..6ba6acd78 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/libs/markdown/_index.ts @@ -0,0 +1,14 @@ +export * from './back-ticks'; +export * from './block-quote-block'; +export * from './bold'; +export * from './code-block'; +export * from './heading'; +export * from './horizontal-rule'; +export * from './html-table'; +export * from './indent-block'; +export * from './index'; +export * from './italic'; +export * from './link'; +export * from './strike-through'; +export * from './table'; +export * from './unordered-list'; diff --git a/packages/typedoc-plugin-markdown/src/libs/markdown/index.ts b/packages/typedoc-plugin-markdown/src/libs/markdown/index.ts index 1ef7f70b4..4e2213711 100644 --- a/packages/typedoc-plugin-markdown/src/libs/markdown/index.ts +++ b/packages/typedoc-plugin-markdown/src/libs/markdown/index.ts @@ -1,19 +1,6 @@ /** - * Markdown helpers files + * Helpers to render markdown elements. + * + * @module */ - -// PLEASE NOTE: THE CONTENTS OF THE FILE BELOW THIS POINT IS AUTO GENERATED! - -export { backTicks } from './back-ticks'; -export { blockQuoteBlock } from './block-quote-block'; -export { bold } from './bold'; -export { codeBlock } from './code-block'; -export { heading } from './heading'; -export { horizontalRule } from './horizontal-rule'; -export { htmlTable } from './html-table'; -export { indentBlock } from './indent-block'; -export { italic } from './italic'; -export { link } from './link'; -export { strikeThrough } from './strike-through'; -export { table } from './table'; -export { unorderedList } from './unordered-list'; +export * from './_index'; diff --git a/packages/typedoc-plugin-markdown/src/libs/utils/_index.ts b/packages/typedoc-plugin-markdown/src/libs/utils/_index.ts new file mode 100644 index 000000000..27c979ca0 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/libs/utils/_index.ts @@ -0,0 +1,14 @@ +export * from './camel-to-title-case'; +export * from './escape-chars'; +export * from './format-markdown'; +export * from './format-table-cell'; +export * from './get-file-name-with-extension'; +export * from './index'; +export * from './is-quoted'; +export * from './normalize-line-breaks'; +export * from './remove-first-scoped-directory'; +export * from './remove-line-breaks'; +export * from './sanitize-comments'; +export * from './slugify'; +export * from './to-pascal-case'; +export * from './un-escape-chars'; diff --git a/packages/typedoc-plugin-markdown/src/libs/utils/index.ts b/packages/typedoc-plugin-markdown/src/libs/utils/index.ts index ea46f3804..c7c4d9426 100644 --- a/packages/typedoc-plugin-markdown/src/libs/utils/index.ts +++ b/packages/typedoc-plugin-markdown/src/libs/utils/index.ts @@ -1,15 +1,6 @@ -// PLEASE NOTE: THE CONTENTS OF THE FILE BELOW THIS POINT IS AUTO GENERATED! - -export { camelToTitleCase } from './camel-to-title-case'; -export { escapeChars } from './escape-chars'; -export { formatMarkdown } from './format-markdown'; -export { formatTableCell } from './format-table-cell'; -export { getFileNameWithExtension } from './get-file-name-with-extension'; -export { isQuoted } from './is-quoted'; -export { normalizeLineBreaks } from './normalize-line-breaks'; -export { removeFirstScopedDirectory } from './remove-first-scoped-directory'; -export { removeLineBreaks } from './remove-line-breaks'; -export { sanitizeComments } from './sanitize-comments'; -export { slugify } from './slugify'; -export { toPascalCase } from './to-pascal-case'; -export { unEscapeChars } from './un-escape-chars'; +/** + * General utility pure functions. + * + * @module + */ +export * from './_index'; diff --git a/packages/typedoc-plugin-markdown/src/options/constants.ts b/packages/typedoc-plugin-markdown/src/options/constants.ts new file mode 100644 index 000000000..30f1000b3 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/options/constants.ts @@ -0,0 +1,25 @@ +/** + * Contains constant default values used in options. + * + * @module + */ + +import { ReflectionKind } from 'typedoc'; + +export const ALLOWED_OWN_FILE_MEMBERS = [ + ReflectionKind[ReflectionKind.Enum], + ReflectionKind[ReflectionKind.Variable], + ReflectionKind[ReflectionKind.Function], + ReflectionKind[ReflectionKind.Class], + ReflectionKind[ReflectionKind.Interface], + ReflectionKind[ReflectionKind.TypeAlias], +]; + +export const TEXT_CONTENT_MAPPINGS = { + 'header.title': '{projectName} {version}', + 'header.docs': 'Docs', + 'breadcrumbs.home': '{projectName} {version}', + 'title.indexPage': '{projectName} {version}', + 'title.memberPage': '{kind}: {name}', + 'footer.text': '', +}; diff --git a/packages/typedoc-plugin-markdown/src/options/declarations.ts b/packages/typedoc-plugin-markdown/src/options/declarations.ts index 614673149..566947bdc 100644 --- a/packages/typedoc-plugin-markdown/src/options/declarations.ts +++ b/packages/typedoc-plugin-markdown/src/options/declarations.ts @@ -1,11 +1,15 @@ +/** + * Typedoc options declarations. + * Each exported variable will be added to the TypeDoc options and also the public documentation. + * + * @module + */ import { DeclarationOption, ParameterType } from 'typedoc'; -import { - FormatStyle, - MembersWithOwnFile, - OutputFileStrategy, -} from './option-maps'; +import { ALLOWED_OWN_FILE_MEMBERS, TEXT_CONTENT_MAPPINGS } from './constants'; +import { IndexFormat, OutputFileStrategy, ReflectionFormat } from './maps'; /** + * @remarks * * TypeDoc creates documentation according to exports derived from the given [`entryPointsStrategy`](https://typedoc.org/options/input/#entrypointstrategy) configuration. * @@ -16,34 +20,9 @@ import { * The following keys are available: * * - **"members":** generates an individual file for each exported module member. This is the standard behavior of the HTML theme and the default setting of the plugin. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * * - **"modules"**: generates a single file for every Module or Namespace where all members are hoisted to a single module file. This creates a flat navigation structure and reduces the amount of files generated. - * - * - * - * - * * - * @category File + * @category File Options */ export const outputFileStrategy: Partial = { help: 'Determines how output files are generated.', @@ -53,19 +32,21 @@ export const outputFileStrategy: Partial = { }; /** + * @remarks + * * This option is useful when only specific types of members should be exported to a single file. * * Ignored when [`outputFileStrategy`](#outputfilestrategy) is equal to `"modules"` * * @example ["Class", "Enum", "Interface"] * - * @category File + * @category File Options */ export const membersWithOwnFile: Partial = { help: 'Determines which members are exported to their own file when `outputFileStrategy` equals `members`.', type: ParameterType.Array, validate(values) { - const validValues = MembersWithOwnFile; + const validValues = ALLOWED_OWN_FILE_MEMBERS; for (const kind of values) { if (!validValues.includes(kind)) { throw new Error( @@ -76,42 +57,15 @@ export const membersWithOwnFile: Partial = { } } }, - defaultValue: MembersWithOwnFile, + defaultValue: ALLOWED_OWN_FILE_MEMBERS, }; /** - * By default output files are generated in a directory structure that mirrors the project's module hierarchy including folders for member kinds eg `classes`, `enums`, `functions` etc. - * - * This option will flatten the output files to a single directory as follows: - * - * **Default output:** - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * **Flattened output:** - * - * - * - * - * - * - * - * + * @remarks * + * By default output files are generated in a directory structure that mirrors the project's module hierarchy including folders for member kinds eg `classes`, `enums`, `functions` etc. * - * @category File + * @category File Options */ export const flattenOutputFiles: Partial = { help: 'Flatten output files to a single directory.', @@ -120,11 +74,13 @@ export const flattenOutputFiles: Partial = { }; /** + * @remarks + * * Typically markdown files are recognised by the `.md` or `.markdown` file extensions.`.mdx` maybe required for compatibility with certain markdown parsers. * * @example ".mdx" * - * @category File + * @category File Options */ export const fileExtension: Partial = { help: 'Specify the file extension for generated output files.', @@ -140,6 +96,8 @@ export const fileExtension: Partial = { }; /** + * @remarks + * * The entry page is the root page of the documentation, equivalent to `index.html` for web pages. * * `README` is recognised when browsing folders on repos and Wikis and is the plugin default. `index` might be more suitable for static site generators. @@ -152,7 +110,7 @@ export const fileExtension: Partial = { * * @example "index" * - * @category File + * @category File Options * */ export const entryFileName: Partial = { @@ -162,6 +120,8 @@ export const entryFileName: Partial = { }; /** + * @remarks + * * This option can be used when the root page of the documentation should be a specific module (typically a module named `index`). * * The module name should be specified (NOT the reference to the file name). @@ -170,7 +130,7 @@ export const entryFileName: Partial = { * * @example "index" * - * @category File + * @category File Options */ export const entryModule: Partial = { help: 'The name of a module that should act as the root page for the documentation.', @@ -178,29 +138,17 @@ export const entryModule: Partial = { }; /** + * @remarks + * * By default directories are split by scopes when generating file paths. * * This option will remove reference to `@scope` in the path when generating files and directories. It does not affect the name of the package or module in the output. * * The following will be the directory structure for packages named `@scope/package-1` and `@scope/package-2`: * - * - **`false`** - * - * - * - * - * - * - * - * - **`true`** - * - * - * - * - * * Ignored if `flattenOutputFiles` is set to `true`. * - * @category File + * @category File Options */ export const excludeScopesInPaths: Partial = { help: 'Exclude writing @ scope directories in paths.', @@ -209,12 +157,17 @@ export const excludeScopesInPaths: Partial = { }; /** - * By default when a readme file is resolved, a separate readme page is created. This option appends the index page to the readme so only a single root page is generated. + * @remarks * - * This option has no effect when [`readme`](https://typedoc.org/options/input/#readme) is set to `"none"`. + * By default when a readme file is resolved, a separate readme page is created. + * This option appends the index page to the readme so only a single root page is generated. + * + * You can additionally configure the generated title with `"textContentMappings": { "title.indexPage" : "My API"}`. + * See [`--textContentMappings`](/docs/options/utility-options#--textcontentmappings). * - * @category File + * This option has no effect when [`readme`](https://typedoc.org/options/input/#readme) is set to `"none"`. * + * @category File Options */ export const mergeReadme: Partial = { help: 'Merges the resolved readme into the project index page.', @@ -223,20 +176,7 @@ export const mergeReadme: Partial = { }; /** - * By default a documents indexes and separate documents pages are generated when using the `@document` tag. - * - * This option inlines the document into the page rather than generating a separate document page. - * - * @category File - */ -export const inlineDocuments: Partial = { - help: 'Inline documents in pages.', - type: ParameterType.Boolean, - defaultValue: false, -}; - -/** - * @category Display + * @category Display Options */ export const hidePageHeader: Partial = { help: 'Do not print page header.', @@ -245,7 +185,7 @@ export const hidePageHeader: Partial = { }; /** - * @category Display + * @category Display Options */ export const hidePageTitle: Partial = { help: 'Do not print page title.', @@ -254,7 +194,7 @@ export const hidePageTitle: Partial = { }; /** - * @category Display + * @category Display Options */ export const hideBreadcrumbs: Partial = { help: 'Do not print breadcrumbs.', @@ -263,11 +203,13 @@ export const hideBreadcrumbs: Partial = { }; /** + * @remarks + * * By default members are grouped by kind (eg Classes, Functions etc). * * This creates a flat structure where all members are displayed at the same heading level. * - * @category Display + * @category Display Options */ export const hideGroupHeadings: Partial = { help: 'Excludes grouping by kind so all members are rendered and sorted at the same level.', @@ -287,13 +229,15 @@ export const excludeGroups: Partial = { }; /** + * @remarks + * * This option can be used to improve readability and aesthetics when defining signatures and declarations. * * Please note that when this option is set to `true` it is not possible to link to other references. * * As a work around the [`@link`](https://typedoc.org/tags/link/) tag can be be used to manually reference types. * - * @category Display + * @category Display Options */ export const useCodeBlocks: Partial = { help: 'Wraps signatures and declarations in code blocks.', @@ -302,11 +246,13 @@ export const useCodeBlocks: Partial = { }; /** + * @remarks + * * By default objects inside declarations are collapsed to preserve space and improve readability. * * This option should be set when a full object representation is preferred. * - * @category Display + * @category Display Options */ export const expandObjects: Partial = { help: 'Expand objects inside declarations.', @@ -315,11 +261,13 @@ export const expandObjects: Partial = { }; /** + * @remarks + * * By default parameters in signature definitions only display the parameter name so the output is more concise. * * This option should be set when a full type representation is preferred. * - * @category Display + * @category Display Options */ export const expandParameters: Partial = { help: 'Expand parameters in signature parentheses to display type information.', @@ -328,91 +276,108 @@ export const expandParameters: Partial = { }; /** + * @remarks + * * This option specifies the output format for parameters and type parameters of functions and class methods: * * - **"list"**: parameters are output as bullet points in a linear list, suitable for more detailed comments. * - **"table"**: parameters are output within a markdown table, condensed into a single paragraph. - * - **"htmlTable"**: parameters are output in an HTML table, enabling block elements to render in tabular format. + * - **"htmlTable"**: parameters are output in an HTML table, enabling block elements to render in tabular format * - * @category Display + * @category Display Options */ export const parametersFormat: Partial = { help: 'Specify the render style of parameter and type parameter groups.', type: ParameterType.Map, - map: FormatStyle, - defaultValue: FormatStyle.List, + map: ReflectionFormat, + defaultValue: ReflectionFormat.List, }; /** + * @remarks + * * This option specifies the output format for class and interface properties: * * - **"list"**: properties are output in linear blocks with headings, suitable for more detailed comments. * - **"table"**: properties are output within a markdown table, condensed into a single paragraph. * - **"htmlTable"**: properties are output in an HTML table, enabling block elements to render in tabular format. * - * @category Display + * @category Display Options */ export const propertiesFormat: Partial = { help: 'Specify the render style of property groups for interfaces and classes.', type: ParameterType.Map, - map: FormatStyle, - defaultValue: FormatStyle.List, + map: ReflectionFormat, + defaultValue: ReflectionFormat.List, }; /** + * @remarks + * * This option specifies the output format for enumeration members: * * - **"list"**: members are output in linear blocks with headings, suitable for more detailed comments. * - **"table"**: members are output within a markdown table, condensed into a single paragraph. * - **"htmlTable"**: members are output in an HTML table, enabling block elements to render in tabular format. * - * @category Display + * @category Display Options */ export const enumMembersFormat: Partial = { help: 'Specify the render style of enumeration members.', type: ParameterType.Map, - map: FormatStyle, - defaultValue: FormatStyle.List, + map: ReflectionFormat, + defaultValue: ReflectionFormat.List, }; /** + * @remarks + * * This option specifies the output format for type declaration: * * - **"list"**: declarations are output in linear blocks with headings, suitable for more detailed comments. * - **"table"**: declarations are output within a markdown table, condensed into a single paragraph. * - **"htmlTable"**: declarations are output in an HTML table, enabling block elements to render in tabular format. * - * @category Display + * @category Display Options */ export const typeDeclarationFormat: Partial = { help: 'Specify the render style for type declaration members.', type: ParameterType.Map, - map: FormatStyle, - defaultValue: FormatStyle.List, + map: ReflectionFormat, + defaultValue: ReflectionFormat.List, }; /** - * This option renders index items either as a simple list or in a table with a description column exposing the comment summary. + * @remarks + * + * This option renders index items either as a simple unordered list or in a table. * - * For a packages index page (when `--entryPointStrategy` equals `packages`), the package.json description will be displayed with an additional "Version" column (when `--includeVersion` equals true). + * When table style is selected the following will be the behaviour: * - * @category Display + * - For a **members index**, a description column will be added to the table with the first paragraph of the comment summary. + * - For a **packages index**, (when `--entryPointStrategy` equals `packages`), the package.json description will be displayed with an additional "Version" column (when `--includeVersion` equals true). + * - For a **documents index** a description column will be added to the table printing the `description` frontmatter if present. + * + * @category Display Options */ export const indexFormat: Partial = { help: 'Specify the render format for index items.', type: ParameterType.Map, - map: FormatStyle, - defaultValue: FormatStyle.List, + map: IndexFormat, + defaultValue: IndexFormat.List, }; /** - * By default, all available data for symbols are displayed in table columns. + * @remarks + * + * By default, all available data for symbols are displayed in table columns. For some reflections this can result in several columns. * * This option allows you to control the visibility of columns, prioritizing readability over displaying complete data. + * In addition you can control the alignment of the header text. * - * @category Display + * @category Display Options */ -export const tableColumnVisibility: Partial = { +export const tableColumnSettings: Partial = { help: 'Control header alignment and column visibility in tables.', type: ParameterType.Flags, defaults: { @@ -421,28 +386,19 @@ export const tableColumnVisibility: Partial = { hideModifiers: false, hideOverrides: false, hideSources: false, + hideValues: false, + leftAlignHeaders: false, }, }; /** - * By default table alignment is not specified which means the table headings will typically be centred. - * - * This options can be used to specify left alignment for table headings. + * @remarks * - * @category Display - */ -export const leftAlignTableHeaders: Partial = { - help: 'Left aligns items in table headers', - type: ParameterType.Boolean, - defaultValue: false, -}; - -/** * If undefined all urls will be relative. * * @example "http://abc.com" * - * @category Utility + * @category Utility Options */ export const publicPath: Partial = { help: 'Specify the base path for all urls.', @@ -451,6 +407,8 @@ export const publicPath: Partial = { }; /** + * @remarks + * * *Please note this options does not affect the rendering of inline code or code blocks (using single/triple backticks).* * * By default all comments written inside JsDoc comments will be passed to the output as written, and parsers will interpret un-escaped angle brackets as HTML/JSX tags.. @@ -463,7 +421,7 @@ export const publicPath: Partial = { * - Comments contain invalid syntax that (in the case of MDX) will cause breaking parsing errors. * - Although most parsers use XSS filters, this option provides an additional layer of XSS security. * - * @category Utility + * @category Utility Options */ export const sanitizeComments: Partial = { help: 'Sanitize HTML and JSX inside JsDoc comments.', @@ -472,11 +430,13 @@ export const sanitizeComments: Partial = { }; /** + * @remarks + * * This option should be used when parsers require a custom anchor prefix. * * @example "markdown-header" * - * @category Utility + * @category Utility Options */ export const anchorPrefix: Partial = { help: 'Custom anchor prefix when anchoring to in-page symbols.', @@ -485,12 +445,14 @@ export const anchorPrefix: Partial = { }; /** + * @remarks + * * This option should be used if there are issues with anchoring to symbols within a page. * * - For markdown parsers that do not automatically assign header ids. * - When cross referencing symbols that are referenced in a table row. * - * @category Utility + * @category Utility Options */ export const useHTMLAnchors: Partial = { help: 'Add HTML named anchors to headings and table rows.', @@ -499,11 +461,13 @@ export const useHTMLAnchors: Partial = { }; /** + * @remarks + * * By default references to symbol anchor links are lowercased. * * This option can be used for engines that require the preservation of anchor link casing. * - * @category Utility + * @category Utility Options */ export const preserveAnchorCasing: Partial = { help: 'Preserve anchor casing when generating link to symbols.', @@ -512,6 +476,8 @@ export const preserveAnchorCasing: Partial = { }; /** + * @remarks + * * By default navigation is not written to file but can be consumed programmatically. * This is useful if you want to provide a custom sidebar/navigation implementation (if relevant to your environment). * @@ -538,7 +504,7 @@ export const preserveAnchorCasing: Partial = { * } * ``` * - * @category Utility + * @category Utility Options * */ export const navigationModel: Partial = { @@ -552,26 +518,30 @@ export const navigationModel: Partial = { }; /** + * @remarks + * Defines placeholder text in main template that can be customized. Includes the main page header and breadcrumbs (if displayed), + * page titles and page footer. * - * This option enables changing static text rendered to the documentation. + * Default values within curly braces {} indicates a placeholder of dynamic text. * - * @deprecated + * - The `{projectName}` placeholder writes project's name . + * - The `{kind}` writes the reflection kind of the page. + * - The `{version}` placeholder writes package version (if includeVersion is `true`). * - * This option has been deprecated in favour of TypeDoc's 0.26 localization feature. + * If you are looking for general localization support please see [localization](). * - * @category Utility + * @category Utility Options */ export const textContentMappings: Partial = { - help: '@deprecated Provides a mechanism to change the content of text used in documentation.', - type: ParameterType.Mixed, - defaultValue: {}, + help: 'Change specific text placeholders in the template.', + type: ParameterType.Object, + defaultValue: TEXT_CONTENT_MAPPINGS, validate(value) { if (!value || typeof value !== 'object') { throw new Error( '[typedoc-plugin-markdown] textContentMappings must be an object.', ); } - for (const val of Object.values(value)) { if (typeof val !== 'string') { throw new Error( diff --git a/packages/typedoc-plugin-markdown/src/options/index.ts b/packages/typedoc-plugin-markdown/src/options/index.ts index 53c5cf137..f787d2570 100644 --- a/packages/typedoc-plugin-markdown/src/options/index.ts +++ b/packages/typedoc-plugin-markdown/src/options/index.ts @@ -1,2 +1,9 @@ -export * from './option-maps'; -export * from './option-types'; +/** + * Configures plugin options. + * + * @module + */ +export * as constants from './constants'; +export * as declarations from './declarations'; +export * as maps from './maps'; +export * as types from './types'; diff --git a/packages/typedoc-plugin-markdown/src/options/maps.ts b/packages/typedoc-plugin-markdown/src/options/maps.ts new file mode 100644 index 000000000..87a2afa78 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/options/maps.ts @@ -0,0 +1,30 @@ +/** + * Maps a given value to the option type. + * + * @module + */ + +/** + * The allowed values of the `--outputFileStrategy` option. + */ +export enum OutputFileStrategy { + Members = 'members', + Modules = 'modules', +} + +/** + * The allowed values for formatting reflections. + */ +export enum ReflectionFormat { + List = 'list', + Table = 'table', + HtmlTable = 'htmlTable', +} + +/** + * The allowed values for formatting indexes. + */ +export enum IndexFormat { + List = 'list', + Table = 'table', +} diff --git a/packages/typedoc-plugin-markdown/src/options/option-maps.ts b/packages/typedoc-plugin-markdown/src/options/option-maps.ts deleted file mode 100644 index f68976c3f..000000000 --- a/packages/typedoc-plugin-markdown/src/options/option-maps.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ReflectionKind } from 'typedoc'; - -export const OutputFileStrategy = { - Members: 'members', - Modules: 'modules', -} as const; - -export type OutputFileStrategy = - (typeof OutputFileStrategy)[keyof typeof OutputFileStrategy]; - -export const FormatStyle = { - List: 'list', - Table: 'table', - HtmlTable: 'htmlTable', -} as const; - -export type FormatStyle = (typeof FormatStyle)[keyof typeof FormatStyle]; - -export const MembersWithOwnFile = [ - ReflectionKind[ReflectionKind.Enum], - ReflectionKind[ReflectionKind.Variable], - ReflectionKind[ReflectionKind.Function], - ReflectionKind[ReflectionKind.Class], - ReflectionKind[ReflectionKind.Interface], - ReflectionKind[ReflectionKind.TypeAlias], -]; diff --git a/packages/typedoc-plugin-markdown/src/options/option-types.ts b/packages/typedoc-plugin-markdown/src/options/types.ts similarity index 84% rename from packages/typedoc-plugin-markdown/src/options/option-types.ts rename to packages/typedoc-plugin-markdown/src/options/types.ts index d73ebbdd7..521aa1b4b 100644 --- a/packages/typedoc-plugin-markdown/src/options/option-types.ts +++ b/packages/typedoc-plugin-markdown/src/options/types.ts @@ -1,9 +1,11 @@ -// THIS FILE IS AUTO GENERATED FROM THE OPTIONS CONFIG. DO NOT EDIT DIRECTLY. - /** * Describes the options declared by the plugin. * - * @category Options + * @privateRemarks + * + * THIS FILE IS AUTO GENERATED FROM THE OPTIONS CONFIG. DO NOT EDIT DIRECTLY + * + * @module */ export interface PluginOptions { /** @@ -79,17 +81,7 @@ export interface PluginOptions { /** * Specify the render format for index items. */ - indexFormat: 'list' | 'table' | 'htmlTable'; - - /** - * Inline documents in pages. - */ - inlineDocuments: boolean; - - /** - * Left aligns items in table headers - */ - leftAlignTableHeaders: boolean; + indexFormat: 'list' | 'table'; /** * Determines which members are exported to their own file when `outputFileStrategy` equals `members`. @@ -150,18 +142,27 @@ export interface PluginOptions { /** * Control header alignment and column visibility in tables. */ - tableColumnVisibility: { + tableColumnSettings: { hideDefaults: boolean; hideInherited: boolean; hideModifiers: boolean; hideOverrides: boolean; hideSources: boolean; + hideValues: boolean; + leftAlignHeaders: boolean; }; /** - * @deprecated Provides a mechanism to change the content of text used in documentation. + * Change specific text placeholders in the template. */ - textContentMappings: Partial; + textContentMappings: { + 'header.title': string; + 'header.docs': string; + 'breadcrumbs.home': string; + 'title.indexPage': string; + 'title.memberPage': string; + 'footer.text': string; + }; /** * Specify the render style for type declaration members. @@ -178,10 +179,3 @@ export interface PluginOptions { */ useHTMLAnchors: boolean; } - -/** - * Describes the keys available to replace static text. - * - * @category Options - */ -export interface TextContentMappings {} diff --git a/packages/typedoc-plugin-markdown/src/public-api.ts b/packages/typedoc-plugin-markdown/src/public-api.ts index 34f0acf9b..bb8aa7312 100644 --- a/packages/typedoc-plugin-markdown/src/public-api.ts +++ b/packages/typedoc-plugin-markdown/src/public-api.ts @@ -1,5 +1,5 @@ /** - * The public API of typedoc-plugin-markdown exposes some classes and types that can be used to customize the output of the plugin. Please note this only covers the API relevant to this plugin and not cover the entire [TypeDoc API](https://typedoc.org/api/). + * The public API of typedoc-plugin-markdown exposes some classes and types that can be used to customize the output of the plugin. If you are interested in the TypeDoc API please visit [https://typedoc.org](https://typedoc.org/api/). * * The APIs are typically consumed by writing [local plugins](/docs/customizing-output#local-plugins). * @@ -17,14 +17,8 @@ * * @module */ -export { MarkdownApplication, MarkdownRenderer } from '@plugin/app/application'; -export { MarkdownPageEvent, MarkdownRendererEvent } from '@plugin/app/events'; -export { MarkdownRendererHooks } from '@plugin/app/renderer'; -export { PluginOptions } from '@plugin/options'; -export { - MarkdownTheme, - MarkdownThemeContext, - NavigationItem, - PackageMetaData, - UrlMapping, -} from '@plugin/theme'; + +export { MarkdownPageEvent, MarkdownRendererEvent } from 'app/events'; +export { PluginOptions } from 'options/types'; +export { MarkdownTheme, MarkdownThemeContext } from 'theme'; +export { NavigationItem, PackageMetaData, UrlMapping } from 'theme/types'; diff --git a/packages/typedoc-plugin-markdown/src/theme/context/helpers/_index.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/_index.ts new file mode 100644 index 000000000..92eba399b --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/helpers/_index.ts @@ -0,0 +1,18 @@ +export * from './get-comment-parts'; +export * from './get-declaration-type'; +export * from './get-description-for-reflection'; +export * from './get-flattened-declarations'; +export * from './get-group-index-list'; +export * from './get-group-index-table'; +export * from './get-group-index'; +export * from './get-hierarchy-type'; +export * from './get-keyword'; +export * from './get-modifier'; +export * from './get-parameter-default-value'; +export * from './get-project-name'; +export * from './get-property-default-value'; +export * from './get-reflection-flags'; +export * from './get-return-type'; +export * from './index'; +export * from './is-group-kind'; +export * from './use-table.format'; diff --git a/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-comment-parts.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-comment-parts.ts new file mode 100644 index 000000000..13143bd1b --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-comment-parts.ts @@ -0,0 +1,70 @@ +import * as fs from 'fs'; +import { link } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; +import { CommentDisplayPart, InlineTagDisplayPart } from 'typedoc'; + +export function getCommentParts( + this: MarkdownThemeContext, + model: CommentDisplayPart[], +): string { + const md: string[] = []; + for (const part of model) { + switch (part.kind) { + case 'text': + md.push(part.text); + break; + case 'code': + md.push(part.text); + break; + case 'inline-tag': + switch (part.tag) { + case '@label': + case '@inheritdoc': + break; + case '@link': + case '@linkcode': + case '@linkplain': { + if (part.target) { + const url = getUrl(part); + const wrap = part.tag === '@linkcode' ? '`' : ''; + md.push( + url + ? `${link(`${wrap}${part.text}${wrap}`, this.getRelativeUrl(url))}` + : part.text, + ); + } else { + md.push(part.text); + } + break; + } + default: + md.push(`{${part.tag} ${part.text}}`); + break; + } + break; + default: + md.push(''); + } + } + return md.join(''); +} + +function getUrl(part: InlineTagDisplayPart) { + if ((part.target as any).url) { + return (part.target as any).url; + } + + if ((part.target as any)?.parent?.url) { + return (part.target as any)?.parent?.url; + } + + return typeof part.target === 'string' ? part.target : ''; +} + +export function isFile(file: string) { + try { + return fs.statSync(file).isFile(); + } catch { + return false; + } +} diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-declaration-type.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-declaration-type.ts similarity index 100% rename from packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-declaration-type.ts rename to packages/typedoc-plugin-markdown/src/theme/context/helpers/get-declaration-type.ts diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-description-for-reflection.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-description-for-reflection.ts similarity index 100% rename from packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-description-for-reflection.ts rename to packages/typedoc-plugin-markdown/src/theme/context/helpers/get-description-for-reflection.ts diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-flattened-declarations.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-flattened-declarations.ts similarity index 100% rename from packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-flattened-declarations.ts rename to packages/typedoc-plugin-markdown/src/theme/context/helpers/get-flattened-declarations.ts diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-group-index-list.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-group-index-list.ts similarity index 84% rename from packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-group-index-list.ts rename to packages/typedoc-plugin-markdown/src/theme/context/helpers/get-group-index-list.ts index cebd7bc11..c9c235824 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-group-index-list.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-group-index-list.ts @@ -1,5 +1,5 @@ -import { link } from '@plugin/libs/markdown'; -import { escapeChars } from '@plugin/libs/utils'; +import { link } from 'libs/markdown'; +import { escapeChars } from 'libs/utils'; import { MarkdownThemeContext } from 'public-api'; import { DeclarationReflection, DocumentReflection } from 'typedoc'; diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-group-index-table.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-group-index-table.ts similarity index 67% rename from packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-group-index-table.ts rename to packages/typedoc-plugin-markdown/src/theme/context/helpers/get-group-index-table.ts index 4b2cd83de..c93be000e 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-group-index-table.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-group-index-table.ts @@ -1,5 +1,5 @@ -import { link, table } from '@plugin/libs/markdown'; -import { escapeChars } from '@plugin/libs/utils'; +import { link, table } from 'libs/markdown'; +import { escapeChars } from 'libs/utils'; import { MarkdownThemeContext } from 'public-api'; import { DeclarationReflection, @@ -10,15 +10,16 @@ import { export function getGroupIndexTable( this: MarkdownThemeContext, children: DeclarationReflection[] | DocumentReflection[], + kind?: ReflectionKind, ) { - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + const leftAlignHeadings = this.options.getValue( + 'tableColumnSettings', + ).leftAlignHeaders; + const headers = [ - this.options.getValue('excludeGroups') || - this.options.getValue('hideGroupHeadings') - ? this.i18n.theme_member() - : ReflectionKind.singularString(children[0].kind), - this.i18n.theme_description(), + kind ? ReflectionKind.singularString(kind) : this.i18n.theme_member(), ]; + headers.push(this.i18n.theme_description()); const rows: string[][] = []; children.forEach((child) => { const row: string[] = []; @@ -30,7 +31,6 @@ export function getGroupIndexTable( child instanceof DeclarationReflection ? this.helpers.getDescriptionForReflection(child) : ((child as DocumentReflection).frontmatter.description as string); - row.push(description || '-'); rows.push(row); diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-group-index.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-group-index.ts similarity index 86% rename from packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-group-index.ts rename to packages/typedoc-plugin-markdown/src/theme/context/helpers/get-group-index.ts index ca0d37efc..c0eb3d538 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-group-index.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-group-index.ts @@ -9,6 +9,7 @@ export function getGroupIndex(group: ReflectionGroup | ReflectionCategory) { if (this.options.getValue('indexFormat') === 'table') { return this.helpers.getGroupIndexTable( group.children as DeclarationReflection[] | DocumentReflection[], + group instanceof ReflectionGroup ? group.owningReflection?.kind : null, ); } return this.helpers.getGroupIndexList( diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-hierarchy-type.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-hierarchy-type.ts similarity index 85% rename from packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-hierarchy-type.ts rename to packages/typedoc-plugin-markdown/src/theme/context/helpers/get-hierarchy-type.ts index 19eca5a84..779421b0f 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-hierarchy-type.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-hierarchy-type.ts @@ -1,4 +1,4 @@ -import { backTicks } from '@plugin/libs/markdown'; +import { backTicks } from 'libs/markdown'; import { MarkdownThemeContext } from 'public-api'; import { SomeType } from 'typedoc'; diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-keyword.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-keyword.ts similarity index 100% rename from packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-keyword.ts rename to packages/typedoc-plugin-markdown/src/theme/context/helpers/get-keyword.ts diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-modifier.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-modifier.ts similarity index 100% rename from packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-modifier.ts rename to packages/typedoc-plugin-markdown/src/theme/context/helpers/get-modifier.ts diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-parameter-default-value.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-parameter-default-value.ts similarity index 53% rename from packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-parameter-default-value.ts rename to packages/typedoc-plugin-markdown/src/theme/context/helpers/get-parameter-default-value.ts index 307d37e55..6badd89e8 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-parameter-default-value.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-parameter-default-value.ts @@ -1,7 +1,5 @@ import { ParameterReflection } from 'typedoc'; export function getParameterDefaultValue(model: ParameterReflection) { - return model.defaultValue && model.defaultValue !== '...' - ? model.defaultValue - : 'undefined'; + return model.defaultValue ? model.defaultValue : 'undefined'; } diff --git a/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-project-name.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-project-name.ts new file mode 100644 index 000000000..953b8999b --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-project-name.ts @@ -0,0 +1,16 @@ +import { MarkdownPageEvent } from 'app/events'; +import { Reflection } from 'typedoc'; + +export function getProjectName( + stringWithPlaceholders: string, + page: MarkdownPageEvent, +) { + return stringWithPlaceholders + .replace('{projectName}', page.project.name) + .replace( + '{version}', + page.project.packageVersion ? `v${page.project.packageVersion}` : '', + ) + .replace(/\s+/g, ' ') + .trim(); +} diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-property-default-value.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-property-default-value.ts similarity index 88% rename from packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-property-default-value.ts rename to packages/typedoc-plugin-markdown/src/theme/context/helpers/get-property-default-value.ts index f047bf531..dea1c0e6f 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-property-default-value.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-property-default-value.ts @@ -1,4 +1,4 @@ -import { backTicks } from '@plugin/libs/markdown'; +import { backTicks } from 'libs/markdown'; import { DeclarationReflection } from 'typedoc'; export function getPropertyDefaultValue(model: DeclarationReflection) { diff --git a/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-reflection-flags.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-reflection-flags.ts new file mode 100644 index 000000000..2524c0df4 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-reflection-flags.ts @@ -0,0 +1,24 @@ +import { camelToTitleCase } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; +import { DeclarationReflection, SignatureReflection } from 'typedoc'; + +export function getReflectionFlags( + this: MarkdownThemeContext, + reflection: DeclarationReflection | SignatureReflection, +): string[] { + const flagsNotRendered: `@${string}`[] = [ + '@showCategories', + '@showGroups', + '@hideCategories', + '@hideGroups', + ]; + const flags: string[] = []; + if (reflection.comment) { + for (const tag of reflection.comment.modifierTags) { + if (!flagsNotRendered.includes(tag)) { + flags.push(camelToTitleCase(tag.substring(1))); + } + } + } + return flags; +} diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-return-type.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-return-type.ts similarity index 90% rename from packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-return-type.ts rename to packages/typedoc-plugin-markdown/src/theme/context/helpers/get-return-type.ts index b1bab7976..ef6d789d0 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/get-return-type.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/helpers/get-return-type.ts @@ -1,4 +1,4 @@ -import { codeBlock } from '@plugin/libs/markdown'; +import { codeBlock } from 'libs/markdown'; import { MarkdownThemeContext } from 'public-api'; import { ReflectionType, SomeType } from 'typedoc'; diff --git a/packages/typedoc-plugin-markdown/src/theme/context/helpers/index.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/index.ts new file mode 100644 index 000000000..7c9501d5a --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/helpers/index.ts @@ -0,0 +1,12 @@ +/** + * The `helpers` namespace holds the helpers for the theme and are smaller utility functions that return snippets or text or other data transformations. + * + * Please note that partials: + * + * - Take a `model` param (that references a specific TypeDoc model) and an `options` param if required. + * - Can reference other helpers but should not reference partials. + * - Can return strings or other models. + * + * @module + */ +export * from './_index'; diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/helpers/is-group-kind.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/is-group-kind.ts similarity index 100% rename from packages/typedoc-plugin-markdown/src/theme/resources/helpers/is-group-kind.ts rename to packages/typedoc-plugin-markdown/src/theme/context/helpers/is-group-kind.ts diff --git a/packages/typedoc-plugin-markdown/src/theme/context/helpers/use-table.format.ts b/packages/typedoc-plugin-markdown/src/theme/context/helpers/use-table.format.ts new file mode 100644 index 000000000..0a5c0a861 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/helpers/use-table.format.ts @@ -0,0 +1,24 @@ +import { MarkdownThemeContext } from 'public-api'; + +export function useTableFormat( + this: MarkdownThemeContext, + key: 'properties' | 'parameters' | 'enums' | 'typeDeclarations', +): boolean { + if (key === 'parameters') { + return isTable(this.options.getValue('parametersFormat')); + } + if (key === 'properties') { + return isTable(this.options.getValue('propertiesFormat')); + } + if (key === 'enums') { + return isTable(this.options.getValue('enumMembersFormat')); + } + if (key === 'typeDeclarations') { + return isTable(this.options.getValue('typeDeclarationFormat')); + } + return false; +} + +function isTable(key: string) { + return key.toLowerCase().includes('table'); +} diff --git a/packages/typedoc-plugin-markdown/src/theme/context/index.ts b/packages/typedoc-plugin-markdown/src/theme/context/index.ts new file mode 100644 index 000000000..ec39b7697 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/index.ts @@ -0,0 +1,8 @@ +/** + * Support and resources for the theme MarkdownThemeContext class. + * + * @module + */ +export * as helpers from './helpers'; +export * as partials from './partials'; +export * as templates from './templates'; diff --git a/packages/typedoc-plugin-markdown/src/theme/context/partials/_index.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/_index.ts new file mode 100644 index 000000000..da496617d --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/_index.ts @@ -0,0 +1,61 @@ +export * from './comments.comment'; +export * from './comments.commentParts'; +export * from './container.body'; +export * from './container.categories'; +export * from './container.groups'; +export * from './container.members'; +export * from './index'; +export * from './member.accessor'; +export * from './member.constructors'; +export * from './member.container'; +export * from './member.declaration'; +export * from './member.declarationTitle'; +export * from './member.documents'; +export * from './member.enumMembersTable'; +export * from './member.hierarchy'; +export * from './member.indexSignature'; +export * from './member.inheritance'; +export * from './member.memberTitle'; +export * from './member.memberWithGroups'; +export * from './member.parametersList'; +export * from './member.parametersTable'; +export * from './member.propertiesTable'; +export * from './member.reference'; +export * from './member.reflectionIndex'; +export * from './member.signature'; +export * from './member.signatureParameters'; +export * from './member.signatureReturns'; +export * from './member.signatureTitle'; +export * from './member.signatures'; +export * from './member.sources'; +export * from './member'; +export * from './member.typeAndParent'; +export * from './member.typeArguments'; +export * from './member.typeDeclaration'; +export * from './member.typeDeclarationList'; +export * from './member.typeDeclarationTable'; +export * from './member.typeParametersList'; +export * from './member.typeParametersTable'; +export * from './page.breadcrumbs'; +export * from './page.footer'; +export * from './page.header'; +export * from './page.packagesIndex'; +export * from './page.pageTitle'; +export * from './type.array'; +export * from './type.conditional'; +export * from './type.index-access'; +export * from './type.inferred'; +export * from './type.intersection'; +export * from './type.intrinsic'; +export * from './type.literal'; +export * from './type.named-tuple'; +export * from './type.query'; +export * from './type.reference'; +export * from './type.reflection.declaration'; +export * from './type.reflection.function'; +export * from './type.reflection'; +export * from './type.some'; +export * from './type.tuple'; +export * from './type.type-operator'; +export * from './type.union'; +export * from './type.unknown'; diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/comments.comment.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/comments.comment.ts similarity index 88% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/comments.comment.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/comments.comment.ts index e39846c92..282da0e00 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/comments.comment.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/comments.comment.ts @@ -1,7 +1,6 @@ -import { bold, heading } from '@plugin/libs/markdown'; -import { camelToTitleCase } from '@plugin/libs/utils'; -import { sanitizeComments } from '@plugin/libs/utils/sanitize-comments'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { bold, heading } from 'libs/markdown'; +import { camelToTitleCase, sanitizeComments } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { Comment, CommentTag } from 'typedoc'; /** @@ -28,7 +27,7 @@ export function comment( const md: string[] = []; if (opts.showSummary && model.summary?.length > 0) { - md.push(this.partials.commentParts(model.summary)); + md.push(this.helpers.getCommentParts(model.summary)); } if (opts.showTags && model.blockTags?.length) { diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/comments.commentParts.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/comments.commentParts.ts similarity index 94% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/comments.commentParts.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/comments.commentParts.ts index 582c32e23..9334f51e9 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/comments.commentParts.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/comments.commentParts.ts @@ -1,6 +1,6 @@ -import { link } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; import * as fs from 'fs'; +import { link } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { CommentDisplayPart, InlineTagDisplayPart } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/container.body.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/container.body.ts similarity index 96% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/container.body.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/container.body.ts index 4d0e6e17a..5464b44da 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/container.body.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/container.body.ts @@ -1,4 +1,4 @@ -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownThemeContext } from 'theme'; import { ContainerReflection, DocumentReflection, diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/container.categories.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/container.categories.ts similarity index 87% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/container.categories.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/container.categories.ts index d8fa6ca13..778e5685a 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/container.categories.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/container.categories.ts @@ -1,6 +1,6 @@ -import { heading } from '@plugin/libs/markdown'; +import { heading } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, ReflectionCategory } from 'typedoc'; -import { MarkdownThemeContext } from '../../markdown-themecontext'; /** * Renders a collection of reflection categories. diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/container.groups.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/container.groups.ts similarity index 74% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/container.groups.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/container.groups.ts index 24c2a2076..235a93dac 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/container.groups.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/container.groups.ts @@ -1,10 +1,10 @@ -import { heading } from '@plugin/libs/markdown'; +import { heading } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, ReflectionGroup, ReflectionKind, } from 'typedoc'; -import { MarkdownThemeContext } from '../../markdown-themecontext'; /** * Renders a collection of reflection groups. @@ -26,7 +26,8 @@ export function groups( return groupTitle; }; - groupsWithChildren?.forEach((group, index: number) => { + groupsWithChildren?.forEach((group) => { + const isEventProps = getGroupTitle(group.title) === 'Events'; if (group.categories) { md.push(heading(options.headingLevel, getGroupTitle(group.title))); if (group.description) { @@ -50,28 +51,17 @@ export function groups( if (group.description) { md.push(this.partials.commentParts(group.description)); } - if ( - isPropertiesGroup && - this.options - .getValue('propertiesFormat') - .toLowerCase() - .includes('table') - ) { + + if (isPropertiesGroup && this.helpers.useTableFormat('properties')) { md.push( - this.partials.declarationsTable( + this.partials.propertiesTable( group.children as DeclarationReflection[], { - isEventProps: getGroupTitle(group.title) === 'Events', + isEventProps, }, ), ); - } else if ( - isEnumGroup && - this.options - .getValue('enumMembersFormat') - .toLowerCase() - .includes('table') - ) { + } else if (isEnumGroup && this.helpers.useTableFormat('enums')) { md.push( this.partials.enumMembersTable( group.children as DeclarationReflection[], diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/container.members.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/container.members.ts similarity index 88% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/container.members.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/container.members.ts index 0328ae6b7..252c65f3c 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/container.members.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/container.members.ts @@ -1,5 +1,5 @@ -import { horizontalRule } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { horizontalRule } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/context/partials/index.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/index.ts new file mode 100644 index 000000000..2431527a3 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/index.ts @@ -0,0 +1,19 @@ +/** The `partials` namespace holds the partials for the theme and are used by templates to map speficic models to page output. + * + * Please note that partials:: + * + * - Take a `model` param (that references a specific TypeDoc model) and an `options` param if required. + * - Can call other partials and helpers. + * - Must return a string. + * + * Partials are categorised by their use: + * + * - Page Partials: Partials that render core page elements such as header and breadcrumbs. + * - Container Partials: Partials that are used to render reflection groups and categories. + * - Member Partials: Partials that render specific parts of reflections. + * - Comment Partials: Partials that render comments. + * - Type Partials: Partials that render specific TypeDoc model types. + * + * @module + **/ +export * from './_index'; diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.accessor.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.accessor.ts similarity index 92% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.accessor.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.accessor.ts index 429fe38d4..e45b75548 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.accessor.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.accessor.ts @@ -1,5 +1,5 @@ -import { heading } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { heading } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, ReflectionKind } from 'typedoc'; /** @@ -50,7 +50,7 @@ export function accessor( this.internationalization.kindPluralString(ReflectionKind.Parameter), ), ); - if (this.options.getValue('parametersFormat') === 'table') { + if (this.helpers.useTableFormat('parameters')) { md.push(this.partials.parametersTable(model.setSignature.parameters)); } else { md.push(this.partials.parametersList(model.setSignature.parameters)); diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.constructors.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.constructors.ts similarity index 78% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.constructors.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.constructors.ts index 0e053e0f2..774ac91e8 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.constructors.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.constructors.ts @@ -1,6 +1,6 @@ -import { heading } from '@plugin/libs/markdown'; -import { escapeChars } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { heading } from 'libs/markdown'; +import { escapeChars } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.container.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.container.ts similarity index 79% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.container.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.container.ts index 4eafb0674..25f492c49 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.container.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.container.ts @@ -1,5 +1,5 @@ -import { heading } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { heading } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, ReflectionKind } from 'typedoc'; /** @@ -20,7 +20,10 @@ export function memberContainer( md.push(``); } - if (!model.hasOwnDocument && !(model.kind === ReflectionKind.Constructor)) { + if ( + !model.hasOwnDocument && + ![ReflectionKind.Constructor].includes(model.kind) + ) { md.push(heading(options.headingLevel, this.partials.memberTitle(model))); } diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.declaration.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.declaration.ts similarity index 92% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.declaration.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.declaration.ts index f85f29b7f..401bc0e47 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.declaration.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.declaration.ts @@ -1,5 +1,5 @@ -import { heading } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks, heading } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, IntersectionType, @@ -31,7 +31,12 @@ export function declaration( ...options, }; - md.push(this.partials.reflectionFlags(model)); + md.push( + this.helpers + .getReflectionFlags(model) + .map((item) => backTicks(item)) + .join(' '), + ); md.push(this.partials.declarationTitle(model)); @@ -105,16 +110,14 @@ export function declaration( ), ), ); - if ( - this.options.getValue('parametersFormat').toLowerCase().includes('table') - ) { + if (this.helpers.useTableFormat('parameters')) { md.push(this.partials.typeParametersTable(model.typeParameters)); } else { md.push(this.partials.typeParametersList(model.typeParameters)); } } - if (typeDeclaration) { + if (Boolean(typeDeclaration)) { if (typeDeclaration?.indexSignatures?.length) { md.push(heading(opts.headingLevel, this.i18n.kind_index_signature())); typeDeclaration?.indexSignatures?.forEach((indexSignature) => { @@ -136,7 +139,7 @@ export function declaration( if (typeDeclaration?.children?.length) { const useHeading = model.kind !== ReflectionKind.Property || - this.options.getValue('propertiesFormat') == 'table'; + this.helpers.useTableFormat('properties'); if (!opts.nested && typeDeclaration?.children?.length) { if (useHeading) { md.push( diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.declarationTitle.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.declarationTitle.ts similarity index 86% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.declarationTitle.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.declarationTitle.ts index 4ac7b0d70..bb17dd59c 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.declarationTitle.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.declarationTitle.ts @@ -1,9 +1,10 @@ -import { backTicks, bold, codeBlock } from '@plugin/libs/markdown'; -import { escapeChars } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks, bold, codeBlock } from 'libs/markdown'; +import { escapeChars } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection } from 'typedoc'; /** + * Comments for declaration * * @category Member Partials */ @@ -77,11 +78,7 @@ export function declarationTitle( md.push(this.partials.someType(declarationType)); } - if ( - model.defaultValue && - model.defaultValue !== '...' && - model.defaultValue !== model.name - ) { + if (model.defaultValue && model.defaultValue !== model.name) { md.push(` = \`${model.defaultValue}\``); } diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.documents.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.documents.ts similarity index 57% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.documents.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.documents.ts index 5cd47f615..59586f618 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.documents.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.documents.ts @@ -1,5 +1,5 @@ -import { heading } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { heading } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { ContainerReflection, DeclarationReflection, @@ -22,17 +22,9 @@ export function documents( if (docGroups?.length) { docGroups.forEach((reflectionGroup) => { md.push(heading(options.headingLevel, reflectionGroup.title)); - if (this.options.getValue('inlineDocuments')) { - reflectionGroup.children.forEach((child) => { - md.push( - this.partials.commentParts((child as DocumentReflection).content), - ); - }); - } else { - docGroups.forEach((reflectionGroup) => { - md.push(this.helpers.getGroupIndex(reflectionGroup)); - }); - } + docGroups.forEach((reflectionGroup) => { + md.push(this.helpers.getGroupIndex(reflectionGroup)); + }); }); } return md.join('\n\n'); diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.enumMembersTable.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.enumMembersTable.ts similarity index 89% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.enumMembersTable.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.enumMembersTable.ts index 620e21500..9284811a0 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.enumMembersTable.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.enumMembersTable.ts @@ -1,6 +1,6 @@ -import { backTicks, htmlTable, table } from '@plugin/libs/markdown'; -import { removeLineBreaks } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks, htmlTable, table } from 'libs/markdown'; +import { removeLineBreaks } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, ReflectionKind, ReflectionType } from 'typedoc'; /** @@ -12,8 +12,8 @@ export function enumMembersTable( this: MarkdownThemeContext, model: DeclarationReflection[], ): string { - const tableColumnsOptions = this.options.getValue('tableColumnVisibility'); - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + const tableColumnsOptions = this.options.getValue('tableColumnSettings'); + const leftAlignHeadings = tableColumnsOptions.leftAlignHeaders; const comments = model.map((param) => !!param.comment?.hasVisibleComponent()); const hasComments = comments.some((value) => Boolean(value)); diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.hierarchy.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.hierarchy.ts similarity index 91% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.hierarchy.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.hierarchy.ts index 06bbd3e32..372f4e0e9 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.hierarchy.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.hierarchy.ts @@ -1,5 +1,5 @@ -import { heading, unorderedList } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { heading, unorderedList } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationHierarchy, SomeType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.indexSignature.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.indexSignature.ts similarity index 85% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.indexSignature.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.indexSignature.ts index 2846ebbeb..df2c829d6 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.indexSignature.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.indexSignature.ts @@ -1,5 +1,5 @@ -import { backTicks } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { SignatureReflection } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.inheritance.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.inheritance.ts similarity index 91% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.inheritance.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.inheritance.ts index fd1f3234d..d7d3d7251 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.inheritance.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.inheritance.ts @@ -1,5 +1,5 @@ -import { heading } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { heading } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, SignatureReflection } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.memberTitle.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.memberTitle.ts similarity index 87% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.memberTitle.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.memberTitle.ts index 4b9d7225f..4143827a2 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.memberTitle.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.memberTitle.ts @@ -1,7 +1,7 @@ -import { backTicks, strikeThrough } from '@plugin/libs/markdown'; -import { escapeChars } from '@plugin/libs/utils'; +import { backTicks, strikeThrough } from 'libs/markdown'; +import { escapeChars } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, ReflectionKind, ReflectionType } from 'typedoc'; -import { MarkdownThemeContext } from '../../..'; /** * Renders the main member title. diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.memberWithGroups.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.memberWithGroups.ts similarity index 93% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.memberWithGroups.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.memberWithGroups.ts index 5955252f5..8f7fa0643 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.memberWithGroups.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.memberWithGroups.ts @@ -1,5 +1,5 @@ -import { heading, unorderedList } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { heading, unorderedList } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, ReflectionKind } from 'typedoc'; /** @@ -39,7 +39,7 @@ export function memberWithGroups( ), ), ); - if (this.options.getValue('parametersFormat') === 'table') { + if (this.helpers.useTableFormat('parameters')) { md.push(this.partials.typeParametersTable(model.typeParameters)); } else { md.push(this.partials.typeParametersList(model.typeParameters)); diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.parametersList.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.parametersList.ts similarity index 92% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.parametersList.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.parametersList.ts index 3291f0290..615f232d3 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.parametersList.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.parametersList.ts @@ -1,6 +1,6 @@ -import { backTicks, bold } from '@plugin/libs/markdown'; -import { escapeChars } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks, bold } from 'libs/markdown'; +import { escapeChars } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { ParameterReflection, ReflectionKind, ReflectionType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.parametersTable.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.parametersTable.ts similarity index 92% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.parametersTable.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.parametersTable.ts index 312d23c30..d2d261fab 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.parametersTable.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.parametersTable.ts @@ -1,6 +1,6 @@ -import { backTicks, htmlTable, table } from '@plugin/libs/markdown'; -import { removeLineBreaks } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks, htmlTable, table } from 'libs/markdown'; +import { removeLineBreaks } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { ParameterReflection, ReflectionKind, ReflectionType } from 'typedoc'; /** @@ -10,8 +10,8 @@ export function parametersTable( this: MarkdownThemeContext, model: ParameterReflection[], ): string { - const tableColumnsOptions = this.options.getValue('tableColumnVisibility'); - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + const tableColumnsOptions = this.options.getValue('tableColumnSettings'); + const leftAlignHeadings = tableColumnsOptions.leftAlignHeaders; const parseParams = (current: any, acc: any) => { const shouldFlatten = diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.propertiesTable.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.propertiesTable.ts similarity index 83% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.propertiesTable.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.propertiesTable.ts index 6664b77fe..4cbc10087 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.propertiesTable.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.propertiesTable.ts @@ -1,11 +1,6 @@ -import { - backTicks, - htmlTable, - strikeThrough, - table, -} from '@plugin/libs/markdown'; -import { removeLineBreaks } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks, htmlTable, strikeThrough, table } from 'libs/markdown'; +import { removeLineBreaks } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, ReflectionKind } from 'typedoc'; import { getPropertyDefaultValue } from '../helpers/get-property-default-value'; @@ -17,13 +12,13 @@ import { getPropertyDefaultValue } from '../helpers/get-property-default-value'; * @category Member Partials * */ -export function declarationsTable( +export function propertiesTable( this: MarkdownThemeContext, model: DeclarationReflection[], options?: { isEventProps: boolean }, ): string { - const tableColumnsOptions = this.options.getValue('tableColumnVisibility'); - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + const tableColumnsOptions = this.options.getValue('tableColumnSettings'); + const leftAlignHeadings = tableColumnsOptions.leftAlignHeaders; const modifiers = model.map((param) => this.helpers.getModifier(param)?.toString(), ); @@ -32,9 +27,6 @@ export function declarationsTable( !tableColumnsOptions.hideModifiers && modifiers.some((value) => Boolean(value)); - const flags = model.map((param) => this.partials.reflectionFlags(param)); - const hasFlags = flags.some((value) => Boolean(value)); - const hasOverrides = !tableColumnsOptions.hideOverrides && model.some((prop) => Boolean(prop.overwrites)); @@ -43,9 +35,10 @@ export function declarationsTable( !tableColumnsOptions.hideInherited && model.some((prop) => Boolean(prop.inheritedFrom)); - const hasDefaults = model.some((prop) => - Boolean(getPropertyDefaultValue(prop)), - ); + const hasDefaults = + !tableColumnsOptions.hideDefaults && + model.some((prop) => Boolean(getPropertyDefaultValue(prop))); + const hasComments = model.some( (prop) => prop.comment?.blockTags?.length || prop?.comment?.summary?.length, ); @@ -66,10 +59,6 @@ export function declarationsTable( headers.push(this.i18n.theme_modifier()); } - if (hasFlags) { - headers.push(this.i18n.theme_flags()); - } - headers.push(this.i18n.theme_type()); if (hasDefaults) { @@ -118,16 +107,18 @@ export function declarationsTable( nameColumn.push(backTicks(propertyName)); } + const flags = this.helpers.getReflectionFlags(property); + + if (flags?.length) { + nameColumn.push(`(${flags.map((flag) => `*${flag}*`).join(', ')})`); + } + row.push(nameColumn.join(' ')); if (hasModifiers) { row.push(backTicks(modifiers[index] || 'public')); } - if (hasFlags) { - row.push(flags[index]); - } - if (propertyType) { const type = (propertyType as any).declaration?.signatures?.length ? this.partials.functionType( @@ -177,7 +168,10 @@ export function declarationsTable( rows.push(row); }); - return this.options.getValue('propertiesFormat') == 'table' - ? table(headers, rows, leftAlignHeadings) - : htmlTable(headers, rows, leftAlignHeadings); + const displayHtmlTable = + this.options.getValue('propertiesFormat') === 'htmlTable'; + + return displayHtmlTable + ? htmlTable(headers, rows, leftAlignHeadings) + : table(headers, rows, leftAlignHeadings); } diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.reference.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.reference.ts similarity index 90% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.reference.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.reference.ts index 6cf92ec83..fa4aeb97e 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.reference.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.reference.ts @@ -1,5 +1,5 @@ -import { link } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { link } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { ReferenceReflection, ReflectionKind } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/context/partials/member.reflectionIndex.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.reflectionIndex.ts new file mode 100644 index 000000000..46f57f688 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.reflectionIndex.ts @@ -0,0 +1,55 @@ +import { heading } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; +import { + DeclarationReflection, + DocumentReflection, + ProjectReflection, +} from 'typedoc'; + +/** + * + * @category Member Partials + */ +export function reflectionIndex( + this: MarkdownThemeContext, + model: ProjectReflection | DeclarationReflection, + options: { headingLevel: number }, +): string { + const md: string[] = []; + + if (model.categories) { + model.categories.forEach((categoryGroup) => { + md.push(heading(options.headingLevel, categoryGroup.title) + '\n'); + if (categoryGroup.description) { + md.push(this.partials.commentParts(categoryGroup.description) + '\n'); + } + md.push(this.helpers.getGroupIndex(categoryGroup) + '\n'); + }); + } else { + const groups = model.groups?.filter( + (group) => + group.allChildrenHaveOwnDocument() && + !(group.owningReflection instanceof DocumentReflection), + ); + groups?.forEach((reflectionGroup) => { + if (reflectionGroup.categories) { + md.push(heading(options.headingLevel, reflectionGroup.title) + '\n'); + reflectionGroup.categories.forEach((categoryGroup) => { + md.push( + heading(options.headingLevel + 1, categoryGroup.title) + '\n', + ); + if (categoryGroup.description) { + md.push( + this.partials.commentParts(categoryGroup.description) + '\n', + ); + } + md.push(this.helpers.getGroupIndex(categoryGroup) + '\n'); + }); + } else { + md.push(heading(options.headingLevel, reflectionGroup.title) + '\n'); + md.push(this.helpers.getGroupIndex(reflectionGroup) + '\n'); + } + }); + } + return md.join('\n'); +} diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signature.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.signature.ts similarity index 87% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signature.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.signature.ts index 7f463b572..9531356f8 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signature.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.signature.ts @@ -1,5 +1,5 @@ -import { heading } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks, heading } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { ReflectionKind, SignatureReflection } from 'typedoc'; /** @@ -19,7 +19,12 @@ export function signature( ): string { const md: string[] = []; - md.push(this.partials.reflectionFlags(model)); + md.push( + this.helpers + .getReflectionFlags(model) + .map((item) => backTicks(item)) + .join(' '), + ); if (!options.nested) { md.push( @@ -60,7 +65,7 @@ export function signature( ), ), ); - if (this.options.getValue('parametersFormat') === 'table') { + if (this.helpers.useTableFormat('parameters')) { md.push(this.partials.typeParametersTable(model.typeParameters)); } else { md.push(this.partials.typeParametersList(model.typeParameters)); @@ -74,7 +79,7 @@ export function signature( this.internationalization.kindPluralString(ReflectionKind.Parameter), ), ); - if (this.options.getValue('parametersFormat') === 'table') { + if (this.helpers.useTableFormat('parameters')) { md.push(this.partials.parametersTable(model.parameters)); } else { md.push(this.partials.parametersList(model.parameters)); diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signatureParameters.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.signatureParameters.ts similarity index 91% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signatureParameters.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.signatureParameters.ts index 4bef98265..b24d39699 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signatureParameters.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.signatureParameters.ts @@ -1,5 +1,5 @@ -import { backTicks } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { ParameterReflection, SomeType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signatureReturns.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.signatureReturns.ts similarity index 93% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signatureReturns.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.signatureReturns.ts index ff262ffbd..58f9f92ef 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signatureReturns.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.signatureReturns.ts @@ -1,5 +1,5 @@ -import { backTicks, heading } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks, heading } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, ReferenceType, diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signatureTitle.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.signatureTitle.ts similarity index 88% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signatureTitle.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.signatureTitle.ts index 8a769c81e..e33382ea2 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signatureTitle.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.signatureTitle.ts @@ -1,6 +1,6 @@ -import { backTicks, bold, codeBlock } from '@plugin/libs/markdown'; -import { escapeChars } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks, bold, codeBlock } from 'libs/markdown'; +import { escapeChars } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { SignatureReflection } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signatures.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.signatures.ts similarity index 89% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signatures.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.signatures.ts index 1f6688917..b7193612d 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.signatures.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.signatures.ts @@ -1,6 +1,6 @@ -import { heading } from '@plugin/libs/markdown'; -import { escapeChars } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { heading } from 'libs/markdown'; +import { escapeChars } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.sources.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.sources.ts similarity index 74% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.sources.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.sources.ts index 0fb3249ee..005ee8276 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.sources.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.sources.ts @@ -1,6 +1,6 @@ -import { heading, link } from '@plugin/libs/markdown'; -import { escapeChars } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { heading, link } from 'libs/markdown'; +import { escapeChars } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, SignatureReflection } from 'typedoc'; /** @@ -14,7 +14,7 @@ export function sources( const md: string[] = []; if (options.headingLevel !== -1) { - md.push(heading(options.headingLevel, this.i18n.theme_source())); + md.push(heading(options.headingLevel, this.i18n.theme_defined_in())); } model.sources?.forEach((source, index) => { if (index === 0) { diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.ts similarity index 95% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.ts index 14ede8127..efdd56fa2 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.ts @@ -1,4 +1,4 @@ -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, ReferenceReflection, diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeAndParent.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeAndParent.ts similarity index 91% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeAndParent.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeAndParent.ts index 5c7cc84f0..17b0dde45 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeAndParent.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeAndParent.ts @@ -1,5 +1,5 @@ -import { backTicks, link } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks, link } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { ArrayType, ReferenceType, SignatureReflection } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeArguments.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeArguments.ts similarity index 90% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeArguments.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeArguments.ts index 8a61b30ab..1f6981dd0 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeArguments.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeArguments.ts @@ -1,4 +1,4 @@ -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownThemeContext } from 'theme'; import { ReflectionType, SomeType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeDeclaration.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeDeclaration.ts similarity index 91% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeDeclaration.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeDeclaration.ts index 16648be68..31044ecad 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeDeclaration.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeDeclaration.ts @@ -1,4 +1,4 @@ -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeDeclarationList.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeDeclarationList.ts similarity index 91% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeDeclarationList.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeDeclarationList.ts index ebf3fe845..e0fb311a0 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeDeclarationList.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeDeclarationList.ts @@ -1,4 +1,4 @@ -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeDeclarationTable.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeDeclarationTable.ts similarity index 87% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeDeclarationTable.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeDeclarationTable.ts index 83c45631e..dc8f0a956 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeDeclarationTable.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeDeclarationTable.ts @@ -1,6 +1,6 @@ -import { backTicks, htmlTable, table } from '@plugin/libs/markdown'; -import { escapeChars } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks, htmlTable, table } from 'libs/markdown'; +import { escapeChars } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection } from 'typedoc'; /** @@ -10,8 +10,8 @@ export function typeDeclarationTable( this: MarkdownThemeContext, model: DeclarationReflection[], ): string { - const tableColumnsOptions = this.options.getValue('tableColumnVisibility'); - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + const tableColumnsOptions = this.options.getValue('tableColumnSettings'); + const leftAlignHeadings = tableColumnsOptions.leftAlignHeaders; const hasSources = !tableColumnsOptions.hideSources && @@ -23,14 +23,14 @@ export function typeDeclarationTable( includeSignatures: true, }); - const hasComments = declarations.some((declaration) => - Boolean(declaration.comment), - ); - const hasDefaultValues = declarations.some((declaration) => Boolean(declaration.defaultValue), ); + const hasComments = declarations.some((declaration) => + Boolean(declaration.comment), + ); + headers.push(this.i18n.theme_member()); headers.push(this.i18n.theme_type()); diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeParametersList.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeParametersList.ts similarity index 88% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeParametersList.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeParametersList.ts index 2e0ea4ef7..fe4b1c9e0 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeParametersList.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeParametersList.ts @@ -1,5 +1,5 @@ -import { bold, italic } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { bold, italic } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { TypeParameterReflection } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeParametersTable.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeParametersTable.ts similarity index 81% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeParametersTable.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeParametersTable.ts index 0c2b2de7c..46bf03d31 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.typeParametersTable.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/member.typeParametersTable.ts @@ -1,5 +1,5 @@ -import { backTicks, htmlTable, italic, table } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks, htmlTable, italic, table } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { ReflectionKind, TypeParameterReflection } from 'typedoc'; /** @@ -9,8 +9,7 @@ export function typeParametersTable( this: MarkdownThemeContext, model: TypeParameterReflection[], ): string { - const tableColumnsOptions = this.options.getValue('tableColumnVisibility'); - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + const tableColumnsOptions = this.options.getValue('tableColumnSettings'); const hasDefault = !tableColumnsOptions.hideDefaults && @@ -25,7 +24,7 @@ export function typeParametersTable( ]; if (hasDefault) { - headers.push(this.i18n.theme_value()); + headers.push(this.i18n.theme_default_type()); } if (hasComments) { @@ -70,6 +69,6 @@ export function typeParametersTable( }); return this.options.getValue('parametersFormat') == 'table' - ? table(headers, rows, leftAlignHeadings) - : htmlTable(headers, rows, leftAlignHeadings); + ? table(headers, rows, tableColumnsOptions.leftAlignHeaders) + : htmlTable(headers, rows, tableColumnsOptions.leftAlignHeaders); } diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.breadcrumbs.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/page.breadcrumbs.ts similarity index 79% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/page.breadcrumbs.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/page.breadcrumbs.ts index 8ab3cc779..b63d6e502 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.breadcrumbs.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/page.breadcrumbs.ts @@ -1,7 +1,7 @@ -import { link } from '@plugin/libs/markdown'; -import { escapeChars } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { link } from 'libs/markdown'; +import { escapeChars } from 'libs/utils'; import * as path from 'path'; +import { MarkdownThemeContext } from 'theme'; /** * @category Page Partials @@ -9,6 +9,7 @@ import * as path from 'path'; export function breadcrumbs(this: MarkdownThemeContext): string { const md: string[] = []; + const textContentMappings = this.options.getValue('textContentMappings'); const fileExtension = this.options.getValue('fileExtension'); const entryFileName = `${path.parse(this.options.getValue('entryFileName')).name}${fileExtension}`; @@ -20,13 +21,10 @@ export function breadcrumbs(this: MarkdownThemeContext): string { return ''; } - const name = this.page.project.name; - const version = this.page.project.packageVersion; - - const homeLabel = this.i18n - .theme_breadcrumbs_home(name, version ? `v${version}` : '') - .replace(/\s+/g, ' ') - .trim(); + const homeLabel = this.helpers.getProjectName( + textContentMappings['breadcrumbs.home'], + this.page, + ); md.push( link( diff --git a/packages/typedoc-plugin-markdown/src/theme/context/partials/page.footer.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/page.footer.ts new file mode 100644 index 000000000..2f81b5778 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/page.footer.ts @@ -0,0 +1,10 @@ +import { MarkdownThemeContext } from 'theme'; + +/** + * @category Page Partials + */ +export function footer(this: MarkdownThemeContext): string { + const textContentMappings = this.options.getValue('textContentMappings'); + const text = textContentMappings['footer.text']; + return text ? `***\n\n${text}` : ``; +} diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.header.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/page.header.ts similarity index 84% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/page.header.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/page.header.ts index a1e761d8f..7048fec94 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.header.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/page.header.ts @@ -1,7 +1,7 @@ -import { bold, link } from '@plugin/libs/markdown'; -import { removeFirstScopedDirectory } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { bold, link } from 'libs/markdown'; +import { removeFirstScopedDirectory } from 'libs/utils'; import * as path from 'path'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, EntryPointStrategy, @@ -13,6 +13,8 @@ import { * @category Page Partials */ export function header(this: MarkdownThemeContext): string { + const textContentMappings = this.options.getValue('textContentMappings'); + const getHeader = () => { const isPackages = this.options.getValue('entryPointStrategy') === @@ -31,15 +33,13 @@ export function header(this: MarkdownThemeContext): string { const entryFileName = `${path.parse(this.options.getValue('entryFileName')).name}${fileExtension}`; const md: string[] = []; - const name = this.page.project.name; - const version = this.page.project.packageVersion; - const title = this.i18n - .theme_header_title(name, version ? `v${version}` : '') - .replace(/\s+/g, ' ') - .trim(); + const title = this.helpers.getProjectName( + textContentMappings['header.title'], + this.page, + ); - const indexLabel = this.i18n.theme_header_docs(); + const indexLabel = textContentMappings['header.docs']; if (this.page.url === entryFileName) { md.push(bold(title)); @@ -67,7 +67,7 @@ export function header(this: MarkdownThemeContext): string { const indexUrl = useEntryModule ? entryFileName : this.page.project.url; - if (indexLabel) { + if (Boolean(indexLabel.length)) { if (this.page.url === readMeUrl) { md.push(link(bold(indexLabel), this.getRelativeUrl(indexUrl || ''))); } else { @@ -75,7 +75,9 @@ export function header(this: MarkdownThemeContext): string { } } } else { - md.push(bold(indexLabel)); + if (Boolean(indexLabel.length)) { + md.push(bold(indexLabel)); + } } return `${md.join(' • ')}\n\n***\n`; @@ -92,7 +94,7 @@ export function header(this: MarkdownThemeContext): string { const md: string[] = []; - const indexLabel = this.i18n.theme_header_docs(); + const indexLabel = textContentMappings['header.docs']; const ignoreScopes = this.options.getValue('excludeScopesInPaths'); const fileExtension = this.options.getValue('fileExtension'); @@ -122,7 +124,7 @@ export function header(this: MarkdownThemeContext): string { Boolean(packageItem.readme) && !this.options.getValue('mergeReadme'); if (preservePackageReadme) { - if (indexLabel) { + if (Boolean(indexLabel.length)) { if (this.page.url === packageEntryFile) { md.push( link(bold(indexLabel), this.getRelativeUrl(packageItem.url || '')), @@ -132,7 +134,9 @@ export function header(this: MarkdownThemeContext): string { } } } else { - md.push(bold(indexLabel)); + if (Boolean(indexLabel.length)) { + md.push(bold(indexLabel)); + } } return `${md.join(' • ')}\n\n***\n`; diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.packagesIndex.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/page.packagesIndex.ts similarity index 88% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/page.packagesIndex.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/page.packagesIndex.ts index de3576966..5b4d60a22 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.packagesIndex.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/page.packagesIndex.ts @@ -1,7 +1,7 @@ -import { heading, link, table } from '@plugin/libs/markdown'; -import { escapeChars, getFileNameWithExtension } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { heading, link, table } from 'libs/markdown'; +import { escapeChars, getFileNameWithExtension } from 'libs/utils'; import * as path from 'path'; +import { MarkdownThemeContext } from 'theme'; import { ProjectReflection } from 'typedoc'; /** @@ -11,7 +11,9 @@ export function packagesIndex( this: MarkdownThemeContext, model: ProjectReflection, ): string { - const leftAlignHeadings = this.options.getValue('leftAlignTableHeaders'); + const leftAlignHeadings = this.options.getValue( + 'tableColumnSettings', + ).leftAlignHeaders; const md: string[] = []; diff --git a/packages/typedoc-plugin-markdown/src/theme/context/partials/page.pageTitle.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/page.pageTitle.ts new file mode 100644 index 000000000..5cba4198e --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/page.pageTitle.ts @@ -0,0 +1,25 @@ +import { MarkdownThemeContext } from 'theme'; +import { DeclarationReflection, ReflectionKind } from 'typedoc'; + +/** + * @category Page Partials + */ +export function pageTitle(this: MarkdownThemeContext): string { + const textContentMappings = this.options.getValue('textContentMappings'); + const page = this.page; + if (page.model?.url === page.project.url) { + return this.helpers.getProjectName( + textContentMappings['title.indexPage'], + page, + ); + } + + const name = this.partials.memberTitle(page.model as DeclarationReflection); + const kind = this.internationalization.kindSingularString(page.model.kind); + const textContent = + page.model.kind === ReflectionKind.Module + ? name + : textContentMappings['title.memberPage']; + + return textContent.replace('{name}', name).replace('{kind}', kind); +} diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.array.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.array.ts similarity index 85% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.array.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.array.ts index 90bd94e98..560995efc 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.array.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.array.ts @@ -1,4 +1,4 @@ -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownThemeContext } from 'theme'; import { ArrayType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.conditional.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.conditional.ts similarity index 86% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.conditional.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.conditional.ts index 880207235..9bf374635 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.conditional.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.conditional.ts @@ -1,5 +1,5 @@ -import { italic } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { italic } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { ConditionalType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.index-access.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.index-access.ts similarity index 88% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.index-access.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.index-access.ts index 68ac731b1..5d48f7d24 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.index-access.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.index-access.ts @@ -1,4 +1,4 @@ -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownThemeContext } from 'theme'; import { IndexedAccessType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.inferred.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.inferred.ts similarity index 67% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.inferred.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.inferred.ts index 07f9d12f7..bb7c8ebb2 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.inferred.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.inferred.ts @@ -1,5 +1,5 @@ -import { escapeChars } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { escapeChars } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { InferredType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.intersection.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.intersection.ts similarity index 84% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.intersection.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.intersection.ts index d9b8efdfc..126bb5171 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.intersection.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.intersection.ts @@ -1,4 +1,4 @@ -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownThemeContext } from 'theme'; import { IntersectionType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.intrinsic.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.intrinsic.ts similarity index 66% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.intrinsic.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.intrinsic.ts index 89f83b0c5..4598b7b63 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.intrinsic.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.intrinsic.ts @@ -1,5 +1,5 @@ -import { backTicks } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { IntrinsicType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.literal.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.literal.ts similarity index 84% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.literal.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.literal.ts index f781d5f72..132a1de89 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.literal.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.literal.ts @@ -1,4 +1,4 @@ -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownThemeContext } from 'theme'; import { LiteralType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.named-tuple.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.named-tuple.ts similarity index 81% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.named-tuple.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.named-tuple.ts index 368a79474..614695473 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.named-tuple.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.named-tuple.ts @@ -1,4 +1,4 @@ -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownThemeContext } from 'theme'; import { NamedTupleMember } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.query.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.query.ts similarity index 70% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.query.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.query.ts index 9ed739999..7621fb87b 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.query.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.query.ts @@ -1,5 +1,5 @@ -import { italic } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { italic } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { QueryType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.reference.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.reference.ts similarity index 89% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.reference.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.reference.ts index 539e22285..2786335fd 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.reference.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.reference.ts @@ -1,5 +1,5 @@ -import { backTicks, link } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks, link } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { ReferenceType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.reflection.declaration.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.reflection.declaration.ts similarity index 88% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.reflection.declaration.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.reflection.declaration.ts index d9ff1b694..d40ed9137 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.reflection.declaration.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.reflection.declaration.ts @@ -1,5 +1,5 @@ -import { backTicks } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, SomeType } from 'typedoc'; /** @@ -46,10 +46,9 @@ export function declarationType( const theType = this.helpers.getDeclarationType(obj) as SomeType; - const typeString = - obj.defaultValue && obj.defaultValue !== '...' - ? backTicks(obj.defaultValue) - : this.partials.someType(theType); + const typeString = obj.defaultValue + ? backTicks(obj.defaultValue) + : this.partials.someType(theType); if (shouldFormat) { return ` ${name.join(' ')}: ${indentBlock(typeString, true)};\n`; } diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.reflection.function.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.reflection.function.ts similarity index 92% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.reflection.function.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.reflection.function.ts index 5f6129494..b77af2e94 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.reflection.function.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.reflection.function.ts @@ -1,5 +1,5 @@ -import { backTicks } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { SignatureReflection, SomeType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.reflection.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.reflection.ts similarity index 84% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.reflection.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.reflection.ts index 0ac0ab6eb..7e988fa14 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.reflection.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.reflection.ts @@ -1,5 +1,5 @@ -import { backTicks } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { ReflectionType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.some.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.some.ts similarity index 94% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.some.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.some.ts index 57670dcbe..6cf034883 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.some.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.some.ts @@ -1,5 +1,5 @@ -import { backTicks } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { backTicks } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { ArrayType, ConditionalType, diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.tuple.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.tuple.ts similarity index 83% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.tuple.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.tuple.ts index 2f4357202..17e0e7e24 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.tuple.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.tuple.ts @@ -1,4 +1,4 @@ -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownThemeContext } from 'theme'; import { TupleType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.type-operator.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.type-operator.ts similarity index 82% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.type-operator.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.type-operator.ts index 51c591192..43a928342 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.type-operator.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.type-operator.ts @@ -1,4 +1,4 @@ -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownThemeContext } from 'theme'; import { TypeOperatorType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.union.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.union.ts similarity index 89% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.union.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.union.ts index aeacae037..149fb810f 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.union.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.union.ts @@ -1,4 +1,4 @@ -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownThemeContext } from 'theme'; import { UnionType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.unknown.ts b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.unknown.ts similarity index 66% rename from packages/typedoc-plugin-markdown/src/theme/resources/partials/type.unknown.ts rename to packages/typedoc-plugin-markdown/src/theme/context/partials/type.unknown.ts index 8fe1da95c..7b566da37 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/type.unknown.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/partials/type.unknown.ts @@ -1,5 +1,5 @@ -import { escapeChars } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { escapeChars } from 'libs/utils'; +import { MarkdownThemeContext } from 'theme'; import { UnknownType } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/index.ts b/packages/typedoc-plugin-markdown/src/theme/context/resources.ts similarity index 53% rename from packages/typedoc-plugin-markdown/src/theme/resources/index.ts rename to packages/typedoc-plugin-markdown/src/theme/context/resources.ts index 6b22c7732..b5ee7f8ad 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/index.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/resources.ts @@ -1,6 +1,6 @@ // THIS FILE IS AUTO GENERATED. DO NOT EDIT DIRECTLY. -import { MarkdownPageEvent } from '@plugin/app/events'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownPageEvent } from 'app/events'; +import { MarkdownThemeContext } from 'theme'; import { ArrayType, Comment, @@ -34,119 +34,44 @@ import { UnionType, UnknownType, } from 'typedoc'; +import { templates, partials, helpers } from './index'; -import { document } from './templates/document'; -import { project } from './templates/project'; -import { readme } from './templates/read-me'; -import { reflection } from './templates/reflection'; - -import { comment } from './partials/comments.comment'; -import { commentParts } from './partials/comments.commentParts'; -import { body } from './partials/container.body'; -import { categories } from './partials/container.categories'; -import { groups } from './partials/container.groups'; -import { members } from './partials/container.members'; -import { accessor } from './partials/member.accessor'; -import { constructor } from './partials/member.constructors'; -import { memberContainer } from './partials/member.container'; -import { declaration } from './partials/member.declaration'; -import { declarationTitle } from './partials/member.declarationTitle'; -import { documents } from './partials/member.documents'; -import { enumMembersTable } from './partials/member.enumMembersTable'; -import { hierarchy } from './partials/member.hierarchy'; -import { indexSignature } from './partials/member.indexSignature'; -import { inheritance } from './partials/member.inheritance'; -import { memberTitle } from './partials/member.memberTitle'; -import { memberWithGroups } from './partials/member.memberWithGroups'; -import { parametersList } from './partials/member.parametersList'; -import { parametersTable } from './partials/member.parametersTable'; -import { declarationsTable } from './partials/member.propertiesTable'; -import { referenceMember } from './partials/member.reference'; -import { reflectionFlags } from './partials/member.reflectionFlags'; -import { reflectionIndex } from './partials/member.reflectionIndex'; -import { signature } from './partials/member.signature'; -import { signatureParameters } from './partials/member.signatureParameters'; -import { signatureReturns } from './partials/member.signatureReturns'; -import { signatureTitle } from './partials/member.signatureTitle'; -import { signatures } from './partials/member.signatures'; -import { sources } from './partials/member.sources'; -import { member } from './partials/member'; -import { typeAndParent } from './partials/member.typeAndParent'; -import { typeArguments } from './partials/member.typeArguments'; -import { typeDeclaration } from './partials/member.typeDeclaration'; -import { typeDeclarationList } from './partials/member.typeDeclarationList'; -import { typeDeclarationTable } from './partials/member.typeDeclarationTable'; -import { typeParametersList } from './partials/member.typeParametersList'; -import { typeParametersTable } from './partials/member.typeParametersTable'; -import { breadcrumbs } from './partials/page.breadcrumbs'; -import { footer } from './partials/page.footer'; -import { header } from './partials/page.header'; -import { packagesIndex } from './partials/page.packagesIndex'; -import { pageTitle } from './partials/page.pageTitle'; -import { arrayType } from './partials/type.array'; -import { conditionalType } from './partials/type.conditional'; -import { indexAccessType } from './partials/type.index-access'; -import { inferredType } from './partials/type.inferred'; -import { intersectionType } from './partials/type.intersection'; -import { intrinsicType } from './partials/type.intrinsic'; -import { literalType } from './partials/type.literal'; -import { namedTupleType } from './partials/type.named-tuple'; -import { queryType } from './partials/type.query'; -import { referenceType } from './partials/type.reference'; -import { declarationType } from './partials/type.reflection.declaration'; -import { functionType } from './partials/type.reflection.function'; -import { reflectionType } from './partials/type.reflection'; -import { someType } from './partials/type.some'; -import { tupleType } from './partials/type.tuple'; -import { typeOperatorType } from './partials/type.type-operator'; -import { unionType } from './partials/type.union'; -import { unknownType } from './partials/type.unknown'; - -import { getDeclarationType } from './helpers/get-declaration-type'; -import { getDescriptionForReflection } from './helpers/get-description-for-reflection'; -import { getFlattenedDeclarations } from './helpers/get-flattened-declarations'; -import { getGroupIndexList } from './helpers/get-group-index-list'; -import { getGroupIndexTable } from './helpers/get-group-index-table'; -import { getGroupIndex } from './helpers/get-group-index'; -import { getHierarchyType } from './helpers/get-hierarchy-type'; -import { getKeyword } from './helpers/get-keyword'; -import { getModifier } from './helpers/get-modifier'; -import { getParameterDefaultValue } from './helpers/get-parameter-default-value'; -import { getPropertyDefaultValue } from './helpers/get-property-default-value'; -import { getReturnType } from './helpers/get-return-type'; -import { isGroupKind } from './helpers/is-group-kind'; - -export const templates = (context: MarkdownThemeContext) => { +export const resourceTemplates = (context: MarkdownThemeContext) => { return { /** * Template that maps to a project document. */ + /** @ignore **/ document: (page: MarkdownPageEvent) => - document.apply(context, [page]) as string, + templates.document.apply(context, [page]) as string, /** * Template that maps to the root project reflection. This will be the index page / documentation root page. */ + /** @ignore **/ project: (page: MarkdownPageEvent) => - project.apply(context, [page]) as string, + templates.project.apply(context, [page]) as string, /** * Template that specifically maps to the resolved readme file. This template is not used when 'readme' is set to 'none'. */ + /** @ignore **/ readme: (page: MarkdownPageEvent) => - readme.apply(context, [page]) as string, + templates.readme.apply(context, [page]) as string, /** * Template that maps to individual reflection models. */ + /** @ignore **/ reflection: (page: MarkdownPageEvent) => - reflection.apply(context, [page]) as string, + templates.reflection.apply(context, [page]) as string, }; }; -export const partials = (context: MarkdownThemeContext) => { +export const resourcePartials = (context: MarkdownThemeContext) => { return { /** * * @category Comment Partials */ + /** @ignore **/ comment: ( model: Comment, options: { @@ -155,144 +80,163 @@ export const partials = (context: MarkdownThemeContext) => { showTags?: boolean | undefined; isTableColumn?: boolean | undefined; } = {}, - ) => comment.apply(context, [model, options]) as string, + ) => partials.comment.apply(context, [model, options]) as string, /** * * @category Comment Partials */ + /** @ignore **/ commentParts: (model: CommentDisplayPart[]) => - commentParts.apply(context, [model]) as string, + partials.commentParts.apply(context, [model]) as string, /** * * @category Container Partials */ + /** @ignore **/ body: (model: ContainerReflection, options: { headingLevel: number }) => - body.apply(context, [model, options]) as string, + partials.body.apply(context, [model, options]) as string, /** * Renders a collection of reflection categories. * @category Container Partials */ + /** @ignore **/ categories: ( model: ReflectionCategory[], options: { headingLevel: number }, - ) => categories.apply(context, [model, options]) as string, + ) => partials.categories.apply(context, [model, options]) as string, /** * Renders a collection of reflection groups. * @category Container Partials */ + /** @ignore **/ groups: (model: ReflectionGroup[], options: { headingLevel: number }) => - groups.apply(context, [model, options]) as string, + partials.groups.apply(context, [model, options]) as string, /** * Renders a collection of members. * @category Container Partials */ + /** @ignore **/ members: ( model: DeclarationReflection[], options: { headingLevel: number }, - ) => members.apply(context, [model, options]) as string, + ) => partials.members.apply(context, [model, options]) as string, /** * Renders an accessor member. * @category Member Partials */ + /** @ignore **/ accessor: ( model: DeclarationReflection, options: { headingLevel: number }, - ) => accessor.apply(context, [model, options]) as string, + ) => partials.accessor.apply(context, [model, options]) as string, /** * Renders an constructor member. * @category Member Partials */ + /** @ignore **/ constructor: ( model: DeclarationReflection, options: { headingLevel: number }, - ) => constructor.apply(context, [model, options]) as string, + ) => partials.constructor.apply(context, [model, options]) as string, /** * * @category Member Partials */ + /** @ignore **/ memberContainer: ( model: DeclarationReflection, options: { headingLevel: number; nested?: boolean | undefined }, - ) => memberContainer.apply(context, [model, options]) as string, + ) => partials.memberContainer.apply(context, [model, options]) as string, /** * Renders a standard declaration member. * @category Member Partials */ + /** @ignore **/ declaration: ( model: DeclarationReflection, options: { headingLevel: number; nested?: boolean | undefined } = { headingLevel: 2, nested: false, }, - ) => declaration.apply(context, [model, options]) as string, + ) => partials.declaration.apply(context, [model, options]) as string, /** - * + * Comments for declaration * @category Member Partials */ + /** @ignore **/ declarationTitle: (model: DeclarationReflection) => - declarationTitle.apply(context, [model]) as string, + partials.declarationTitle.apply(context, [model]) as string, /** * * @category Member Partials */ + /** @ignore **/ documents: ( model: ProjectReflection | DeclarationReflection | ContainerReflection, options: { headingLevel: number }, - ) => documents.apply(context, [model, options]) as string, + ) => partials.documents.apply(context, [model, options]) as string, /** * Renders enum members as a table. * @category Member Partials */ + /** @ignore **/ enumMembersTable: (model: DeclarationReflection[]) => - enumMembersTable.apply(context, [model]) as string, + partials.enumMembersTable.apply(context, [model]) as string, /** * * @category Member Partials */ + /** @ignore **/ hierarchy: ( model: DeclarationHierarchy, options: { headingLevel: number }, - ) => hierarchy.apply(context, [model, options]) as string, + ) => partials.hierarchy.apply(context, [model, options]) as string, /** * Renders an index signature block * @category Member Partials */ + /** @ignore **/ indexSignature: (model: SignatureReflection) => - indexSignature.apply(context, [model]) as string, + partials.indexSignature.apply(context, [model]) as string, /** * Renders an inheritance section. * @category Member Partials */ + /** @ignore **/ inheritance: ( model: DeclarationReflection | SignatureReflection, options: { headingLevel: number }, - ) => inheritance.apply(context, [model, options]) as string, + ) => partials.inheritance.apply(context, [model, options]) as string, /** * Renders the main member title. * @category Member Partials */ + /** @ignore **/ memberTitle: (model: DeclarationReflection) => - memberTitle.apply(context, [model]) as string, + partials.memberTitle.apply(context, [model]) as string, /** * Renders a top-level member that contains group and child members such as Classes, Interfaces and Enums. * @category Member Partials */ + /** @ignore **/ memberWithGroups: ( model: DeclarationReflection, options: { headingLevel: number }, - ) => memberWithGroups.apply(context, [model, options]) as string, + ) => partials.memberWithGroups.apply(context, [model, options]) as string, /** * * @category Member Partials */ + /** @ignore **/ parametersList: (model: ParameterReflection[]) => - parametersList.apply(context, [model]) as string, + partials.parametersList.apply(context, [model]) as string, /** * * @category Member Partials */ + /** @ignore **/ parametersTable: (model: ParameterReflection[]) => - parametersTable.apply(context, [model]) as string, + partials.parametersTable.apply(context, [model]) as string, /** * Renders a collection of properties in a table. @@ -300,34 +244,32 @@ There is no association list partial for properties as these are handled as a st * @category Member Partials * */ - declarationsTable: ( + /** @ignore **/ + propertiesTable: ( model: DeclarationReflection[], options?: { isEventProps: boolean } | undefined, - ) => declarationsTable.apply(context, [model, options]) as string, + ) => partials.propertiesTable.apply(context, [model, options]) as string, /** * Renders an reference member. * @category Member Partials */ + /** @ignore **/ referenceMember: (model: ReferenceReflection) => - referenceMember.apply(context, [model]) as string, - /** - * Renders the flags of a reflection. - * @category Member Partials - */ - reflectionFlags: (model: Reflection) => - reflectionFlags.apply(context, [model]) as string, + partials.referenceMember.apply(context, [model]) as string, /** * * @category Member Partials */ + /** @ignore **/ reflectionIndex: ( model: ProjectReflection | DeclarationReflection, options: { headingLevel: number }, - ) => reflectionIndex.apply(context, [model, options]) as string, + ) => partials.reflectionIndex.apply(context, [model, options]) as string, /** * Renders a signature member. * @category Member Partials */ + /** @ignore **/ signature: ( model: SignatureReflection, options: { @@ -336,281 +278,359 @@ There is no association list partial for properties as these are handled as a st accessor?: string | undefined; multipleSignatures?: boolean | undefined; }, - ) => signature.apply(context, [model, options]) as string, + ) => partials.signature.apply(context, [model, options]) as string, /** * * @category Member Partials */ + /** @ignore **/ signatureParameters: (model: ParameterReflection[]) => - signatureParameters.apply(context, [model]) as string, + partials.signatureParameters.apply(context, [model]) as string, /** * * @category Member Partials */ + /** @ignore **/ signatureReturns: ( model: SignatureReflection, options: { headingLevel: number }, - ) => signatureReturns.apply(context, [model, options]) as string, + ) => partials.signatureReturns.apply(context, [model, options]) as string, /** * * @category Member Partials */ + /** @ignore **/ signatureTitle: ( model: SignatureReflection, options?: | { accessor?: string | undefined; includeType?: boolean | undefined } | undefined, - ) => signatureTitle.apply(context, [model, options]) as string, + ) => partials.signatureTitle.apply(context, [model, options]) as string, /** * Renders a signature collection. * @category Member Partials */ + /** @ignore **/ signatures: ( model: DeclarationReflection, options: { headingLevel: number; nested?: boolean | undefined }, - ) => signatures.apply(context, [model, options]) as string, + ) => partials.signatures.apply(context, [model, options]) as string, /** * * @category Member Partials */ + /** @ignore **/ sources: ( model: DeclarationReflection | SignatureReflection, options: { headingLevel: number }, - ) => sources.apply(context, [model, options]) as string, + ) => partials.sources.apply(context, [model, options]) as string, /** * * @category Member Partials */ + /** @ignore **/ member: ( model: DeclarationReflection, options: { headingLevel: number; nested?: boolean | undefined }, - ) => member.apply(context, [model, options]) as string, + ) => partials.member.apply(context, [model, options]) as string, /** * * @category Member Partials */ + /** @ignore **/ typeAndParent: (model: ArrayType | ReferenceType) => - typeAndParent.apply(context, [model]) as string, + partials.typeAndParent.apply(context, [model]) as string, /** * * @category Member Partials */ + /** @ignore **/ typeArguments: ( model: SomeType[], options?: { foreCollpase?: boolean | undefined } | undefined, - ) => typeArguments.apply(context, [model, options]) as string, + ) => partials.typeArguments.apply(context, [model, options]) as string, /** * * @category Member Partials */ + /** @ignore **/ typeDeclaration: ( model: DeclarationReflection[], options: { headingLevel: number }, - ) => typeDeclaration.apply(context, [model, options]) as string, + ) => partials.typeDeclaration.apply(context, [model, options]) as string, /** * * @category Member Partials */ + /** @ignore **/ typeDeclarationList: ( model: DeclarationReflection[], headingLevel: number, - ) => typeDeclarationList.apply(context, [model, headingLevel]) as string, + ) => + partials.typeDeclarationList.apply(context, [ + model, + headingLevel, + ]) as string, /** * * @category Member Partials */ + /** @ignore **/ typeDeclarationTable: (model: DeclarationReflection[]) => - typeDeclarationTable.apply(context, [model]) as string, + partials.typeDeclarationTable.apply(context, [model]) as string, /** * * @category Member Partials */ + /** @ignore **/ typeParametersList: (model: TypeParameterReflection[]) => - typeParametersList.apply(context, [model]) as string, + partials.typeParametersList.apply(context, [model]) as string, /** * * @category Member Partials */ + /** @ignore **/ typeParametersTable: (model: TypeParameterReflection[]) => - typeParametersTable.apply(context, [model]) as string, + partials.typeParametersTable.apply(context, [model]) as string, /** * * @category Page Partials */ - breadcrumbs: () => breadcrumbs.apply(context, []) as string, + /** @ignore **/ + breadcrumbs: () => partials.breadcrumbs.apply(context, []) as string, /** * * @category Page Partials */ - footer: () => footer.apply(context, []) as string, + /** @ignore **/ + footer: () => partials.footer.apply(context, []) as string, /** * * @category Page Partials */ - header: () => header.apply(context, []) as string, + /** @ignore **/ + header: () => partials.header.apply(context, []) as string, /** * * @category Page Partials */ + /** @ignore **/ packagesIndex: (model: ProjectReflection) => - packagesIndex.apply(context, [model]) as string, + partials.packagesIndex.apply(context, [model]) as string, /** * * @category Page Partials */ - pageTitle: () => pageTitle.apply(context, []) as string, + /** @ignore **/ + pageTitle: () => partials.pageTitle.apply(context, []) as string, /** * * @category Type Partials */ + /** @ignore **/ arrayType: (model: ArrayType) => - arrayType.apply(context, [model]) as string, + partials.arrayType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ conditionalType: (model: ConditionalType) => - conditionalType.apply(context, [model]) as string, + partials.conditionalType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ indexAccessType: (model: IndexedAccessType) => - indexAccessType.apply(context, [model]) as string, + partials.indexAccessType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ inferredType: (model: InferredType) => - inferredType.apply(context, [model]) as string, + partials.inferredType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ intersectionType: (model: IntersectionType) => - intersectionType.apply(context, [model]) as string, + partials.intersectionType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ intrinsicType: (model: IntrinsicType) => - intrinsicType.apply(context, [model]) as string, + partials.intrinsicType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ literalType: (model: LiteralType) => - literalType.apply(context, [model]) as string, + partials.literalType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ namedTupleType: (model: NamedTupleMember) => - namedTupleType.apply(context, [model]) as string, + partials.namedTupleType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ queryType: (model: QueryType) => - queryType.apply(context, [model]) as string, + partials.queryType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ referenceType: (model: ReferenceType) => - referenceType.apply(context, [model]) as string, + partials.referenceType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ declarationType: (model: DeclarationReflection) => - declarationType.apply(context, [model]) as string, + partials.declarationType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ functionType: ( model: SignatureReflection[], options?: { forceParameterType: boolean } | undefined, - ) => functionType.apply(context, [model, options]) as string, + ) => partials.functionType.apply(context, [model, options]) as string, /** * * @category Type Partials */ + /** @ignore **/ reflectionType: ( model: ReflectionType, options?: { foreCollpase?: boolean | undefined } | undefined, - ) => reflectionType.apply(context, [model, options]) as string, + ) => partials.reflectionType.apply(context, [model, options]) as string, /** * Takes a generic Type and returns the appropriate partial for it. * @category Type Partials */ + /** @ignore **/ someType: (model?: SomeType | undefined) => - someType.apply(context, [model]) as string, + partials.someType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ tupleType: (model: TupleType) => - tupleType.apply(context, [model]) as string, + partials.tupleType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ typeOperatorType: (model: TypeOperatorType) => - typeOperatorType.apply(context, [model]) as string, + partials.typeOperatorType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ unionType: (model: UnionType) => - unionType.apply(context, [model]) as string, + partials.unionType.apply(context, [model]) as string, /** * * @category Type Partials */ + /** @ignore **/ unknownType: (model: UnknownType) => - unknownType.apply(context, [model]) as string, + partials.unknownType.apply(context, [model]) as string, }; }; -export const helpers = (context: MarkdownThemeContext) => { +export const resourceHelpers = (context: MarkdownThemeContext) => { return { + /** @ignore **/ + getCommentParts: (model: CommentDisplayPart[]) => + helpers.getCommentParts.apply(context, [model]) as string, + /** @ignore **/ getDeclarationType: (model: DeclarationReflection) => - getDeclarationType.apply(context, [model]) as SomeType | undefined, + helpers.getDeclarationType.apply(context, [model]) as + | SomeType + | undefined, + /** @ignore **/ getDescriptionForReflection: (model: DeclarationReflection) => - getDescriptionForReflection.apply(context, [model]) as string | null, + helpers.getDescriptionForReflection.apply(context, [model]) as + | string + | null, + /** @ignore **/ getFlattenedDeclarations: ( model: DeclarationReflection[], options?: { includeSignatures: boolean } | undefined, ) => - getFlattenedDeclarations.apply(context, [ + helpers.getFlattenedDeclarations.apply(context, [ model, options, ]) as DeclarationReflection[], + /** @ignore **/ getGroupIndexList: ( children: DeclarationReflection[] | DocumentReflection[], - ) => getGroupIndexList.apply(context, [children]) as string, + ) => helpers.getGroupIndexList.apply(context, [children]) as string, + /** @ignore **/ getGroupIndexTable: ( children: DeclarationReflection[] | DocumentReflection[], - ) => getGroupIndexTable.apply(context, [children]) as string, + kind?: ReflectionKind | undefined, + ) => helpers.getGroupIndexTable.apply(context, [children, kind]) as string, + /** @ignore **/ getGroupIndex: (group: ReflectionCategory | ReflectionGroup) => - getGroupIndex.apply(context, [group]) as any, + helpers.getGroupIndex.apply(context, [group]) as any, + /** @ignore **/ getHierarchyType: ( model: SomeType, options?: { isTarget: boolean } | undefined, - ) => getHierarchyType.apply(context, [model, options]) as string, + ) => helpers.getHierarchyType.apply(context, [model, options]) as string, + /** @ignore **/ getKeyword: (model: ReflectionKind) => - getKeyword.apply(context, [model]) as string, + helpers.getKeyword.apply(context, [model]) as string, + /** @ignore **/ getModifier: (model: DeclarationReflection) => - getModifier.apply(context, [model]) as string | null, + helpers.getModifier.apply(context, [model]) as string | null, + /** @ignore **/ getParameterDefaultValue: (model: ParameterReflection) => - getParameterDefaultValue.apply(context, [model]) as string, + helpers.getParameterDefaultValue.apply(context, [model]) as string, + /** @ignore **/ + getProjectName: ( + stringWithPlaceholders: string, + page: MarkdownPageEvent, + ) => + helpers.getProjectName.apply(context, [ + stringWithPlaceholders, + page, + ]) as string, + /** @ignore **/ getPropertyDefaultValue: (model: DeclarationReflection) => - getPropertyDefaultValue.apply(context, [model]) as string | null, + helpers.getPropertyDefaultValue.apply(context, [model]) as string | null, + /** @ignore **/ + getReflectionFlags: ( + reflection: DeclarationReflection | SignatureReflection, + ) => helpers.getReflectionFlags.apply(context, [reflection]) as string[], + /** @ignore **/ getReturnType: (model?: SomeType | undefined) => - getReturnType.apply(context, [model]) as string, + helpers.getReturnType.apply(context, [model]) as string, + /** @ignore **/ isGroupKind: (model: DeclarationReflection | SignatureReflection) => - isGroupKind.apply(context, [model]) as boolean, + helpers.isGroupKind.apply(context, [model]) as boolean, + /** @ignore **/ + useTableFormat: ( + key: 'properties' | 'parameters' | 'enums' | 'typeDeclarations', + ) => helpers.useTableFormat.apply(context, [key]) as boolean, }; }; diff --git a/packages/typedoc-plugin-markdown/src/theme/context/templates/_index.ts b/packages/typedoc-plugin-markdown/src/theme/context/templates/_index.ts new file mode 100644 index 000000000..8a70142b4 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/templates/_index.ts @@ -0,0 +1,5 @@ +export * from './document'; +export * from './index'; +export * from './project'; +export * from './read-me'; +export * from './reflection'; diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/templates/document.ts b/packages/typedoc-plugin-markdown/src/theme/context/templates/document.ts similarity index 83% rename from packages/typedoc-plugin-markdown/src/theme/resources/templates/document.ts rename to packages/typedoc-plugin-markdown/src/theme/context/templates/document.ts index 1cfbe5982..decf13d43 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/templates/document.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/templates/document.ts @@ -1,5 +1,5 @@ -import { MarkdownPageEvent } from '@plugin/app/events'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownPageEvent } from 'app/events'; +import { MarkdownThemeContext } from 'theme'; import { DocumentReflection } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/context/templates/index.ts b/packages/typedoc-plugin-markdown/src/theme/context/templates/index.ts new file mode 100644 index 000000000..7d1dcf4f8 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/context/templates/index.ts @@ -0,0 +1,8 @@ +/** + * Then `templates` namespace holds the main templates for the theme and are mapped to single pages and configured in the MarkdownTheme. + * + * All templates return a string that is passed back to the renderer. Internally templates call partials and helpers. + * + * @module + */ +export * from './_index'; diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/templates/project.ts b/packages/typedoc-plugin-markdown/src/theme/context/templates/project.ts similarity index 75% rename from packages/typedoc-plugin-markdown/src/theme/resources/templates/project.ts rename to packages/typedoc-plugin-markdown/src/theme/context/templates/project.ts index 51ee4efd0..904204b01 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/templates/project.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/templates/project.ts @@ -1,6 +1,6 @@ -import { MarkdownPageEvent } from '@plugin/app/events'; -import { heading } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownPageEvent } from 'app/events'; +import { heading } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { EntryPointStrategy, ProjectReflection } from 'typedoc'; /** @@ -12,6 +12,8 @@ export function project( ) { const md: string[] = []; + const textContentMappings = this.options.getValue('textContentMappings'); + md.push(this.hook('index.page.begin').join('\n')); if (!this.options.getValue('hidePageHeader')) { @@ -41,7 +43,15 @@ export function project( if (page.model?.groups?.some((group) => group.allChildrenHaveOwnDocument())) { if (includeReadme) { - md.push(heading(2, this.i18n.theme_api_index())); + md.push( + heading( + 2, + this.helpers.getProjectName( + textContentMappings['title.indexPage'], + page, + ), + ), + ); } md.push( this.partials.documents(page.model, { @@ -57,9 +67,11 @@ export function project( const isPackages = this.page.project.url === this.page.url && - this.options.getValue('entryPointStrategy') === EntryPointStrategy.Packages; + this.options.getValue('entryPointStrategy') === + EntryPointStrategy.Packages && + this.options.getValue('entryPoints')?.length > 1; - if (isPackages && page.model.children?.length) { + if (isPackages) { md.push(this.partials.packagesIndex(page.model)); } else { md.push(this.partials.body(page.model, { headingLevel: 2 })); diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/templates/read-me.ts b/packages/typedoc-plugin-markdown/src/theme/context/templates/read-me.ts similarity index 86% rename from packages/typedoc-plugin-markdown/src/theme/resources/templates/read-me.ts rename to packages/typedoc-plugin-markdown/src/theme/context/templates/read-me.ts index 7d2d2e844..128bfcddc 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/templates/read-me.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/templates/read-me.ts @@ -1,5 +1,5 @@ -import { MarkdownPageEvent } from '@plugin/app/events'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownPageEvent } from 'app/events'; +import { MarkdownThemeContext } from 'theme'; import { CommentDisplayPart, ProjectReflection } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/templates/reflection.ts b/packages/typedoc-plugin-markdown/src/theme/context/templates/reflection.ts similarity index 87% rename from packages/typedoc-plugin-markdown/src/theme/resources/templates/reflection.ts rename to packages/typedoc-plugin-markdown/src/theme/context/templates/reflection.ts index a113533bb..6cc43c34d 100644 --- a/packages/typedoc-plugin-markdown/src/theme/resources/templates/reflection.ts +++ b/packages/typedoc-plugin-markdown/src/theme/context/templates/reflection.ts @@ -1,6 +1,6 @@ -import { MarkdownPageEvent } from '@plugin/app/events'; -import { heading } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; +import { MarkdownPageEvent } from 'app/events'; +import { heading } from 'libs/markdown'; +import { MarkdownThemeContext } from 'theme'; import { DeclarationReflection, ReflectionKind } from 'typedoc'; /** diff --git a/packages/typedoc-plugin-markdown/src/theme/core/index.ts b/packages/typedoc-plugin-markdown/src/theme/core/index.ts new file mode 100644 index 000000000..463468249 --- /dev/null +++ b/packages/typedoc-plugin-markdown/src/theme/core/index.ts @@ -0,0 +1,7 @@ +/** + * Support for the MarkdownTheme core class building URLs and navigation. + * + * @module + */ +export * from './navigation-builder'; +export * from './url-builder'; diff --git a/packages/typedoc-plugin-markdown/src/theme/core/navigation-builder.ts b/packages/typedoc-plugin-markdown/src/theme/core/navigation-builder.ts index acb60b235..80e678cb7 100644 --- a/packages/typedoc-plugin-markdown/src/theme/core/navigation-builder.ts +++ b/packages/typedoc-plugin-markdown/src/theme/core/navigation-builder.ts @@ -1,8 +1,9 @@ -import { MarkdownRenderer } from '@plugin/app/application'; -import { isQuoted } from '@plugin/libs/utils'; -import { OutputFileStrategy } from '@plugin/options'; -import { MarkdownTheme, NavigationItem } from '@plugin/theme'; +import { MarkdownRenderer } from 'app/types'; +import { isQuoted } from 'libs/utils'; +import { OutputFileStrategy } from 'options/maps'; import * as path from 'path'; +import { MarkdownTheme } from 'theme'; +import { NavigationItem } from 'theme/types'; import { DeclarationReflection, DocumentReflection, @@ -89,7 +90,7 @@ export class NavigationBuilder { ) { children.push({ title: - this.theme.application.internationalization.proxy.theme_globals(), + this.theme.application.internationalization.proxy.kind_plural_module(), path: projectChild.url, kind: projectChild.kind, }); diff --git a/packages/typedoc-plugin-markdown/src/theme/core/url-builder.ts b/packages/typedoc-plugin-markdown/src/theme/core/url-builder.ts index ab880ca40..7043629e4 100644 --- a/packages/typedoc-plugin-markdown/src/theme/core/url-builder.ts +++ b/packages/typedoc-plugin-markdown/src/theme/core/url-builder.ts @@ -1,19 +1,15 @@ -import { MarkdownRenderer } from '@plugin/app/application'; +import { MarkdownRenderer } from 'app/types'; import { getFileNameWithExtension, isQuoted, removeFirstScopedDirectory, slugify, toPascalCase, -} from '@plugin/libs/utils'; -import { OutputFileStrategy } from '@plugin/options/option-maps'; -import { MarkdownTheme } from '@plugin/theme/markdown-theme'; -import { - TemplateMapping, - UrlMapping, - UrlOption, -} from '@plugin/theme/theme-types'; +} from 'libs/utils'; +import { OutputFileStrategy } from 'options/maps'; import * as path from 'path'; +import { MarkdownTheme } from 'theme'; +import { TemplateMapping, UrlMapping, UrlOption } from 'theme/types'; import { DeclarationReflection, DocumentReflection, @@ -36,7 +32,6 @@ export class UrlBuilder { private fileExtension: string; private ignoreScopes: boolean; private entryFileName: string; - private writeDocuments: boolean; private isPackages: boolean; private flattenOutputFiles: boolean; private urls: UrlMapping[] = []; @@ -54,7 +49,6 @@ export class UrlBuilder { this.fileExtension = this.options.getValue('fileExtension'); this.ignoreScopes = this.options.getValue('excludeScopesInPaths'); - this.writeDocuments = !this.options.getValue('inlineDocuments'); this.entryFileName = getFileNameWithExtension( this.options.getValue('entryFileName'), @@ -145,10 +139,7 @@ export class UrlBuilder { ) { project.groups?.forEach((projectGroup) => { projectGroup.children?.forEach((projectGroupChild) => { - if ( - this.writeDocuments && - projectGroupChild instanceof DocumentReflection - ) { + if (projectGroupChild instanceof DocumentReflection) { this.buildUrlsForDocuments(projectGroupChild); } if (projectGroupChild instanceof DeclarationReflection) { @@ -309,10 +300,6 @@ export class UrlBuilder { reflection: DeclarationReflection, urlOptions: UrlOption, ) { - if (reflection.kind === ReflectionKind.Document && !this.writeDocuments) { - return; - } - const mapping: TemplateMapping = this.theme.getTemplateMapping( reflection.kind, urlOptions.outputFileStrategy, @@ -343,10 +330,7 @@ export class UrlBuilder { urlMapping.url !== url, ); - if ( - duplicateUrls.length > 0 && - reflection.kind !== ReflectionKind.Document - ) { + if (duplicateUrls.length > 0) { const urlParts = url.split('.'); urlParts[urlParts.length - 2] += `-${duplicateUrls.length}`; url = urlParts.join('.'); @@ -492,7 +476,7 @@ export class UrlBuilder { } if (reflection.parent) { reflection.traverse((child) => { - if (this.writeDocuments && child instanceof DocumentReflection) { + if (child instanceof DocumentReflection) { this.buildUrlsForDocuments(child); } if (child instanceof DeclarationReflection) { @@ -556,7 +540,8 @@ export class UrlBuilder { if (!htmlTableAnchors) { if ( (reflection.kind === ReflectionKind.Property && - this.options.getValue('propertiesFormat') === 'table') || + this.options.getValue('propertiesFormat').toLowerCase() === + 'table') || (reflection.kind === ReflectionKind.EnumMember && this.options.getValue('enumMembersFormat') === 'table') ) { diff --git a/packages/typedoc-plugin-markdown/src/theme/index.ts b/packages/typedoc-plugin-markdown/src/theme/index.ts index 232658ccf..d9dd1dec6 100644 --- a/packages/typedoc-plugin-markdown/src/theme/index.ts +++ b/packages/typedoc-plugin-markdown/src/theme/index.ts @@ -1,3 +1,10 @@ -export { MarkdownTheme } from './markdown-theme'; -export { MarkdownThemeContext } from './markdown-themecontext'; -export * from './theme-types'; +/** + * This is the built-in Markdown theme. + * + * @module + */ +export * as context from './context'; +export * as core from './core'; +export * from './markdown-theme'; +export * from './markdown-theme-context'; +export * as types from './types'; diff --git a/packages/typedoc-plugin-markdown/src/theme/markdown-themecontext.ts b/packages/typedoc-plugin-markdown/src/theme/markdown-theme-context.ts similarity index 63% rename from packages/typedoc-plugin-markdown/src/theme/markdown-themecontext.ts rename to packages/typedoc-plugin-markdown/src/theme/markdown-theme-context.ts index 1f2835ead..468e029dc 100644 --- a/packages/typedoc-plugin-markdown/src/theme/markdown-themecontext.ts +++ b/packages/typedoc-plugin-markdown/src/theme/markdown-theme-context.ts @@ -1,19 +1,25 @@ -import { MarkdownRenderer } from '@plugin/app/application'; -import { MarkdownPageEvent } from '@plugin/app/events'; -import { MarkdownRendererHooks } from '@plugin/app/renderer'; -import { MarkdownTheme, PackageMetaData } from '@plugin/theme'; -import { helpers, partials, templates } from '@plugin/theme/resources'; +import { MarkdownPageEvent } from 'app/events'; +import { MarkdownRenderer, MarkdownRendererHooks } from 'app/types'; import * as path from 'path'; +import { MarkdownTheme } from 'theme'; +import { + resourceHelpers, + resourcePartials, + resourceTemplates, +} from 'theme/context/resources'; +import { PackageMetaData } from 'theme/types'; import { Internationalization, Options, Reflection } from 'typedoc'; /** * The theme context class that is provided as context on the rendering of every page. * + * @remarks + * * It is heavily influenced by the equivalent [DefaultThemeRenderContext](https://typedoc.org/api/classes/DefaultThemeRenderContext.html) from the default theme. * - * This class can be used to customize the theme output by extending the class and overriding the [templates](#templates), [partials](#partials) and [helpers](#helpers). + * This class can be used to customize the theme output by extending the class and overriding the templates, partials and helpers. * - * ## Usage + * @example * * ```ts * class MyMarkdownTheme extends MarkdownTheme { @@ -39,7 +45,6 @@ import { Internationalization, Options, Reflection } from 'typedoc'; * * In order to create cleaner code, internally individual templates located in the `resources/templates` directory are bound to the this. * - * @category Theme */ export class MarkdownThemeContext { internationalization: Internationalization.Internationalization; @@ -75,47 +80,25 @@ export class MarkdownThemeContext { private packagesMetaData: Record; /** - * Then `templates` namespace holds the main templates for the theme and are mapped to single pages and configured in the MarkdownTheme. - * - * All templates return a string that is passed back to the renderer. Internally templates call partials and helpers. + * @see {@link theme.context.templates templates } * * @group Resources */ - templates = templates(this); + templates = resourceTemplates(this); /** - * The `partials` namespace holds the partials for the theme and are used by templates to map speficic models to page output. - * - * Please note that partials:: - * - * - Take a `model` param (that references a specific TypeDoc model) and an `options` param if required. - * - Can call other partials and helpers. - * - Must return a string. - * - * Partials are categorised by their use: - * - * - [Page Partials](#page-partials): Partials that render core page elements such as header and breadcrumbs. - * - [Container Partials](#container-partials): Partials that are used to render reflection groups and categories. - * - [Member Partials](#member-partials): Partials that render specific parts of reflections. - * - [Comment Partials](#comment-partials): Partials that render comments. - * - [Type Partials](#type-partials): Partials that render specific TypeDoc model types. + * @see {@link theme.context.partials partials } * * @group Resources */ - partials = partials(this); + partials = resourcePartials(this); /** - * The `helpers` namespace holds the helpers for the theme and are smaller utility functions that return snippets or text or other data transformations. - * - * Please note that partials: - * - * - Take a `model` param (that references a specific TypeDoc model) and an `options` param if required. - * - Can reference other helpers but should not reference partials. - * - Can return strings or other models. + * @see {@link theme.context.helpers helpers } * * @group Resources */ - helpers = helpers(this); + helpers = resourceHelpers(this); /** * Returns the package meta data for a given package name when entrypointStrategy is set to `packages`. diff --git a/packages/typedoc-plugin-markdown/src/theme/markdown-theme.ts b/packages/typedoc-plugin-markdown/src/theme/markdown-theme.ts index 65923bf14..ed6224a6a 100644 --- a/packages/typedoc-plugin-markdown/src/theme/markdown-theme.ts +++ b/packages/typedoc-plugin-markdown/src/theme/markdown-theme.ts @@ -1,9 +1,10 @@ -import { MarkdownRenderer } from '@plugin/app/application'; -import { MarkdownPageEvent } from '@plugin/app/events'; -import { getTranslatable } from '@plugin/app/translatable'; -import { formatMarkdown } from '@plugin/libs/utils'; -import { OutputFileStrategy } from '@plugin/options'; -import { RenderTemplate } from '@plugin/theme'; +import { MarkdownPageEvent } from 'app/events'; +import { formatMarkdown } from 'libs/utils'; +import { OutputFileStrategy } from 'options/maps'; +import { MarkdownThemeContext } from 'theme'; +import { NavigationBuilder } from 'theme/core/navigation-builder'; +import { UrlBuilder } from 'theme/core/url-builder'; +import { RenderTemplate } from 'theme/types'; import { DeclarationReflection, DocumentReflection, @@ -12,20 +13,19 @@ import { ReflectionKind, Theme, } from 'typedoc'; -import { NavigationBuilder } from './core/navigation-builder'; -import { UrlBuilder } from './core/url-builder'; -import { MarkdownThemeContext } from './markdown-themecontext'; /** * The main theme class for the plugin. * + * @remarks + * * The class controls how TypeDoc models are mapped to files and templates and extends TypeDoc's base Theme class. * * You would typically only be interested in overriding the the theme's render context instance. * * The API follows the implementation of [TypeDoc's custom theming](https://github.com/TypeStrong/typedoc/blob/master/internal-docs/custom-themes.md) with some minor adjustments. * - * ## Usage + * @example * * ```ts * export function load(app) { @@ -37,26 +37,8 @@ import { MarkdownThemeContext } from './markdown-themecontext'; * } * ``` * - * @category Theme */ export class MarkdownTheme extends Theme { - /** - * The text content mappings for the theme. This is a combination of the default mappings and any mappings provided in the plugin options. - * - * @internal - */ - - /** - * @ignore - */ - constructor(renderer: MarkdownRenderer) { - super(renderer); - this.application.internationalization.addTranslations( - 'en', - getTranslatable(this.application), - ); - } - /** * Renders a template and page model to a string. * @@ -69,7 +51,6 @@ export class MarkdownTheme extends Theme { try { return formatMarkdown(template(page)); } catch (e) { - console.log(e); this.application.logger.error(`Error rendering page ${page.url}.`); throw new Error(e); } @@ -111,7 +92,9 @@ export class MarkdownTheme extends Theme { ) { outputFileStrategy = outputFileStrategy || - this.application.options.getValue('outputFileStrategy'); + (this.application.options.getValue( + 'outputFileStrategy', + ) as OutputFileStrategy); const directoryName = (reflectionKind: ReflectionKind) => { const pluralString = ReflectionKind.pluralString(reflectionKind); diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.reflectionFlags.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.reflectionFlags.ts deleted file mode 100644 index a9fd1d326..000000000 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.reflectionFlags.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { backTicks } from '@plugin/libs/markdown'; -import { camelToTitleCase } from '@plugin/libs/utils'; -import { MarkdownThemeContext } from '@plugin/theme'; -import { Reflection } from 'typedoc'; - -/** - * Renders the flags of a reflection. - * - * @category Member Partials - */ -export function reflectionFlags( - this: MarkdownThemeContext, - model: Reflection, -): string { - const flagsNotRendered: `@${string}`[] = [ - '@showCategories', - '@showGroups', - '@hideCategories', - '@hideGroups', - ]; - - const flags: string[] = []; - - if (model.comment) { - for (const tag of model.comment.modifierTags) { - if (!flagsNotRendered.includes(tag)) { - flags.push(camelToTitleCase(tag.substring(1))); - } - } - } - - return flags.map((item) => backTicks(item)).join(' '); -} diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.reflectionIndex.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.reflectionIndex.ts deleted file mode 100644 index 078ba49cd..000000000 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/member.reflectionIndex.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { heading } from '@plugin/libs/markdown'; -import { MarkdownThemeContext } from '@plugin/theme'; -import { - DeclarationReflection, - DocumentReflection, - ProjectReflection, -} from 'typedoc'; - -/** - * - * @category Member Partials - */ -export function reflectionIndex( - this: MarkdownThemeContext, - model: ProjectReflection | DeclarationReflection, - options: { headingLevel: number }, -): string { - const md: string[] = []; - - if (model.categories) { - model.categories.forEach((categoryGroup) => { - md.push(heading(options.headingLevel, categoryGroup.title) + '\n'); - if (categoryGroup.description) { - md.push(this.partials.commentParts(categoryGroup.description) + '\n'); - } - md.push(this.helpers.getGroupIndex(categoryGroup) + '\n'); - }); - } else { - const groups = model.groups?.filter( - (group) => - group.allChildrenHaveOwnDocument() && - !(group.owningReflection instanceof DocumentReflection), - ); - - if ( - this.options.getValue('excludeGroups') || - this.options.getValue('hideGroupHeadings') - ) { - const children = groups?.reduce((acc, group) => { - return [...acc, ...group.children]; - }, []); - if (this.options.getValue('indexFormat') === 'table') { - md.push( - heading(options.headingLevel, this.i18n.theme_member_plural()) + '\n', - ); - md.push( - this.helpers.getGroupIndexTable( - (children as DeclarationReflection[]) || [], - ), - ); - } else { - md.push( - this.helpers.getGroupIndexList( - (children as DeclarationReflection[]) || [], - ), - ); - } - } else { - groups?.forEach((reflectionGroup) => { - if (reflectionGroup.categories) { - md.push(heading(options.headingLevel, reflectionGroup.title) + '\n'); - reflectionGroup.categories.forEach((categoryGroup) => { - md.push( - heading(options.headingLevel + 1, categoryGroup.title) + '\n', - ); - if (categoryGroup.description) { - md.push( - this.partials.commentParts(categoryGroup.description) + '\n', - ); - } - md.push(this.helpers.getGroupIndex(categoryGroup) + '\n'); - }); - } else { - md.push(heading(options.headingLevel, reflectionGroup.title) + '\n'); - md.push(this.helpers.getGroupIndex(reflectionGroup) + '\n'); - } - }); - } - } - return md.join('\n'); -} diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.footer.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.footer.ts deleted file mode 100644 index 796b70c49..000000000 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.footer.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { MarkdownThemeContext } from '@plugin/theme'; - -/** - * @category Page Partials - */ -export function footer(this: MarkdownThemeContext): string { - const text = this.i18n.theme_footer_text(); - return text ? `***\n\n${text}` : ``; -} diff --git a/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.pageTitle.ts b/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.pageTitle.ts deleted file mode 100644 index 50ab4c7c6..000000000 --- a/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.pageTitle.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { DeclarationReflection, ReflectionKind } from 'typedoc'; -import { MarkdownThemeContext } from '../../..'; - -/** - * @category Page Partials - */ -export function pageTitle(this: MarkdownThemeContext): string { - const page = this.page; - if (page.model?.url === page.project.url) { - const titleContent = this.i18n.theme_title_index_page( - page.project.name, - page.project.packageVersion ? `v${page.project.packageVersion}` : '', - ); - return titleContent.replace(/\s+/g, ' ').trim(); - } - - const name = this.partials.memberTitle(page.model as DeclarationReflection); - const moduleTitle = this.i18n.theme_title_module_page(name); - const memberTitle = this.i18n.theme_title_member_page( - this.internationalization.kindSingularString(page.model.kind), - name, - ); - - return page.model.kind === ReflectionKind.Module ? moduleTitle : memberTitle; -} diff --git a/packages/typedoc-plugin-markdown/src/theme/theme-types.ts b/packages/typedoc-plugin-markdown/src/theme/types.ts similarity index 83% rename from packages/typedoc-plugin-markdown/src/theme/theme-types.ts rename to packages/typedoc-plugin-markdown/src/theme/types.ts index 02b7cfd01..4da309f15 100644 --- a/packages/typedoc-plugin-markdown/src/theme/theme-types.ts +++ b/packages/typedoc-plugin-markdown/src/theme/types.ts @@ -1,11 +1,10 @@ -import { MarkdownPageEvent } from '@plugin/app/events/markdown-page-event'; -import { OutputFileStrategy } from '@plugin/options/option-maps'; +import { MarkdownPageEvent } from 'app/events'; +import { OutputFileStrategy } from 'options/maps'; import { Options, ReflectionKind } from 'typedoc'; /** * The model used to define the package metadata when in packages mode. * - * @category Theme */ export interface PackageMetaData { description: string; @@ -15,7 +14,6 @@ export interface PackageMetaData { /** * The model used to define the URL mapping structure. * - * @category Theme */ export interface UrlMapping { url: string; @@ -26,7 +24,6 @@ export interface UrlMapping { /** * The model used to define the navigation structure. * - * @category Theme */ export interface NavigationItem { title: string; diff --git a/packages/typedoc-plugin-markdown/test/fixtures/config.ts b/packages/typedoc-plugin-markdown/test/fixtures/config.ts index 38b29afb2..f19dcf31d 100644 --- a/packages/typedoc-plugin-markdown/test/fixtures/config.ts +++ b/packages/typedoc-plugin-markdown/test/fixtures/config.ts @@ -3,7 +3,7 @@ import * as path from 'path'; const config: Record = { reflections: { - only: false, + only: true, entryPoints: '/reflections/index.ts', commonOptions: { plugin: [ @@ -12,10 +12,11 @@ const config: Record = { ], hidePageHeader: true, hideBreadcrumbs: true, - tableColumnVisibility: { + tableColumnSettings: { hideSources: true, + leftAlignHeaders: true, }, - leftAlignTableHeaders: true, + excludePrivate: false, }, options: [ {}, @@ -43,7 +44,9 @@ const config: Record = { disableSources: true, expandObjects: true, expandParameters: true, - leftAlignTableHeaders: true, + tableColumnSettings: { + leftAlignHeaders: true, + }, }, options: [ {}, @@ -57,8 +60,8 @@ const config: Record = { modules: { only: false, entryPoints: [ - '/modules/module-1', '/modules/module-2', + '/modules/module-1', '/modules/module-3', ], commonOptions: { @@ -91,7 +94,9 @@ const config: Record = { theme: 'stub-groups', disableSources: true, entryFileName: 'index.md', - leftAlignTableHeaders: true, + tableColumnSettings: { + leftAlignHeaders: true, + }, }, options: [ { @@ -127,7 +132,7 @@ const config: Record = { hidePageHeader: true, hideBreadcrumbs: true, readme: 'none', - inlineDocuments: true, + excludePrivate: false, }, options: [ { @@ -146,14 +151,15 @@ const config: Record = { parametersFormat: 'htmlTable', propertiesFormat: 'htmlTable', typeDeclarationFormat: 'htmlTable', - tableColumnVisibility: { + tableColumnSettings: { hideDefaults: true, hideInherited: true, hideModifiers: true, hideOverrides: true, hideSources: true, + hideValues: true, + leftAlignHeaders: true, }, - leftAlignTableHeaders: true, }, ], }, @@ -165,7 +171,9 @@ const config: Record = { entryPointStrategy: 'packages', name: 'packages-example', disableSources: true, - leftAlignTableHeaders: true, + tableColumnSettings: { + leftAlignHeaders: true, + }, }, options: [ { entryFileName: 'index.md' }, @@ -219,6 +227,7 @@ const config: Record = { entryFileName: 'index.md', disableSources: true, mergeReadme: true, + includeVersion: true, }, ], }, @@ -228,13 +237,17 @@ const config: Record = { commonOptions: { plugin: [path.join(__dirname, 'custom-plugins', 'navigation-plugin.mjs')], disableSources: true, - leftAlignTableHeaders: true, + tableColumnSettings: { leftAlignHeaders: true }, + includeVersion: true, + propertiesFormat: 'table', + readme: 'none', }, options: [ { - includeVersion: true, - options: './test/fixtures/typedoc.text-options.cjs', - propertiesFormat: 'table', + options: './test/fixtures/typedoc.text-mappings.cjs', + }, + { + options: './test/fixtures/typedoc.text-locales.cjs', }, ], }, @@ -304,7 +317,6 @@ const config: Record = { {}, { indexFormat: 'table', - inlineDocuments: true, }, ], }, diff --git a/packages/typedoc-plugin-markdown/test/fixtures/src/comments/index.ts b/packages/typedoc-plugin-markdown/test/fixtures/src/comments/index.ts index 5c721147c..1a732fd1e 100644 --- a/packages/typedoc-plugin-markdown/test/fixtures/src/comments/index.ts +++ b/packages/typedoc-plugin-markdown/test/fixtures/src/comments/index.ts @@ -151,6 +151,9 @@ export class BaseClassProperties { } export class ClassPropertiesTable extends BaseClassProperties { + /** @experimental */ + propWithFlag: string; + propA = 'propAValue'; /** * The subroutine recursively parsed the hexadecimal data. @@ -168,7 +171,7 @@ export class ClassPropertiesTable extends BaseClassProperties { /** * > Example of Triple Code Block * - * ```python + * ```ts * def greet(name): * print("Hello, " + name + "!") * ``` @@ -201,7 +204,7 @@ export interface InterfacePropertiesTable extends BaseInterfaceProperties { /** * > Example of Triple Code Block * - * ```python + * ```ts * def greet(name): * print("Hello, " + name + "!") * ``` @@ -221,6 +224,12 @@ export type TypeDeclarationTable = { */ declaration2: boolean; declaration3: 'declaration3'; + declaration4: 100; +}; + +export const TypeDeclarationTable = { + declaration1: 'declaration3', + declaration2: 100, }; /** diff --git a/packages/typedoc-plugin-markdown/test/fixtures/src/reflections/functions.ts b/packages/typedoc-plugin-markdown/test/fixtures/src/reflections/functions.ts index f8dced552..21ee5a959 100644 --- a/packages/typedoc-plugin-markdown/test/fixtures/src/reflections/functions.ts +++ b/packages/typedoc-plugin-markdown/test/fixtures/src/reflections/functions.ts @@ -129,8 +129,6 @@ export function functionWithMultipleSignatures(): string { /** * Comments for function * - * @default {} - * * @returns Return comments */ export function functionReturningAnObject() { diff --git a/packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-locales.cjs b/packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-locales.cjs new file mode 100644 index 000000000..2bbe5286d --- /dev/null +++ b/packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-locales.cjs @@ -0,0 +1,19 @@ +// @ts-check + +const baseOptions = require('../../../../devtools/packages/fixtures/typedoc.cjs'); + +/** @type {import('typedoc').TypeDocOptions} */ +module.exports = { + ...baseOptions, + textContentMappings: { + 'header.title': 'My API - {version} (ko)', + 'header.docs': 'Docs (ko)', + 'footer.text': 'Copyright Test (ko)', + }, + lang: 'ko', + locales: { + ko: { + theme_type: 'Type (ko)', + }, + }, +}; diff --git a/packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-options.cjs b/packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-mappings.cjs similarity index 59% rename from packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-options.cjs rename to packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-mappings.cjs index 220f27304..396eccbf6 100644 --- a/packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-options.cjs +++ b/packages/typedoc-plugin-markdown/test/fixtures/typedoc.text-mappings.cjs @@ -1,4 +1,8 @@ +// @ts-check + const baseOptions = require('../../../../devtools/packages/fixtures/typedoc.cjs'); + +/** @type {import('typedoc').TypeDocOptions} */ module.exports = { ...baseOptions, textContentMappings: { @@ -7,11 +11,12 @@ module.exports = { 'footer.text': 'Copyright Test', 'title.indexPage': ':tada: Custom Index Title', 'title.memberPage': '{name}', - 'title.modulePage': '{kind} - {name}', - 'label.source': 'Defined In', - 'kind.event.plural': 'My Events', - 'kind.event.singular': 'Event!', - 'kind.interface.plural': '多变的', - 'kind.variable.plural': 'CoolVars', + }, + locales: { + en: { + theme_index: 'TOC', + kind_plural_interface: 'CoolInterfaces', + kind_plural_variable: 'CoolVars', + }, }, }; diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/comments.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/comments.spec.ts.snap index 6f8b111f4..89cb9f1d6 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/comments.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/comments.spec.ts.snap @@ -70,9 +70,7 @@ And include other files: ## Documents -This is a simple example on how to use include. - -![My image alt text](media://logo.png) +- [example](documents/example.md) ## Enumerations @@ -99,6 +97,7 @@ This is a simple example on how to use include. ## Variables - [SameName](variables/SameName.md) +- [TypeDeclarationTable](variables/TypeDeclarationTable.md) - [\\_prop\\_with\\_underscore](variables/prop_with_underscore.md) - [prop](variables/prop.md) - [propb](variables/propb.md) @@ -116,7 +115,7 @@ exports[`Comments should get tables for emum: (Output File Strategy "members") ( ## Enumeration Members -| Enumeration Member | Value | Description | Defined in | +| Enumeration Member | Value | Description | Source | | ------ | ------ | ------ | ------ | | \`member1\` | \`"member1"\` | The subroutine recursively parsed the hexadecimal data. | [index.ts:1](http://source-url) | " @@ -159,13 +158,13 @@ Adds two numbers together. ## Type Parameters -| Type Parameter | Value | Description | +| Type Parameter | Default type | Description | | ------ | ------ | ------ | | \`T\` | \`string\` | The type of the numbers to be added. | ## Parameters -| Parameter | Type | Default Value | Description | +| Parameter | Type | Default value | Description | | ------ | ------ | ------ | ------ | | \`param1\` | \`number\` | \`undefined\` | The first param to be added. | | \`param2\` | \`number\` | \`undefined\` | The second param to be added. Some additional text for num2. | @@ -204,13 +203,14 @@ exports[`Comments should get tables for properties: (Output File Strategy "membe ## Properties -| Property | Modifier | Type | Default Value | Description | Overrides | Inherited from | Defined in | +| Property | Modifier | Type | Default value | Description | Overrides | Inherited from | Source | | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | | \`prop1\` | \`private\` | \`boolean\` | \`undefined\` | The subroutine recursively parsed the hexadecimal data. to generate the binary output for input validation. | - | - | [index.ts:1](http://source-url) | | \`prop2\` | \`readonly\` | \`RegExp\` | \`undefined\` | Below is a breakdown of the notable performances: - The CPU executed the instruction set in parallel with the GPU computations. - The RAM efficiently cached the frequently accessed data for faster retrieval. - The SSD accessed the stored files with lightning speed due to its high read/write capabilities. | - | - | [index.ts:1](http://source-url) | | \`prop3?\` | \`public\` | \`string\` | \`undefined\` | > Example of Triple Code Block \`def greet(name): print("Hello, " + name + "!")\` | - | - | [index.ts:1](http://source-url) | | ~~\`propA\`~~ | \`public\` | \`string\` | \`'propAValue'\` | **Deprecated** | [\`BaseClassProperties\`](BaseClassProperties.md).\`propA\` | - | [index.ts:1](http://source-url) | | \`propB\` | \`public\` | \`string\` | \`undefined\` | - | - | [\`BaseClassProperties\`](BaseClassProperties.md).\`propB\` | [index.ts:1](http://source-url) | +| \`propWithFlag\` (*Experimental*) | \`public\` | \`string\` | \`undefined\` | - | - | - | [index.ts:1](http://source-url) | " `; @@ -240,7 +240,7 @@ exports[`Comments should get tables for properties: (Output File Strategy "membe ## Properties - + - - - - @@ -352,7 +332,19 @@ print("Hello, " + name + "!") + + + + + + + + + + +
PropertyTypeDefault ValueDescription
PropertyTypeDescription
@@ -254,11 +254,6 @@ exports[`Comments should get tables for properties: (Output File Strategy "membe -\`undefined\` - - - The subroutine recursively parsed the hexadecimal data. to generate the binary output for input validation. @@ -277,11 +272,6 @@ to generate the binary output for input validation. -\`undefined\` - - - Below is a breakdown of the notable performances: - The CPU executed the instruction set in parallel with the GPU computations. @@ -303,14 +293,9 @@ Below is a breakdown of the notable performances: -\`undefined\` - - - > Example of Triple Code Block -\`\`\`python +\`\`\`ts def greet(name): print("Hello, " + name + "!") \`\`\` @@ -330,11 +315,6 @@ print("Hello, " + name + "!") -\`'propAValue'\` - - - **Deprecated** -\`undefined\` +‐ + +
+ + \`propWithFlag\` (*Experimental*) + + + +\`string\` @@ -372,11 +364,30 @@ exports[`Comments should get tables for type declarations: (Output File Strategy ## Type declaration -| Member | Type | Description | Defined in | +| Member | Type | Description | Source | | ------ | ------ | ------ | ------ | | \`declaration1\` | \`boolean\` | The subroutine recursively parsed the hexadecimal data. to generate the binary output for input validation. | [index.ts:1](http://source-url) | | \`declaration2\` | \`boolean\` | The subroutine recursively parsed the hexadecimal data. to generate the binary output for input validation. | [index.ts:1](http://source-url) | | \`declaration3\` | \`"declaration3"\` | - | [index.ts:1](http://source-url) | +| \`declaration4\` | \`100\` | - | [index.ts:1](http://source-url) | + +## Source + +[index.ts:1](http://source-url) +" +`; + +exports[`Comments should get tables for type declarations: (Output File Strategy "members") (Option Group "1") 2`] = ` +"# Variable: TypeDeclarationTable + +> **TypeDeclarationTable**: \`object\` + +## Type declaration + +| Member | Type | Source | +| ------ | ------ | ------ | +| \`declaration1\` | \`string\` | [index.ts:1](http://source-url) | +| \`declaration2\` | \`number\` | [index.ts:1](http://source-url) | ## Source @@ -444,6 +455,64 @@ to generate the binary output for input validation. ‐ +
+ +\`declaration4\` + + + +\`100\` + + + +‐ + +
+ +## Source + +[index.ts:1](http://source-url) +" +`; + +exports[`Comments should get tables for type declarations: (Output File Strategy "members") (Option Group "2") 2`] = ` +"# Variable: TypeDeclarationTable + +> **TypeDeclarationTable**: \`object\` + +## Type declaration + + + + + + + + + +
MemberType
+ +\`declaration1\` + + + +\`string\` + +
+ +\`declaration2\` + + + +\`number\` +
diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/groups.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/groups.spec.ts.snap index af916ebbd..7f50af311 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/groups.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/groups.spec.ts.snap @@ -57,18 +57,38 @@ A basic module ## Index -### Members +### Enumerations -| Member | Description | +| Enumeration | Description | | :------ | :------ | | [EnumA](enumerations/EnumA.md) | EnumA function. | | [EnumB](enumerations/EnumB.md) | - | + +### Classes + +| Class | Description | +| :------ | :------ | | [ClassA](classes/ClassA.md) | ClassA function. | | [ClassB](classes/ClassB.md) | - | + +### Interfaces + +| Interface | Description | +| :------ | :------ | | [InterfaceA](interfaces/InterfaceA.md) | Interface A comments line 1 and comments on a soft line. | | [InterfaceB](interfaces/InterfaceB.md) | InterfaceB function. | + +### Type Aliases + +| Type alias | Description | +| :------ | :------ | | [TypeA](type-aliases/TypeA.md) | TypeA function. | | [TypeB](type-aliases/TypeB.md) | TypeB function. | + +### Functions + +| Function | Description | +| :------ | :------ | | [functionA](functions/functionA.md) | functionA function. | @@ -631,9 +651,9 @@ exports[`Groups should compile index page for project: (Output File Strategy "me # typedoc-stubs -## Members +## Modules -| Member | Description | +| Module | Description | | :------ | :------ | | [42-module-name](42-module-name/index.md) | - | | [\\](-internal-/index.md) | - | @@ -675,9 +695,9 @@ exports[`Groups should compile index page for project: (Output File Strategy "mo # typedoc-stubs -## Members +## Modules -| Member | Description | +| Module | Description | | :------ | :------ | | [42-module-name](42-module-name.md) | - | | [\\](-internal-.md) | - | @@ -723,11 +743,16 @@ exports[`Groups should compile module index for a namespace: (Output File Strate ## Index -### Members +### Namespaces -| Member | Description | +| Namespace | Description | | :------ | :------ | | [NestedNamespace](namespaces/NestedNamespace/index.md) | - | + +### Interfaces + +| Interface | Description | +| :------ | :------ | | [NamespaceInterface](interfaces/NamespaceInterface.md) | - | " `; @@ -764,9 +789,9 @@ exports[`Groups should compile module index for a namespace: (Output File Strate ## Index -### Members +### Namespaces -| Member | Description | +| Namespace | Description | | :------ | :------ | | [NestedNamespace](namespaces/NestedNamespace.md) | - | @@ -839,20 +864,45 @@ A module that contains namespaces ## Index -### Members +### Namespaces -| Member | Description | +| Namespace | Description | | :------ | :------ | | [NamespaceB](namespaces/NamespaceB/index.md) | - | | [\\_Namespace\\_A\\_](namespaces/Namespace_A/index.md) | - | + +### Enumerations + +| Enumeration | Description | +| :------ | :------ | | [EnumB](enumerations/EnumB.md) | - | | [\\_Enum\\_A\\_](enumerations/Enum_A.md) | - | + +### Classes + +| Class | Description | +| :------ | :------ | | [ClassB](classes/ClassB.md) | - | | [\\_\\_Class\\_A\\_](classes/Class_A.md) | - | + +### Interfaces + +| Interface | Description | +| :------ | :------ | | [InterfaceB](interfaces/InterfaceB.md) | - | | [\\_Interface\\_A\\_](interfaces/Interface_A.md) | - | + +### Type Aliases + +| Type alias | Description | +| :------ | :------ | | [TypeB](type-aliases/TypeB.md) | - | | [\\_Type\\_A\\_](type-aliases/Type_A.md) | - | + +### Functions + +| Function | Description | +| :------ | :------ | | [\\_function\\_A\\_](functions/function_A.md) | - | | [functionB](functions/functionB.md) | - | @@ -977,9 +1027,9 @@ A module that contains namespaces ## Index -### Members +### Namespaces -| Member | Description | +| Namespace | Description | | :------ | :------ | | [NamespaceB](namespaces/NamespaceB.md) | - | | [\\_Namespace\\_A\\_](namespaces/Namespace_A/index.md) | - | @@ -1221,9 +1271,9 @@ A module that contains references ## Index -### Members +### Functions -| Member | Description | +| Function | Description | | :------ | :------ | | [defaultFunction](functions/defaultFunction.md) | - | diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/navigation.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/navigation.spec.ts.snap index f05e9aa4a..f98dd9793 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/navigation.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/navigation.spec.ts.snap @@ -623,7 +623,7 @@ exports[`Navigation should get Navigation Json for packages: (Output File Strate "kind": 2, "children": [ { - "title": "Globals", + "title": "Modules", "path": "@scope/package-1/globals.md", "kind": 2 } @@ -1868,15 +1868,18 @@ exports[`Navigation should gets Navigation Json for documents single module: (Ou "children": [ { "title": "Project Document 1", - "kind": 8388608 + "kind": 8388608, + "path": "documents/Project-Document-1.md" }, { "title": "docs/project/PROJECT_DOC_2", - "kind": 8388608 + "kind": 8388608, + "path": "documents/docs/project/PROJECT_DOC_2.md" }, { "title": "docs/project/PROJECT_DOC_3", - "kind": 8388608 + "kind": 8388608, + "path": "documents/docs/project/PROJECT_DOC_3.md" } ] }, @@ -1885,6 +1888,11 @@ exports[`Navigation should gets Navigation Json for documents single module: (Ou "kind": 2, "path": "ModuleWithDocuments1/README.md", "children": [ + { + "title": "MODULE_DOC", + "kind": 8388608, + "path": "ModuleWithDocuments1/documents/MODULE_DOC.md" + }, { "title": "Namespaces", "children": [ @@ -1893,13 +1901,25 @@ exports[`Navigation should gets Navigation Json for documents single module: (Ou "kind": 4, "path": "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/README.md", "children": [ + { + "title": "NAMESPACE_DOC", + "kind": 8388608, + "path": "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/documents/NAMESPACE_DOC.md" + }, { "title": "Classes", "children": [ { "title": "NamespaceClassWithDocuments", "kind": 128, - "path": "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/classes/NamespaceClassWithDocuments.md" + "path": "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/classes/NamespaceClassWithDocuments.md", + "children": [ + { + "title": "CLASS_DOC", + "kind": 8388608, + "path": "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/classes/documents/CLASS_DOC.md" + } + ] } ] } @@ -1913,7 +1933,14 @@ exports[`Navigation should gets Navigation Json for documents single module: (Ou { "title": "EnumWithDocuments", "kind": 8, - "path": "ModuleWithDocuments1/enumerations/EnumWithDocuments.md" + "path": "ModuleWithDocuments1/enumerations/EnumWithDocuments.md", + "children": [ + { + "title": "ENUM_DOC", + "kind": 8388608, + "path": "ModuleWithDocuments1/enumerations/documents/ENUM_DOC.md" + } + ] } ] }, @@ -1923,7 +1950,14 @@ exports[`Navigation should gets Navigation Json for documents single module: (Ou { "title": "ClassWithDocuments", "kind": 128, - "path": "ModuleWithDocuments1/classes/ClassWithDocuments.md" + "path": "ModuleWithDocuments1/classes/ClassWithDocuments.md", + "children": [ + { + "title": "CLASS_DOC", + "kind": 8388608, + "path": "ModuleWithDocuments1/classes/documents/CLASS_DOC.md" + } + ] } ] }, @@ -1933,7 +1967,14 @@ exports[`Navigation should gets Navigation Json for documents single module: (Ou { "title": "InterfaceWithDocuments", "kind": 256, - "path": "ModuleWithDocuments1/interfaces/InterfaceWithDocuments.md" + "path": "ModuleWithDocuments1/interfaces/InterfaceWithDocuments.md", + "children": [ + { + "title": "INTERFACE_DOC", + "kind": 8388608, + "path": "ModuleWithDocuments1/interfaces/documents/INTERFACE_DOC.md" + } + ] } ] }, @@ -1943,7 +1984,14 @@ exports[`Navigation should gets Navigation Json for documents single module: (Ou { "title": "TypeWithDocuments", "kind": 2097152, - "path": "ModuleWithDocuments1/type-aliases/TypeWithDocuments.md" + "path": "ModuleWithDocuments1/type-aliases/TypeWithDocuments.md", + "children": [ + { + "title": "TYPE_DOC", + "kind": 8388608, + "path": "ModuleWithDocuments1/type-aliases/documents/TYPE_DOC.md" + } + ] } ] }, @@ -1953,7 +2001,14 @@ exports[`Navigation should gets Navigation Json for documents single module: (Ou { "title": "variableWithDocuments", "kind": 32, - "path": "ModuleWithDocuments1/variables/variableWithDocuments.md" + "path": "ModuleWithDocuments1/variables/variableWithDocuments.md", + "children": [ + { + "title": "VARIABLE_DOC", + "kind": 8388608, + "path": "ModuleWithDocuments1/variables/documents/VARIABLE_DOC.md" + } + ] } ] }, @@ -1963,12 +2018,26 @@ exports[`Navigation should gets Navigation Json for documents single module: (Ou { "title": "functionWithDocuments", "kind": 64, - "path": "ModuleWithDocuments1/functions/functionWithDocuments.md" + "path": "ModuleWithDocuments1/functions/functionWithDocuments.md", + "children": [ + { + "title": "FUNCTION_DOC_1", + "kind": 8388608, + "path": "ModuleWithDocuments1/functions/documents/FUNCTION_DOC_1.md" + } + ] }, { "title": "multipleFunctionWithDocuments", "kind": 64, - "path": "ModuleWithDocuments1/functions/multipleFunctionWithDocuments.md" + "path": "ModuleWithDocuments1/functions/multipleFunctionWithDocuments.md", + "children": [ + { + "title": "FUNCTION_DOC_1", + "kind": 8388608, + "path": "ModuleWithDocuments1/functions/documents/FUNCTION_DOC_1.md" + } + ] } ] } @@ -2038,15 +2107,18 @@ exports[`Navigation should gets Navigation Json for documents single module: (Ou "children": [ { "title": "Project Document 1", - "kind": 8388608 + "kind": 8388608, + "path": "documents/Project-Document-1.md" }, { "title": "docs/project/PROJECT_DOC_2", - "kind": 8388608 + "kind": 8388608, + "path": "documents/docs/project/PROJECT_DOC_2.md" }, { "title": "docs/project/PROJECT_DOC_3", - "kind": 8388608 + "kind": 8388608, + "path": "documents/docs/project/PROJECT_DOC_3.md" } ] }, @@ -2055,13 +2127,25 @@ exports[`Navigation should gets Navigation Json for documents single module: (Ou "kind": 2, "path": "ModuleWithDocuments1/README.md", "children": [ + { + "title": "MODULE_DOC", + "kind": 8388608, + "path": "ModuleWithDocuments1/documents/MODULE_DOC.md" + }, { "title": "Namespaces", "children": [ { "title": "NamespaceWithDocuments", "kind": 4, - "path": "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/README.md" + "path": "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/README.md", + "children": [ + { + "title": "NAMESPACE_DOC", + "kind": 8388608, + "path": "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/documents/NAMESPACE_DOC.md" + } + ] } ] } diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/objects-and-params.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/objects-and-params.spec.ts.snap index 05150ad2a..3aa0d57ff 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/objects-and-params.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/objects-and-params.spec.ts.snap @@ -5,7 +5,7 @@ exports[`Objects And Params should compile basic interface: (Output File Strateg Comments for BasicInterface -## Extended By +## Extended by - [\`ExtendedInterface\`](ExtendedInterface.md) @@ -196,7 +196,7 @@ exports[`Objects And Params should compile basic interface: (Output File Strateg Comments for BasicInterface -## Extended By +## Extended by - [\`ExtendedInterface\`](ExtendedInterface.md) @@ -757,7 +757,7 @@ Comments for someFunction exports[`Objects And Params should compile object with symbol: (Output File Strategy "members") (Option Group "1") 1`] = ` "# Variable: objectWithSymbol -> \`const\` **objectWithSymbol**: \\{\`[sym]\`: \`'value'\`; \\} +> \`const\` **objectWithSymbol**: \\{\`[sym]\`: \`'value'\`; \\} = \`...\` Comments variable with symbol @@ -777,7 +777,7 @@ exports[`Objects And Params should compile object with symbol: (Output File Stra \`\`\`ts const objectWithSymbol: { [sym]: 'value'; -}; + } = ...; \`\`\` Comments variable with symbol @@ -819,7 +819,7 @@ Comments for UnionType exports[`Objects And Params should compile variable assigned to an object literal: (Output File Strategy "members") (Option Group "1") 1`] = ` "# Variable: objectLiteralVariable -> \`const\` **objectLiteralVariable**: \\{\`valueA\`: \`100\`;\`valueB\`: \`true\`;\`valueX\`: \\{\`valueA\`: \`number\`[];\`valueY\`: (\`z\`: \`string\`) => \\{\`a\`: \`'test'\`;\`b\`: \`z\`;\`c\`: \\{\`a\`: \`1\`;\`b\`: \`2\`; \\}; \\};\`valueZ\`: \`'foo'\`; \\};\`valueY\`: (\`unionParam\`: \`"a"\` \\| \`"b"\`, \`_undercoreParam_\`: \`string\`) => \`string\`; \\} +> \`const\` **objectLiteralVariable**: \\{\`valueA\`: \`100\`;\`valueB\`: \`true\`;\`valueX\`: \`...\`;\`valueY\`: \`...\`; \\} = \`...\` Comments for objectLiteralVariable @@ -835,15 +835,15 @@ Comments for objectLiteralVariable ### valueX -> **valueX**: \\{\`valueA\`: \`number\`[];\`valueY\`: (\`z\`: \`string\`) => \\{\`a\`: \`'test'\`;\`b\`: \`z\`;\`c\`: \\{\`a\`: \`1\`;\`b\`: \`2\`; \\}; \\};\`valueZ\`: \`'foo'\`; \\} +> **valueX**: \\{\`valueA\`: \`...\`;\`valueY\`: \`...\`;\`valueZ\`: \`'foo'\`; \\} = \`...\` ### valueX.valueA -> **valueA**: \`number\`[] +> **valueA**: \`number\`[] = \`...\` ### valueX.valueY() -> **valueY**: (\`z\`: \`string\`) => \\{\`a\`: \`'test'\`;\`b\`: \`z\`;\`c\`: \\{\`a\`: \`1\`;\`b\`: \`2\`; \\}; \\} +> **valueY**: (\`z\`: \`string\`) => \\{\`a\`: \`'test'\`;\`b\`: \`z\`;\`c\`: \`...\`; \\} = \`...\` #### Parameters @@ -851,7 +851,7 @@ Comments for objectLiteralVariable #### Returns -\\{\`a\`: \`'test'\`;\`b\`: \`z\`;\`c\`: \\{\`a\`: \`1\`;\`b\`: \`2\`; \\}; \\} +\\{\`a\`: \`'test'\`;\`b\`: \`z\`;\`c\`: \`...\`; \\} ##### a @@ -863,7 +863,7 @@ Comments for objectLiteralVariable ##### c -> **c**: \\{\`a\`: \`1\`;\`b\`: \`2\`; \\} +> **c**: \\{\`a\`: \`1\`;\`b\`: \`2\`; \\} = \`...\` ##### c.a @@ -879,7 +879,7 @@ Comments for objectLiteralVariable ### valueY() -> **valueY**: (\`unionParam\`: \`"a"\` \\| \`"b"\`, \`_undercoreParam_\`: \`string\`) => \`string\` +> **valueY**: (\`unionParam\`: \`"a"\` \\| \`"b"\`, \`_undercoreParam_\`: \`string\`) => \`string\` = \`...\` #### Parameters @@ -900,20 +900,9 @@ exports[`Objects And Params should compile variable assigned to an object litera const objectLiteralVariable: { valueA: 100; valueB: true; - valueX: { - valueA: number[]; - valueY: (z: string) => { - a: 'test'; - b: z; - c: { - a: 1; - b: 2; - }; - }; - valueZ: 'foo'; - }; - valueY: (unionParam: "a" | "b", _undercoreParam_: string) => string; -}; + valueX: ...; + valueY: ...; + } = ...; \`\`\` Comments for objectLiteralVariable @@ -936,23 +925,16 @@ valueB: boolean = true; \`\`\`ts valueX: { - valueA: number[]; - valueY: (z: string) => { - a: 'test'; - b: z; - c: { - a: 1; - b: 2; - }; - }; + valueA: ...; + valueY: ...; valueZ: 'foo'; -}; + } = ...; \`\`\` ### valueX.valueA \`\`\`ts -valueA: number[]; +valueA: number[] = ...; \`\`\` ### valueX.valueY() @@ -961,11 +943,8 @@ valueA: number[]; valueY: (z: string) => { a: 'test'; b: z; - c: { - a: 1; - b: 2; - }; -}; + c: ...; + } = ...; \`\`\` #### Parameters @@ -980,10 +959,7 @@ valueY: (z: string) => { { a: 'test'; b: z; - c: { - a: 1; - b: 2; - }; + c: ...; } \`\`\` @@ -1005,7 +981,7 @@ b: string = z; c: { a: 1; b: 2; -}; + } = ...; \`\`\` ##### c.a @@ -1029,7 +1005,7 @@ valueZ: string = 'foo'; ### valueY() \`\`\`ts -valueY: (unionParam: "a" | "b", _undercoreParam_: string) => string; +valueY: (unionParam: "a" | "b", _undercoreParam_: string) => string = ...; \`\`\` #### Parameters diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/packages.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/packages.spec.ts.snap index ae4f13b8a..4547b1ccc 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/packages.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/packages.spec.ts.snap @@ -17,17 +17,6 @@ exports[`Packages should compile index page for packages: (Output File Strategy *** # packages-example - -## Packages - -- [@scope/package-1 - v1.0.0](@scope/package-1/index.md) -- [package-1b](package-1b/index.md) -- [package-2 - v1.0.0](package-2/index.md) -- [@scope/package-3](@scope/package-3/index.md) -- [package-4](package-4/index.md) -- [package-5](package-5/package-5.md) -- [package-6](package-6.md) -- [package-7](package-7/index.md) " `; @@ -172,19 +161,6 @@ Some text. ## Readme heading Some text. - -## Packages - -| Name | Version | Description | -| :------ | :------ | :------ | -| [@scope/package-1](package-1/README.md) | 1.0.0 | Description for package-1 | -| [package-1b](package-1b/README.md) | - | - | -| [package-2](package-2/README.md) | 1.0.0 | - | -| [@scope/package-3](package-3/README.md) | - | Description for package 3 | -| [package-4](package-4/README.md) | - | - | -| [package-5](package-5/package-5.md) | - | - | -| [package-6](package-6.md) | - | - | -| [package-7](package-7/README.md) | - | - | " `; diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/readme.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/readme.spec.ts.snap index ea83182e4..6d03db8d1 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/readme.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/readme.spec.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Readmes should get merged readme for members: (Output File Strategy "members") (Option Group "1") 1`] = ` -"**typedoc-stubs** • **Docs** +"**typedoc-stubs v0.0** • **Docs** *** @@ -17,7 +17,7 @@ Some text. Module commments -## API Index +## typedoc-stubs v0.0 ### Functions @@ -26,7 +26,7 @@ Module commments `; exports[`Readmes should get merged readme for modules: (Output File Strategy "modules") (Option Group "1") 1`] = ` -"**typedoc-stubs** • **Docs** +"**typedoc-stubs v0.0** • **Docs** *** diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.class.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.class.spec.ts.snap index 1f71999e8..f25fef929 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.class.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.class.spec.ts.snap @@ -3,7 +3,7 @@ exports[`Class Reflection should compile abstract class: (Output File Strategy "members") (Option Group "1") 1`] = ` "# Class: \`abstract\` AbstractClass -## Extended By +## Extended by - [\`DerivedClassA\`](DerivedClassA.md) - [\`DerivedClassB\`](DerivedClassB.md) @@ -51,7 +51,7 @@ Comments for abstractMethod exports[`Class Reflection should compile abstract class: (Output File Strategy "members") (Option Group "2") 1`] = ` "# Class: \`abstract\` AbstractClass -## Extended By +## Extended by - [\`DerivedClassA\`](DerivedClassA.md) - [\`DerivedClassB\`](DerivedClassB.md) @@ -371,11 +371,11 @@ Comments for ClassWithComplexProps ### objecLiteralProp -> **objecLiteralProp**: \`object\` +> **objecLiteralProp**: \`object\` = \`...\` #### someFunction() -> **someFunction**: (\`a\`) => \`string\` +> **someFunction**: (\`a\`) => \`string\` = \`...\` Comments for someFunction @@ -418,7 +418,7 @@ new ClassWithComplexProps(): ClassWithComplexProps ## Properties -| Property | Type | Default Value | +| Property | Type | Default value | | :------ | :------ | :------ | | \`objecLiteralProp\` | \`object\` | \`...\` | | \`objecLiteralProp.someFunction\` | (\`a\`: \`string\`) => \`string\` | \`...\` | @@ -651,10 +651,10 @@ new ClassWithFlags(): ClassWithFlags ## Properties -| Property | Modifier | Flags | Type | -| :------ | :------ | :------ | :------ | -| \`expermintalProp\` | \`public\` | \`Experimental\` | \`string\` | -| \`internalProp\` | \`private\` | \`Internal\` | \`string\` | +| Property | Modifier | Type | +| :------ | :------ | :------ | +| \`expermintalProp\` (*Experimental*) | \`public\` | \`string\` | +| \`internalProp\` (*Internal*) | \`private\` | \`string\` | ## Methods @@ -838,7 +838,7 @@ new ClassWithModifiers(): ClassWithModifiers ## Properties -| Property | Modifier | Type | Default Value | Description | +| Property | Modifier | Type | Default value | Description | | :------ | :------ | :------ | :------ | :------ | | \`privateProp\` | \`private\` | \`string\` | \`undefined\` | Comments for privateProp | | \`protectedProp\` | \`protected\` | \`string\` | \`undefined\` | Comments for protectedProp | @@ -999,7 +999,7 @@ new ClassWithSimpleProps(): ClassWithSimpleProps ## Properties -| Property | Type | Default Value | Description | +| Property | Type | Default value | Description | | :------ | :------ | :------ | :------ | | \`propA\` | \`string\` | \`'propAValue'\` | Comments for propA | | \`propB\` | \`string\` | \`'propBDefaultValue'\` | Comments for propB | @@ -1087,7 +1087,7 @@ Comments for ClassWithTypeParameters ## Type Parameters -| Type Parameter | Value | Description | +| Type Parameter | Default type | Description | | :------ | :------ | :------ | | \`A\` | - | Comments for param A | | \`B\` *extends* \`string\` | - | Comments for param B | @@ -1219,7 +1219,7 @@ new DerivedClassA(): DerivedClassA ## Properties -| Property | Type | Default Value | Description | Overrides | +| Property | Type | Default value | Description | Overrides | | :------ | :------ | :------ | :------ | :------ | | \`abstractProp\` | \`string\` | \`'abstractProp'\` | Comments for abstractProp | [\`AbstractClass\`](AbstractClass.md).\`abstractProp\` | | \`derivedProp\` | \`string\` | \`undefined\` | - | - | @@ -1304,7 +1304,7 @@ exports[`Class Reflection should compile disposable class: (Output File Strategy exports[`Class Reflection should compile hierarchy for BaseClass: (Output File Strategy "members") (Option Group "1") 1`] = ` "# Class: BaseClass -## Extended By +## Extended by - [\`ChildClassA\`](ChildClassA.md) - [\`ChildClassB\`](ChildClassB.md) @@ -1328,7 +1328,7 @@ exports[`Class Reflection should compile hierarchy for ChildClassA: (Output File - [\`BaseClass\`](BaseClass.md) -## Extended By +## Extended by - [\`GrandChildClassA\`](GrandChildClassA.md) - [\`GrandChildClassB\`](GrandChildClassB.md) diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.function.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.function.spec.ts.snap index 0fe1fe726..0665613f1 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.function.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.function.spec.ts.snap @@ -240,10 +240,10 @@ Comments for function Return comments -| Member | Type | Value | -| :------ | :------ | :------ | -| \`x\` | \`number\` | 1 | -| \`y\` | \`number\` | 2 | +| Member | Type | +| :------ | :------ | +| \`x\` | \`number\` | +| \`y\` | \`number\` | ## Default @@ -415,7 +415,7 @@ This is a function with a parameter that has a default value. ## Parameters -| Parameter | Type | Default Value | Description | +| Parameter | Type | Default value | Description | | :------ | :------ | :------ | :------ | | \`valueA\` | \`string\` | \`'defaultValue'\` | A parameter with a default string value. | | \`valueB\` | \`number\` | \`100\` | A parameter with a default numeric value. | @@ -753,7 +753,7 @@ This is a function with a parameters. ## Parameters -| Parameter | Type | Default Value | Description | +| Parameter | Type | Default value | Description | | :------ | :------ | :------ | :------ | | \`firstParamWithDefault\` | \`boolean\` | \`true\` | - | | \`requiredParam\` | \`string\` | \`undefined\` | A normal parameter. | @@ -785,7 +785,7 @@ This is a function with a parameters. ## Parameters -| Parameter | Type | Default Value | Description | +| Parameter | Type | Default value | Description | | :------ | :------ | :------ | :------ | | \`firstParamWithDefault\` | \`boolean\` | \`true\` | - | | \`requiredParam\` | \`string\` | \`undefined\` | A normal parameter. | @@ -887,7 +887,7 @@ Function with type parameters ## Type Parameters -| Type Parameter | Value | Description | +| Type Parameter | Default type | Description | | :------ | :------ | :------ | | \`T\` | - | Comments for T | | \`Item\` | \`string\` \\| \`boolean\` | - | diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.interface.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.interface.spec.ts.snap index 0378b01da..0d01ac75d 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.interface.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.interface.spec.ts.snap @@ -5,7 +5,7 @@ exports[`Interface Reflection should compile basic interface: (Output File Strat Comments for BasicInterface -## Extended By +## Extended by - [\`ExtendedInterface\`](ExtendedInterface.md) @@ -236,7 +236,7 @@ exports[`Interface Reflection should compile basic interface: (Output File Strat Comments for BasicInterface -## Extended By +## Extended by - [\`ExtendedInterface\`](ExtendedInterface.md) @@ -812,10 +812,10 @@ Comments for InterfaceWithFlags ## Properties -| Property | Flags | Type | -| :------ | :------ | :------ | -| \`expermintalProp?\` | \`Experimental\` | \`string\` | -| \`internalProp\` | \`Internal\` | \`string\` | +| Property | Type | +| :------ | :------ | +| \`expermintalProp?\` (*Experimental*) | \`string\` | +| \`internalProp\` (*Internal*) | \`string\` | " `; diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.variable.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.variable.spec.ts.snap index 44abf9c57..540d47e44 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.variable.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/reflection.variable.spec.ts.snap @@ -3,7 +3,7 @@ exports[`Variable Reflection should compile object with symbol: (Output File Strategy "members") (Option Group "1") 1`] = ` "# Variable: objectWithSymbol -> \`const\` **objectWithSymbol**: \`object\` +> \`const\` **objectWithSymbol**: \`object\` = \`...\` Comments variable with symbol @@ -25,16 +25,16 @@ exports[`Variable Reflection should compile object with symbol: (Output File Str "# Variable: objectWithSymbol \`\`\`ts -const objectWithSymbol: object; +const objectWithSymbol: object = ...; \`\`\` Comments variable with symbol ## Type declaration -| Member | Type | Value | Description | -| :------ | :------ | :------ | :------ | -| \`[sym]\` | \`string\` | 'value' | Comments for symbol | +| Member | Type | Description | +| :------ | :------ | :------ | +| \`[sym]\` | \`string\` | Comments for symbol | ## Source @@ -45,7 +45,7 @@ Comments variable with symbol exports[`Variable Reflection should compile type operator variable: (Output File Strategy "members") (Option Group "1") 1`] = ` "# Variable: typeOperatorVariable -> \`const\` **typeOperatorVariable**: unique \`symbol\` +> \`const\` **typeOperatorVariable**: unique \`symbol\` = \`...\` Comments for typeOperatorVariable @@ -59,7 +59,7 @@ exports[`Variable Reflection should compile type operator variable: (Output File "# Variable: typeOperatorVariable \`\`\`ts -const typeOperatorVariable: unique symbol; +const typeOperatorVariable: unique symbol = ...; \`\`\` Comments for typeOperatorVariable @@ -101,7 +101,7 @@ A simple string variable exports[`Variable Reflection should compile variable assigned to an object literal: (Output File Strategy "members") (Option Group "1") 1`] = ` "# Variable: objectLiteralVariable -> \`const\` **objectLiteralVariable**: \`object\` +> \`const\` **objectLiteralVariable**: \`object\` = \`...\` Comments for objectLiteralVariable @@ -117,15 +117,15 @@ Comments for objectLiteralVariable ### valueX -> **valueX**: \`object\` +> **valueX**: \`object\` = \`...\` ### valueX.valueA -> **valueA**: \`number\`[] +> **valueA**: \`number\`[] = \`...\` ### valueX.valueY() -> **valueY**: (\`z\`) => \`object\` +> **valueY**: (\`z\`) => \`object\` = \`...\` #### Parameters @@ -145,7 +145,7 @@ Comments for objectLiteralVariable ##### c -> **c**: \`object\` +> **c**: \`object\` = \`...\` ##### c.a @@ -161,7 +161,7 @@ Comments for objectLiteralVariable ### valueY() -> **valueY**: (\`unionParam\`, \`_undercoreParam_\`) => \`string\` +> **valueY**: (\`unionParam\`, \`_undercoreParam_\`) => \`string\` = \`...\` #### Parameters @@ -183,22 +183,22 @@ exports[`Variable Reflection should compile variable assigned to an object liter "# Variable: objectLiteralVariable \`\`\`ts -const objectLiteralVariable: object; +const objectLiteralVariable: object = ...; \`\`\` Comments for objectLiteralVariable ## Type declaration -| Member | Type | Value | -| :------ | :------ | :------ | -| \`valueA\` | \`number\` | 100 | -| \`valueB\` | \`boolean\` | true | -| \`valueX\` | \`object\` | ... | -| \`valueX.valueA\` | \`number\`[] | ... | -| \`valueX.valueY\` | (\`z\`: \`string\`) => \`object\` | ... | -| \`valueX.valueZ\` | \`string\` | 'foo' | -| \`valueY\` | (\`unionParam\`: \`"a"\` \\| \`"b"\`, \`_undercoreParam_\`: \`string\`) => \`string\` | ... | +| Member | Type | +| :------ | :------ | +| \`valueA\` | \`number\` | +| \`valueB\` | \`boolean\` | +| \`valueX\` | \`object\` | +| \`valueX.valueA\` | \`number\`[] | +| \`valueX.valueY\` | (\`z\`: \`string\`) => \`object\` | +| \`valueX.valueZ\` | \`string\` | +| \`valueY\` | (\`unionParam\`: \`"a"\` \\| \`"b"\`, \`_undercoreParam_\`: \`string\`) => \`string\` | ## Source diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/text.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/text.spec.ts.snap index fae1e209b..4adf03b1d 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/text.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/text.spec.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Text should get translations for index page: (Output File Strategy "members") (Option Group "1") 1`] = ` -"[**My API - v0.0**](README.md) • **API** +"**My API - v0.0** • **API** *** @@ -18,12 +18,30 @@ Copyright Test " `; +exports[`Text should get translations for index page: (Output File Strategy "members") (Option Group "2") 1`] = ` +"**My API - v0.0 (ko)** • **Docs (ko)** + +*** + +# typedoc-stubs v0.0 + +## 모듈 + +- [module-1](module-1/README.md) +- [module-2](module-2/README.md) + +*** + +Copyright Test (ko) +" +`; + exports[`Text should get translations for member page: (Output File Strategy "members") (Option Group "1") 1`] = ` "[**My API - v0.0**](../../README.md) • **API** *** -[typedoc-stubs v0.0](../../modules.md) / [module-1](../README.md) / SomeInterface +[typedoc-stubs v0.0](../../README.md) / [module-1](../README.md) / SomeInterface # SomeInterface @@ -45,18 +63,45 @@ Copyright Test " `; +exports[`Text should get translations for member page: (Output File Strategy "members") (Option Group "2") 1`] = ` +"[**My API - v0.0 (ko)**](../../README.md) • **Docs (ko)** + +*** + +[typedoc-stubs v0.0](../../README.md) / [module-1](../README.md) / SomeInterface + +# 인터페이스: SomeInterface + +## 속성 + +| 속성 | Type (ko) | 설명 | +| :------ | :------ | :------ | +| \`someProp?\` | \`boolean\` | Description for prop someProp | + +## Events + +| 이벤트 | Type (ko) | +| :------ | :------ | +| \`someEvent\` | \`MouseEvent\` | + +*** + +Copyright Test (ko) +" +`; + exports[`Text should get translations for module page: (Output File Strategy "members") (Option Group "1") 1`] = ` "[**My API - v0.0**](../README.md) • **API** *** -[typedoc-stubs v0.0](../modules.md) / module-1 +[typedoc-stubs v0.0](../README.md) / module-1 -# module-1 - module-1 +# module-1 -## Index +## TOC -### Interfaces +### CoolInterfaces - [SomeInterface](interfaces/SomeInterface.md) @@ -71,11 +116,11 @@ exports[`Text should get translations for modules page: (Output File Strategy "m *** -[typedoc-stubs v0.0](modules.md) / module-2 +[typedoc-stubs v0.0](README.md) / module-2 -# module-2 - module-2 +# module-2 -## Variables +## CoolVars ### constA @@ -95,7 +140,7 @@ exports[`Text should get translations for sidebar: (Output File Strategy "member "path": "module-1/README.md", "children": [ { - "title": "Interfaces", + "title": "CoolInterfaces", "children": [ { "title": "SomeInterface", @@ -112,7 +157,7 @@ exports[`Text should get translations for sidebar: (Output File Strategy "member "path": "module-2/README.md", "children": [ { - "title": "Variables", + "title": "CoolVars", "children": [ { "title": "constA", diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/urls.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/urls.spec.ts.snap index 69577abee..e64143b30 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/urls.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/urls.spec.ts.snap @@ -185,15 +185,29 @@ exports[`Urls should gets Urls for documents single module: outputFileStrategy: [ "ModuleWithDocuments1/README.md", "ModuleWithDocuments1/classes/ClassWithDocuments.md", + "ModuleWithDocuments1/classes/documents/CLASS_DOC.md", + "ModuleWithDocuments1/documents/MODULE_DOC.md", "ModuleWithDocuments1/enumerations/EnumWithDocuments.md", + "ModuleWithDocuments1/enumerations/documents/ENUM_DOC.md", + "ModuleWithDocuments1/functions/documents/FUNCTION_DOC_1.md", + "ModuleWithDocuments1/functions/documents/FUNCTION_DOC_2.md", + "ModuleWithDocuments1/functions/documents/FUNCTION_DOC_3.md", "ModuleWithDocuments1/functions/functionWithDocuments.md", "ModuleWithDocuments1/functions/multipleFunctionWithDocuments.md", "ModuleWithDocuments1/interfaces/InterfaceWithDocuments.md", + "ModuleWithDocuments1/interfaces/documents/INTERFACE_DOC.md", "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/README.md", "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/classes/NamespaceClassWithDocuments.md", + "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/classes/documents/CLASS_DOC.md", + "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/documents/NAMESPACE_DOC.md", "ModuleWithDocuments1/type-aliases/TypeWithDocuments.md", + "ModuleWithDocuments1/type-aliases/documents/TYPE_DOC.md", + "ModuleWithDocuments1/variables/documents/VARIABLE_DOC.md", "ModuleWithDocuments1/variables/variableWithDocuments.md", "README.md", + "documents/Project-Document-1.md", + "documents/docs/project/PROJECT_DOC_2.md", + "documents/docs/project/PROJECT_DOC_3.md", ] `; @@ -222,8 +236,22 @@ exports[`Urls should gets Urls for documents single module: outputFileStrategy: exports[`Urls should gets Urls for documents single module: outputFileStrategy: modules 2`] = ` [ "ModuleWithDocuments1/README.md", + "ModuleWithDocuments1/documents/Class.CLASS_DOC.md", + "ModuleWithDocuments1/documents/Enumeration.ENUM_DOC.md", + "ModuleWithDocuments1/documents/Function.FUNCTION_DOC_1.md", + "ModuleWithDocuments1/documents/Function.FUNCTION_DOC_2.md", + "ModuleWithDocuments1/documents/Function.FUNCTION_DOC_3.md", + "ModuleWithDocuments1/documents/Interface.INTERFACE_DOC.md", + "ModuleWithDocuments1/documents/MODULE_DOC.md", + "ModuleWithDocuments1/documents/TypeAlias.TYPE_DOC.md", + "ModuleWithDocuments1/documents/Variable.VARIABLE_DOC.md", "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/README.md", + "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/documents/Class.CLASS_DOC.md", + "ModuleWithDocuments1/namespaces/NamespaceWithDocuments/documents/NAMESPACE_DOC.md", "README.md", + "documents/Project-Document-1.md", + "documents/docs/project/PROJECT_DOC_2.md", + "documents/docs/project/PROJECT_DOC_3.md", ] `; diff --git a/packages/typedoc-plugin-markdown/test/specs/comments.spec.ts b/packages/typedoc-plugin-markdown/test/specs/comments.spec.ts index 19254e980..ef29d6101 100644 --- a/packages/typedoc-plugin-markdown/test/specs/comments.spec.ts +++ b/packages/typedoc-plugin-markdown/test/specs/comments.spec.ts @@ -37,6 +37,10 @@ describe(`Comments`, () => { '/type-aliases/TypeDeclarationTable.md', '/TypeAlias.TypeDeclarationTable.md', ]); + expectFileToEqual('comments', 'members', [ + '/variables/TypeDeclarationTable.md', + '/Variable.TypeDeclarationTable.md', + ]); }); test(`should get tables for emum`, () => { diff --git a/packages/typedoc-plugin-markdown/test/specs/text.spec.ts b/packages/typedoc-plugin-markdown/test/specs/text.spec.ts index ee7a8dad0..d3849ec64 100644 --- a/packages/typedoc-plugin-markdown/test/specs/text.spec.ts +++ b/packages/typedoc-plugin-markdown/test/specs/text.spec.ts @@ -2,7 +2,7 @@ import { expectFileToEqual } from '@devtools/testing'; describe(`Text`, () => { test(`should get translations for index page`, () => { - expectFileToEqual('text', 'members', ['modules.md']); + expectFileToEqual('text', 'members', 'README.md'); }); test(`should get translations for module page`, () => { @@ -10,9 +10,11 @@ describe(`Text`, () => { }); test(`should get translations for member page`, () => { - expectFileToEqual('text', 'members', [ + expectFileToEqual( + 'text', + 'members', 'module-1/interfaces/SomeInterface.md', - ]); + ); }); test(`should get translations for modules page`, () => { diff --git a/packages/typedoc-plugin-markdown/tsconfig.json b/packages/typedoc-plugin-markdown/tsconfig.json index 5682b50f1..782412e88 100644 --- a/packages/typedoc-plugin-markdown/tsconfig.json +++ b/packages/typedoc-plugin-markdown/tsconfig.json @@ -2,15 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "./dist", - "baseUrl": "src", - "paths": { - "@plugin/app/*": ["./app/*"], - "@plugin/libs/*": ["./libs/*"], - "@plugin/theme": ["./theme/index.ts"], - "@plugin/theme/*": ["./theme/*"], - "@plugin/options": ["./options/index.ts"], - "@plugin/options/*": ["./options/*"] - } + "baseUrl": "src" }, "include": ["src/**/*.ts"], "exclude": ["./dist", "./test", ".scripts", "**/*.spec.ts"] diff --git a/packages/typedoc-plugin-markdown/typedoc.json b/packages/typedoc-plugin-markdown/typedoc.json new file mode 100644 index 000000000..d984c8fb3 --- /dev/null +++ b/packages/typedoc-plugin-markdown/typedoc.json @@ -0,0 +1,22 @@ +{ + "entryPoints": [ + "./src/app/events", + "./src/internationalization", + "./src/app/renderer", + "./src/theme", + "./src/libs" + ], + "excludeExternals": true, + "categoryOrder": [ + "Initialization", + "Application", + "Theme", + "Options", + "Page Partials", + "Container Partials", + "Member Partials", + "Comment Partials", + "Type Partials", + "*" + ] +} diff --git a/typedoc.base.json b/typedoc.base.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/typedoc.base.json @@ -0,0 +1 @@ +{} diff --git a/typedoc.html.json b/typedoc.html.json new file mode 100644 index 000000000..39ed1b7d8 --- /dev/null +++ b/typedoc.html.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://typedoc-plugin-markdown.org/schema.json", + "name": "packages-example", + "out": "./devdocs-html", + "json": "devdocs-json.json", + "readme": "none", + "entryPoints": [ + "./packages/typedoc-plugin-markdown", + "./packages/typedoc-plugin-frontmatter" + ], + "entryPointStrategy": "packages", + "projectDocuments": ["./CONTRIBUTING.md"] +} diff --git a/typedoc.json b/typedoc.json new file mode 100644 index 000000000..4976d7d7a --- /dev/null +++ b/typedoc.json @@ -0,0 +1,25 @@ +{ + "$schema": "https://typedoc-plugin-markdown.org/schema.json", + "name": "Developer Guide", + "out": "./devdocs", + "readme": "none", + "entryPoints": [ + "./packages/typedoc-plugin-markdown", + "./packages/typedoc-plugin-frontmatter" + ], + "entryPointStrategy": "packages", + "plugin": ["./packages/typedoc-plugin-markdown/dist"], + "indexFormat": "table", + "outputFileStrategy": "members", + "excludePrivate": false, + "textContentMappings": { + "breadcrumbs.home": "Home" + }, + "hidePageHeader": true, + "packageOptions": { + "readme": "none", + "includeVersion": true, + "excludePrivate": false + }, + "projectDocuments": ["./CONTRIBUTING.md"] +}