diff --git a/.config/.prettierignore b/.config/.prettierignore index 9245daa3e..b939d452b 100644 --- a/.config/.prettierignore +++ b/.config/.prettierignore @@ -12,6 +12,3 @@ ../example/docs/ **/tmp **/.vs - -# Remove once Prettier has support -../src/test/converter2/behavior/resolutionMode.ts diff --git a/.config/typedoc.json b/.config/typedoc.json index d0186774a..609bee4b7 100644 --- a/.config/typedoc.json +++ b/.config/typedoc.json @@ -13,6 +13,8 @@ ], "sort": ["kind", "instance-first", "required-first", "alphabetical"], "entryPoints": ["../src/index.ts"], + "alwaysCreateEntryPointModule": false, + "projectDocuments": ["../internal-docs/plugins.md"], "excludeExternals": true, "excludeInternal": false, "excludePrivate": true, @@ -44,5 +46,10 @@ "includeGroups": false }, "includeVersion": true, - "logLevel": "Verbose" + "logLevel": "Verbose", + "externalSymbolLinkMappings": { + "@types/markdown-it": { + "MarkdownIt": "https://markdown-it.github.io/markdown-it/#MarkdownIt" + } + } } diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index b923486a1..000000000 --- a/.eslintrc +++ /dev/null @@ -1,88 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "tsconfig.json" - }, - "env": { - "node": true, - "es6": true - }, - "plugins": ["@typescript-eslint"], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended" - ], - "ignorePatterns": [ - "src/test/renderer/specs", - "dist", - "docs", - "tmp", - "coverage", - "static/main.js", - "src/lib/output/themes/default/assets", - "node_modules", - // Would be nice to lint these, but they shouldn't be included in the project, - // so we need a second eslint config file. - "example", - "src/test/converter", - "src/test/converter2", - "src/test/module", - "src/test/packages", - "src/test/renderer", - "src/test/slow/entry-points", - "scripts", - "bin" - ], - "rules": { - "@typescript-eslint/no-floating-promises": "error", - "@typescript-eslint/await-thenable": "error", - - // This one is just annoying since it complains at incomplete code - "no-empty": "off", - - // This rule is factually incorrect. Interfaces which extend some type alias can be used to introduce - // new type names. This is useful particularly when dealing with mixins. - "@typescript-eslint/no-empty-interface": "off", - - // We still use `any` fairly frequently... - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/no-explicit-any": "off", - - // Really annoying, doesn't provide any value. - "@typescript-eslint/no-empty-function": "off", - - // Declaration merging with a namespace is a necessary tool when working with enums. - "@typescript-eslint/no-namespace": "off", - - // Reported by TypeScript - "@typescript-eslint/no-unused-vars": "off", - - "no-console": "warn", - - // Feel free to turn one of these back on and submit a PR! - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - - "no-restricted-syntax": [ - "warn", - { - "selector": "ImportDeclaration[source.value=/.*perf$/]", - "message": "Benchmark calls must be removed before committing." - }, - { - "selector": "MemberExpression[object.name=type][property.name=symbol]", - "message": "Use type.getSymbol() instead, Type.symbol is not properly typed." - } - ] - }, - "overrides": [ - { - "files": ["src/test/**"], - "env": { - "mocha": true - } - } - ] -} diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index aa503e5d8..708307afb 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -22,8 +22,9 @@ labels: bug Note: Turn off skipErrorChecks before reporting a crash. Bug reports for crashes with that option on are out of scope. -If possible, please create a *minimal* repo reproducing your problem and link it. -You can easily do this by submitting a pull request to https://github.com/TypeStrong/typedoc-repros +If possible, please create a *minimal* repo reproducing your problem. +If it is more than a single small file, please submit a pull request to +https://github.com/TypeStrong/typedoc-repros which changes the files necessary to reproduce your bug. If this is not possible, include at least: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f05ed0295..feeb99d49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,13 +5,13 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: ["18", "20", "21"] + node: ["18", "20", "22"] name: Node ${{ matrix.node }} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Install @@ -20,24 +20,40 @@ jobs: run: npm run build - name: Test run: npm run test:full - env: - # For pull requests, this gets handled by the visual-regression workflow. - # For other test runs, skip so we don't have to go build the regression screenshots. - SKIP_VISUAL_TEST: true - name: Lint run: npm run lint -- --max-warnings 0 - name: Circular dependency check - uses: gerrit0/circular-dependency-check@v2 + uses: gerrit0/circular-dependency-check@v2.0.2 with: entry: dist/index.js + build-release: + runs-on: ubuntu-latest + name: Node 22 Release + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Install + run: npm ci + - name: Build + run: | + node scripts/set_strict.js false + npm run build + - name: Test + run: npm run test:full + - name: Lint + run: npm run lint -- --max-warnings 0 build-windows: runs-on: windows-latest name: Node 18 Windows steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - name: Upgrade npm @@ -48,7 +64,5 @@ jobs: run: npm run build - name: Test run: npm run test:full - env: - SKIP_VISUAL_TEST: true - name: Lint run: npm run lint -- --max-warnings 0 diff --git a/.github/workflows/publish-beta.yml b/.github/workflows/publish-beta.yml index 4a004bf39..e9cc57dd5 100644 --- a/.github/workflows/publish-beta.yml +++ b/.github/workflows/publish-beta.yml @@ -9,22 +9,25 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - id: check - uses: EndBug/version-check@v1 + uses: EndBug/version-check@v2.1.4 with: diff-search: true - name: Set up Node if: steps.check.outputs.changed == 'true' && contains(steps.check.outputs.version, 'beta') - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: - node-version: "20" + node-version: "18" - name: Upgrade npm if: steps.check.outputs.changed == 'true' && contains(steps.check.outputs.version, 'beta') run: npm i -g npm@latest - name: Install if: steps.check.outputs.changed == 'true' && contains(steps.check.outputs.version, 'beta') run: npm ci + - name: Test + if: steps.check.outputs.changed == 'true' && contains(steps.check.outputs.version, 'beta') + run: npm test - name: Setup publish token if: steps.check.outputs.changed == 'true' && contains(steps.check.outputs.version, 'beta') run: echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc diff --git a/.github/workflows/publish-lts.yml b/.github/workflows/publish-lts.yml index ccc9e894f..2b2f84254 100644 --- a/.github/workflows/publish-lts.yml +++ b/.github/workflows/publish-lts.yml @@ -9,22 +9,25 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - id: check - uses: EndBug/version-check@v1 + uses: EndBug/version-check@v2.1.4 with: diff-search: true - name: Set up Node if: steps.check.outputs.changed == 'true' - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: "20" + node-version: "18" - name: Upgrade npm if: steps.check.outputs.changed == 'true' run: npm i -g npm@latest - name: Install if: steps.check.outputs.changed == 'true' run: npm ci + - name: Test + if: steps.check.outputs.changed == 'true' + run: npm test - name: Setup publish token if: steps.check.outputs.changed == 'true' run: echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 627066b5a..b364e0dbf 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,21 +9,24 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - id: check - uses: EndBug/version-check@v2.1.0 + uses: EndBug/version-check@v2.1.4 with: diff-search: true - name: Set up Node if: steps.check.outputs.changed == 'true' - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: "20" + node-version: "18" - name: Install if: steps.check.outputs.changed == 'true' run: npm ci + - name: Test + if: steps.check.outputs.changed == 'true' + run: npm test - name: Setup publish token if: steps.check.outputs.changed == 'true' run: echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc diff --git a/.github/workflows/visual-regression.yml b/.github/workflows/visual-regression.yml deleted file mode 100644 index 734faeee5..000000000 --- a/.github/workflows/visual-regression.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Visual Regression Testing -on: [workflow_dispatch] -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Set up Node - uses: actions/setup-node@v3 - with: - node-version: 20 - - name: Upgrade npm - run: npm i -g npm@latest - - name: Get baseline screenshots - run: | - git fetch - git checkout origin/$GITHUB_BASE_REF - npm ci - npm run build - node dist/test/capture-screenshots.js - npm run test:visual:accept - - - name: Get current screenshots - run: | - git checkout $GITHUB_SHA - npm ci - npm run build - node dist/test/capture-screenshots.js - - name: Test - run: npx reg-suit run -c .config/regconfig.json --test - - name: Upload Results - uses: actions/upload-artifact@v3 - with: - name: visual-regression - path: dist/tmp/.reg diff --git a/.npmrc b/.npmrc index 0683edb0a..b241adc44 100644 --- a/.npmrc +++ b/.npmrc @@ -3,3 +3,6 @@ # an install, so just turn it off. We can still check for findings # with npm audit --production. audit = false + +# While we're on the TS beta, need this flag. +legacy-peer-deps = true diff --git a/.vscode/settings.json b/.vscode/settings.json index 6fd759eb7..bb54bcf11 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -41,6 +41,7 @@ "mochaExplorer.configFile": ".config/mocha.test-explorer.json", "cSpell.words": [ "cname", + "Combinatorially", "deserializers", "githubprivate", "linkcode", diff --git a/CHANGELOG.md b/CHANGELOG.md index baf867a4f..8ccd5abf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,157 @@ # Unreleased +## v0.26.3 (2024-06-28) + +### Features + +- "On This Page" navigation now includes the page groups in collapsible sections, #2616. + +### Bug Fixes + +- `mailto:` links are no longer incorrectly recognized as relative paths, #2613. +- Added `@since` to the default list of recognized tags, #2614. +- Relative paths to directories will no longer cause the directory to be copied into the media directory, #2617. + +## v0.26.2 (2024-06-24) + +### Features + +- Added a `--suppressCommentWarningsInDeclarationFiles` option to disable warnings from + parsing comments in declaration files, #2611. +- Improved comment discovery to more closely match TypeScript's discovery when getting comments + for members of interfaces/classes, #2084, #2545. + +### Bug Fixes + +- The `text` non-highlighted language no longer causes warnings when rendering, #2610. +- If a comment on a method is inherited from a parent class, and the child class does not + use an `@param` tag from the parent, TypeDoc will no longer warn about the `@param` tag. + +## v0.26.1 (2024-06-22) + +### Features + +- Improved Korean translation coverage, #2602. + +### Bug Fixes + +- Added `@author` to the default list of recognized tags, #2603. +- Anchor links are no longer incorrectly checked for relative paths, #2604. +- Fixed an issue where line numbers reported in error messages could be incorrect, #2605. +- Fixed relative link detection for markdown links containing code in their label, #2606. +- Fixed an issue with packages mode where TypeDoc would use (much) more memory than required, #2607. +- TypeDoc will no longer crash when asked to render highlighted code for an unsupported language, #2609. +- Fixed an issue where relatively-linked files would not be copied to the output directory in packages mode. +- Fixed an issue where modifier tags were not applied to top level modules in packages mode. +- Fixed an issue where excluded tags were not removed from top level modules in packages mode. +- `.jsonc` configuration files are now properly read as JSONC, rather than being passed to `require`. + +### Thanks! + +- @KNU-K + +# v0.26.0 (2024-06-22) + +### Breaking Changes + +- Drop support for Node 16. +- Moved from `marked` to `markdown-it` for parsing as marked has moved to an async model which supporting would significantly complicate TypeDoc's rendering code. + This means that any projects setting `markedOptions` needs to be updated to use `markdownItOptions`. + Unlike `marked@4`, `markdown-it` pushes lots of functionality to plugins. To use plugins, a JavaScript config file must be used with the `markdownItLoader` option. +- Updated Shiki from 0.14 to 1.x. This should mostly be a transparent update which adds another 23 supported languages and 13 supported themes. + As Shiki adds additional languages, the time it takes to load the highlighter increases linearly. To avoid rendering taking longer than necessary, + TypeDoc now only loads a few common languages. Additional languages can be loaded by setting the `--highlightLanguages` option. +- Changed default of `--excludePrivate` to `true`. +- Renamed `--sitemapBaseUrl` to `--hostedBaseUrl` to reflect that it can be used for more than just the sitemap. +- Removed deprecated `navigation.fullTree` option. +- Removed `--media` option, TypeDoc will now detect image links within your comments and markdown documents and automatically copy them to the site. +- Removed `--includes` option, use the `@document` tag instead. +- Removed `--stripYamlFrontmatter` option, TypeDoc will always do this now. +- Renamed the `--htmlLang` option to `--lang`. +- Removed the `--gaId` option for Google Analytics integration and corresponding `analytics` theme member, #2600. +- All function-likes may now have comments directly attached to them. This is a change from previous versions of TypeDoc where functions comments + were always moved down to the signature level. This mostly worked, but caused problems with type aliases, so was partially changed in 0.25.13. + This change was extended to apply not only to type aliases, but also other function-likes declared with variables and callable properties. + As a part of this change, comments on the implementation signature of overloaded functions will now be added to the function reflection, and will + not be inherited by signatures of that function, #2521. +- API: TypeDoc now uses a typed event emitter to provide improved type safety, this found a bug where `Converter.EVENT_CREATE_DECLARATION` + was emitted for `ProjectReflection` in some circumstances. +- API: `MapOptionDeclaration.mapError` has been removed. +- API: Deprecated `BindOption` decorator has been removed. +- API: `DeclarationReflection.indexSignature` has been renamed to `DeclarationReflection.indexSignatures`. + Note: This also affects JSON serialization. TypeDoc will support JSON output from 0.25 through at least 0.26. +- API: `JSONOutput.SignatureReflection.typeParameter` has been renamed to `typeParameters` to match the JS API. +- API: `DefaultThemeRenderContext.iconsCache` has been removed as it is no longer needed. +- API: `DefaultThemeRenderContext.hook` must now be passed `context` if required by the hook. + +### Features + +- Added support for TypeScript 5.5. +- Added new `--projectDocuments` option to specify additional Markdown documents to be included in the generated site #247, #1870, #2288, #2565. +- TypeDoc now has the architecture in place to support localization. No languages besides English + are currently shipped in the package, but it is now possible to add support for additional languages, #2475. +- Added support for a `packageOptions` object which specifies options that should be applied to each entry point when running with `--entryPointStrategy packages`, #2523. +- `--hostedBaseUrl` will now be used to generate a `` element in the project root page, #2550. +- Added support for documenting individual elements of a union type, #2585. + Note: This feature is only available on type aliases directly containing unions. +- TypeDoc will now log the number of errors/warnings errors encountered, if any, after a run, #2581. +- New option, `--customFooterHtml` to add custom HTML to the generated page footer, #2559. +- TypeDoc will now copy modifier tags to children if specified in the `--cascadedModifierTags` option, #2056. +- TypeDoc will now warn if mutually exclusive modifier tags are specified for a comment (e.g. both `@alpha` and `@beta`), #2056. +- Groups and categories can now be collapsed in the page body, #2330. +- Added support for JSDoc `@hideconstructor` tag. + This tag should only be used to work around TypeScript#58653, prefer the more general `@hidden`/`@ignore` tag to hide members normally, #2577. +- Added `--useHostedBaseUrlForAbsoluteLinks` option to use the `--hostedBaseUrl` option to produce absolute links to pages on a site, #940. +- Tag headers now generate permalinks in the default theme, #2308. +- TypeDoc now attempts to use the "most likely name" for a symbol if the symbol is not present in the documentation, #2574. +- Fixed an issue where the "On This Page" section would include markdown if the page contained headings which contained markdown. +- TypeDoc will now warn if a block tag is used which is not defined by the `--blockTags` option. +- Added three new sort strategies `documents-first`, `documents-last`, and `alphabetical-ignoring-documents` to order markdown documents. +- Added new `--alwaysCreateEntryPointModule` option. When set, TypeDoc will always create a `Module` for entry points, even if only one is provided. + If `--projectDocuments` is used to add documents, this option defaults to `true`, otherwise, defaults to `false`. +- Added new `--highlightLanguages` option to control what Shiki language packages are loaded. +- TypeDoc will now render union elements on new lines if there are more than 3 items in the union. +- TypeDoc will now only render the "Type Declaration" section if it will provide additional information not already presented in the page. + This results in significantly smaller documentation pages in many cases where that section would just repeat what has already been presented in the rendered type. +- Added `comment.beforeTags` and `comment.afterTags` hooks for plugin use. + Combined with `CommentTag.skipRendering` this can be used to provide custom tag handling at render time. + +### Bug Fixes + +- TypeDoc now supports objects with multiple index signatures, #2470. +- Header anchor links in rendered markdown are now more consistent with headers generated by TypeDoc, #2546. +- Types rendered in the `Returns` header are now properly colored, #2546. +- Links added with the `navigationLinks` option are now moved into the pull out navigation on mobile displays, #2548. +- `@license` and `@import` comments will be ignored at the top of files, #2552. +- Fixed issue in documentation validation where constructor signatures where improperly considered not documented, #2553. +- Keyboard focus is now visible on dropdowns and checkboxes in the default theme, #2556. +- The color theme label in the default theme now has an accessible name, #2557. +- Fixed issue where search results could not be navigated while Windows Narrator was on, #2563. +- `charset` is now correctly cased in `` tag generated by the default theme, #2568. +- Fixed very slow conversion on Windows where Msys git was used by typedoc to discover repository links, #2586. +- Validation will now be run in watch mode, #2584. +- Fixed an issue where custom themes which added dependencies in the `
` element could result in broken icons, #2589. +- `@default` and `@defaultValue` blocks are now recognized as regular blocks if they include inline tags, #2601. +- Navigation folders sharing a name will no longer be saved with a shared key to `localStorage`. +- The `--hideParameterTypesInTitle` option no longer applies when rendering function types. +- Broken `@link` tags in readme files will now cause a warning when link validation is enabled. +- Fixed `externalSymbolLinkMappings` option's support for [meanings](https://typedoc.org/guides/declaration-references/#meaning) in declaration references. +- Buttons to copy code now have the `type=button` attribute set to avoid being treated as submit buttons. +- `--hostedBaseUrl` will now implicitly add a trailing slash to the generated URL. + +### Thanks! + +- @Aryakoste +- @bladerunner2020 +- @Dinnerbone +- @HarelM +- @kraenhansen +- @Nil2000 +- @steve02081504 +- @tristanzander + +# Unreleased + ## v0.25.13 (2024-04-07) ### Features diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..ed0341e0d --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,135 @@ +// @ts-check +import eslint from "@eslint/js"; +import tslint from "typescript-eslint"; + +/** @type {import("typescript-eslint").ConfigWithExtends} */ +const config = { + languageOptions: { + parserOptions: { + project: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + rules: { + "@typescript-eslint/no-floating-promises": "error", + "@typescript-eslint/await-thenable": "error", + "@typescript-eslint/consistent-type-imports": [ + "error", + { + fixStyle: "inline-type-imports", + prefer: "type-imports", + disallowTypeAnnotations: false, + }, + ], + + "@typescript-eslint/restrict-template-expressions": [ + "error", + { + allowBoolean: true, + allowNumber: true, + }, + ], + + // This one is just annoying since it complains at incomplete code + "no-empty": "off", + + // Doesn't properly handle intersections of generics. + "@typescript-eslint/unified-signatures": "off", + + // This rule is factually incorrect. Interfaces which extend some type alias can be used to introduce + // new type names. This is useful particularly when dealing with mixins. + "@typescript-eslint/no-empty-interface": "off", + + // Conflicts with TS option to require dynamic access for records, which I find more useful. + "@typescript-eslint/no-dynamic-delete": "off", + + // Conflicts with the `NeverIfInternal` type used to enforce a stricter API internally + "@typescript-eslint/no-redundant-type-constituents": "off", + "@typescript-eslint/no-unnecessary-boolean-literal-compare": "off", + + // This is sometimes useful for clarity + "@typescript-eslint/no-unnecessary-type-arguments": "off", + + // We still use `any` fairly frequently... + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/no-unsafe-return": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unsafe-call": "off", + + // Really annoying, doesn't provide any value. + "@typescript-eslint/no-empty-function": "off", + + // Declaration merging with a namespace is a necessary tool when working with enums. + "@typescript-eslint/no-namespace": "off", + + // Reported by TypeScript + "@typescript-eslint/no-unused-vars": "off", + + "no-console": "warn", + + "@typescript-eslint/no-confusing-void-expression": "off", + "@typescript-eslint/unbound-method": "off", + + "@typescript-eslint/prefer-literal-enum-member": [ + "error", + { allowBitwiseExpressions: true }, + ], + + // I'd like to have this turned on, but haven't figured out how to tell it about + // checks that are correctly linted as unnecessary for TypeDoc's usage, but not + // for plugin permitted usage. + "@typescript-eslint/no-unnecessary-condition": "off", + + // Feel free to turn one of these back on and submit a PR! + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + + "no-restricted-syntax": [ + "warn", + { + selector: "ImportDeclaration[source.value=/.*perf$/]", + message: "Benchmark calls must be removed before committing.", + }, + { + selector: + "MemberExpression[object.name=type][property.name=symbol]", + message: + "Use type.getSymbol() instead, Type.symbol is not properly typed.", + }, + ], + }, +}; + +export default tslint.config( + eslint.configs.recommended, + ...tslint.configs.strictTypeChecked, + config, + { + ignores: [ + "eslint.config.mjs", + "src/test/renderer/specs", + "dist", + "docs", + "tmp", + "coverage", + "static/main.js", + "src/lib/output/themes/default/assets", + "**/node_modules", + "example", + "src/test/converter", + "src/test/converter2", + "src/test/module", + "src/test/packages", + "src/test/renderer/", + "src/test/slow/entry-points", + "scripts", + "bin", + + // Not long for this world + "src/test/events.test.ts", + ], + }, +); diff --git a/example/README.md b/example/README.md index be0f3cf83..f0c79be06 100644 --- a/example/README.md +++ b/example/README.md @@ -23,7 +23,7 @@ This project shows off some of TypeDoc's features: - Built-in support for various TypeScript language constructs - Markdown in doc comments -- Syntax highligting in code blocks +- Syntax highlighting in code blocks ## Index of Examples @@ -34,8 +34,9 @@ Here are some examples we wanted to highlight: ### Rendering -- Markdown showcase: {@link markdownShowcase | `markdownShowcase`} -- Syntax highlighting showcase: {@link syntaxHighlightingShowcase | `syntaxHighlightingShowcase` } +- External Markdown: [here](./src/documents/external-markdown.md) +- Markdown showcase: [here](./src/documents/markdown.md) +- Syntax highlighting showcase: [here](./src/documents/syntax-highlighting.md) ### Functions diff --git a/example/package-lock.json b/example/package-lock.json index b67af742e..7bd581806 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -1,235 +1,211 @@ { - "name": "typedoc-example", - "version": "0.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "typedoc-example", - "version": "0.0.0", - "license": "Apache-2.0", - "dependencies": { - "@types/lodash": "^4.14.177", - "@types/react": "^17.0.37", - "@types/react-dom": "^17.0.11", - "lodash": "^4.17.21", - "react": "^17.0.2", - "react-dom": "^17.0.2" - }, - "devDependencies": { - "typescript": "^5.3.2" - } - }, - "node_modules/@types/lodash": { - "version": "4.14.177", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.177.tgz", - "integrity": "sha512-0fDwydE2clKe9MNfvXHBHF9WEahRuj+msTuQqOmAApNORFvhMYZKNGGJdCzuhheVjMps/ti0Ak/iJPACMaevvw==" - }, - "node_modules/@types/prop-types": { - "version": "15.7.4", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz", - "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==" - }, - "node_modules/@types/react": { - "version": "17.0.37", - "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.37.tgz", - "integrity": "sha512-2FS1oTqBGcH/s0E+CjrCCR9+JMpsu9b69RTFO+40ua43ZqP5MmQ4iUde/dMjWR909KxZwmOQIFq6AV6NjEG5xg==", - "dependencies": { - "@types/prop-types": "*", - "@types/scheduler": "*", - "csstype": "^3.0.2" - } - }, - "node_modules/@types/react-dom": { - "version": "17.0.11", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.11.tgz", - "integrity": "sha512-f96K3k+24RaLGVu/Y2Ng3e1EbZ8/cVJvypZWd7cy0ofCBaf2lcM46xNhycMZ2xGwbBjRql7hOlZ+e2WlJ5MH3Q==", - "dependencies": { - "@types/react": "*" - } - }, - "node_modules/@types/scheduler": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", - "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==" - }, - "node_modules/csstype": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.9.tgz", - "integrity": "sha512-rpw6JPxK6Rfg1zLOYCSwle2GFOOsnjmDYDaBwEcwoOg4qlsIVCN789VkBZDJAGi4T07gI4YSutR43t9Zz4Lzuw==" - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", - "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", - "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==", - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "scheduler": "^0.20.2" - }, - "peerDependencies": { - "react": "17.0.2" - } - }, - "node_modules/scheduler": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", - "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==", - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - } - }, - "node_modules/typescript": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", - "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - } - }, - "dependencies": { - "@types/lodash": { - "version": "4.14.177", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.177.tgz", - "integrity": "sha512-0fDwydE2clKe9MNfvXHBHF9WEahRuj+msTuQqOmAApNORFvhMYZKNGGJdCzuhheVjMps/ti0Ak/iJPACMaevvw==" - }, - "@types/prop-types": { - "version": "15.7.4", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz", - "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==" - }, - "@types/react": { - "version": "17.0.37", - "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.37.tgz", - "integrity": "sha512-2FS1oTqBGcH/s0E+CjrCCR9+JMpsu9b69RTFO+40ua43ZqP5MmQ4iUde/dMjWR909KxZwmOQIFq6AV6NjEG5xg==", - "requires": { - "@types/prop-types": "*", - "@types/scheduler": "*", - "csstype": "^3.0.2" - } - }, - "@types/react-dom": { - "version": "17.0.11", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.11.tgz", - "integrity": "sha512-f96K3k+24RaLGVu/Y2Ng3e1EbZ8/cVJvypZWd7cy0ofCBaf2lcM46xNhycMZ2xGwbBjRql7hOlZ+e2WlJ5MH3Q==", - "requires": { - "@types/react": "*" - } - }, - "@types/scheduler": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", - "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==" - }, - "csstype": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.9.tgz", - "integrity": "sha512-rpw6JPxK6Rfg1zLOYCSwle2GFOOsnjmDYDaBwEcwoOg4qlsIVCN789VkBZDJAGi4T07gI4YSutR43t9Zz4Lzuw==" - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "react": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", - "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - } - }, - "react-dom": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", - "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "scheduler": "^0.20.2" - } - }, - "scheduler": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", - "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - } - }, - "typescript": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", - "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", - "dev": true - } + "name": "typedoc-example", + "version": "0.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "typedoc-example", + "version": "0.0.0", + "license": "Apache-2.0", + "dependencies": { + "@types/lodash": "^4.17.5", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "lodash": "^4.17.21", + "react": "^18.3.1", + "react-dom": "^18.3.1" + }, + "devDependencies": { + "typescript": "^5.4.5" + } + }, + "node_modules/@types/lodash": { + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.5.tgz", + "integrity": "sha512-MBIOHVZqVqgfro1euRDWX7OO0fBVUUMrN6Pwm8LQsz8cWhEpihlvR70ENj3f40j58TNxZaWv2ndSkInykNBBJw==", + "license": "MIT" + }, + "node_modules/@types/prop-types": { + "version": "15.7.4", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz", + "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==" + }, + "node_modules/@types/react": { + "version": "18.3.3", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz", + "integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==", + "license": "MIT", + "dependencies": { + "@types/prop-types": "*", + "csstype": "^3.0.2" + } + }, + "node_modules/@types/react-dom": { + "version": "18.3.0", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.0.tgz", + "integrity": "sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==", + "license": "MIT", + "dependencies": { + "@types/react": "*" + } + }, + "node_modules/csstype": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.9.tgz", + "integrity": "sha512-rpw6JPxK6Rfg1zLOYCSwle2GFOOsnjmDYDaBwEcwoOg4qlsIVCN789VkBZDJAGi4T07gI4YSutR43t9Zz4Lzuw==" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + }, + "peerDependencies": { + "react": "^18.3.1" + } + }, + "node_modules/scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/typescript": { + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + } + }, + "dependencies": { + "@types/lodash": { + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.5.tgz", + "integrity": "sha512-MBIOHVZqVqgfro1euRDWX7OO0fBVUUMrN6Pwm8LQsz8cWhEpihlvR70ENj3f40j58TNxZaWv2ndSkInykNBBJw==" + }, + "@types/prop-types": { + "version": "15.7.4", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz", + "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==" + }, + "@types/react": { + "version": "18.3.3", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz", + "integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==", + "requires": { + "@types/prop-types": "*", + "csstype": "^3.0.2" + } + }, + "@types/react-dom": { + "version": "18.3.0", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.0.tgz", + "integrity": "sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==", + "requires": { + "@types/react": "*" + } + }, + "csstype": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.9.tgz", + "integrity": "sha512-rpw6JPxK6Rfg1zLOYCSwle2GFOOsnjmDYDaBwEcwoOg4qlsIVCN789VkBZDJAGi4T07gI4YSutR43t9Zz4Lzuw==" + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "requires": { + "loose-envify": "^1.1.0" + } + }, + "react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "requires": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + } + }, + "scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "requires": { + "loose-envify": "^1.1.0" + } + }, + "typescript": { + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "dev": true } + } } diff --git a/example/package.json b/example/package.json index d12880461..678503e4e 100644 --- a/example/package.json +++ b/example/package.json @@ -11,14 +11,14 @@ "typedoc": "node ../bin/typedoc" }, "dependencies": { - "@types/lodash": "^4.14.177", - "@types/react": "^17.0.37", - "@types/react-dom": "^17.0.11", + "@types/lodash": "^4.17.5", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", "lodash": "^4.17.21", - "react": "^17.0.2", - "react-dom": "^17.0.2" + "react": "^18.3.1", + "react-dom": "^18.3.1" }, "devDependencies": { - "typescript": "^5.3.2" + "typescript": "^5.4.5" } } diff --git a/example/src/classes/CancellablePromise.ts b/example/src/classes/CancellablePromise.ts index 12427f9a5..822f9ae8e 100644 --- a/example/src/classes/CancellablePromise.ts +++ b/example/src/classes/CancellablePromise.ts @@ -381,7 +381,7 @@ export class CancellablePromise${part.text}
`
- : part.text;
- result.push(
- url
- ? `${text}`
- : part.text,
- );
- } else {
- result.push(part.text);
- }
- break;
- }
- default:
- // Hmm... probably want to be able to render these somehow, so custom inline tags can be given
- // special rendering rules. Future capability. For now, just render their text.
- result.push(`{${part.tag} ${part.text}}`);
- break;
- }
- break;
- default:
- assertNever(part);
- }
- }
-
- return result.join("");
- }
-
/**
* Helper utility to clone {@link Comment.summary} or {@link CommentTag.content}
*/
@@ -233,6 +205,11 @@ export class Comment {
target,
};
}
+ case "relative-link": {
+ return {
+ ...part,
+ };
+ }
}
});
}
@@ -242,7 +219,11 @@ export class Comment {
de: Deserializer,
parts: JSONOutput.CommentDisplayPart[],
): CommentDisplayPart[] {
- const links: [number, InlineTagDisplayPart][] = [];
+ const links: [
+ number,
+ InlineTagDisplayPart | RelativeLinkDisplayPart,
+ ][] = [];
+ const files: [number, RelativeLinkDisplayPart][] = [];
const result = parts.map((part): CommentDisplayPart => {
switch (part.kind) {
@@ -282,19 +263,37 @@ export class Comment {
} else {
assertNever(part.target);
}
+ break;
+ }
+ case "relative-link": {
+ if (part.target) {
+ const part2 = {
+ kind: "relative-link",
+ text: part.text,
+ target: null!,
+ } satisfies RelativeLinkDisplayPart;
+ files.push([part.target, part2]);
+ return part2;
+ }
+ return { ...part, target: undefined };
}
}
});
- if (links.length) {
+ if (links.length || files.length) {
de.defer((project) => {
+ for (const [oldFileId, part] of files) {
+ part.target = de.oldFileIdToNewFileId[oldFileId];
+ }
for (const [oldId, part] of links) {
part.target = project.getReflectionById(
de.oldIdToNewId[oldId] ?? -1,
);
if (!part.target) {
de.logger.warn(
- `Serialized project contained a link to ${oldId} (${part.text}), which was not a part of the project.`,
+ de.application.i18n.serialized_project_referenced_0_not_part_of_project(
+ oldId.toString(),
+ ),
);
}
}
@@ -319,6 +318,7 @@ export class Comment {
case "code":
return part.text.includes("\n");
case "inline-tag":
+ case "relative-link":
return false;
}
});
@@ -379,6 +379,33 @@ export class Comment {
*/
label?: string;
+ /**
+ * Full path to the file where this comment originated from, if any.
+ * This field will not be serialized, so will not be present when handling JSON-revived reflections.
+ *
+ * Note: This field is non-enumerable to make testing comment contents with `deepEqual` easier.
+ */
+ @NonEnumerable
+ sourcePath?: string;
+
+ /**
+ * Internal discovery ID used to prevent symbol comments from
+ * being duplicated on signatures. Only set when the comment was created
+ * from a `ts.CommentRange`.
+ * @internal
+ */
+ @NonEnumerable
+ discoveryId?: number;
+
+ /**
+ * If the comment was inherited from a different "parent" declaration
+ * (see #2545), then it is desirable to know this as any `@param` tags
+ * which do not apply should not cause warnings. This is not serialized,
+ * and only set when the comment was created from a `ts.CommentRange`.
+ */
+ @NonEnumerable
+ inheritedFromParentDeclaration?: boolean;
+
/**
* Creates a new Comment instance.
*/
@@ -397,11 +424,16 @@ export class Comment {
* Create a deep clone of this comment.
*/
clone() {
- return new Comment(
+ const comment = new Comment(
Comment.cloneDisplayParts(this.summary),
this.blockTags.map((tag) => tag.clone()),
new Set(this.modifierTags),
);
+ comment.discoveryId = this.discoveryId;
+ comment.sourcePath = this.sourcePath;
+ comment.inheritedFromParentDeclaration =
+ this.inheritedFromParentDeclaration;
+ return comment;
}
/**
diff --git a/src/lib/models/comments/index.ts b/src/lib/models/comments/index.ts
index 15dc5eeb4..9e2becc76 100644
--- a/src/lib/models/comments/index.ts
+++ b/src/lib/models/comments/index.ts
@@ -1,2 +1,6 @@
export { Comment, CommentTag } from "./comment";
-export type { CommentDisplayPart, InlineTagDisplayPart } from "./comment";
+export type {
+ CommentDisplayPart,
+ InlineTagDisplayPart,
+ RelativeLinkDisplayPart,
+} from "./comment";
diff --git a/src/lib/models/index.ts b/src/lib/models/index.ts
index 7d31fb07d..76b2a69fa 100644
--- a/src/lib/models/index.ts
+++ b/src/lib/models/index.ts
@@ -4,3 +4,4 @@ export * from "./comments/index";
export * from "./sources/index";
export * from "./ReflectionGroup";
export * from "./ReflectionCategory";
+export * from "./FileRegistry";
diff --git a/src/lib/models/reflections/ReflectionSymbolId.ts b/src/lib/models/reflections/ReflectionSymbolId.ts
index ee2728179..904d79016 100644
--- a/src/lib/models/reflections/ReflectionSymbolId.ts
+++ b/src/lib/models/reflections/ReflectionSymbolId.ts
@@ -46,7 +46,7 @@ export class ReflectionSymbolId {
declaration?: ts.Declaration,
) {
if ("name" in symbol) {
- declaration ??= symbol?.declarations?.[0];
+ declaration ??= symbol.declarations?.[0];
this.fileName = normalizePath(
declaration?.getSourceFile().fileName ?? "",
);
diff --git a/src/lib/models/reflections/abstract.ts b/src/lib/models/reflections/abstract.ts
index 5f027b0ea..f0d713816 100644
--- a/src/lib/models/reflections/abstract.ts
+++ b/src/lib/models/reflections/abstract.ts
@@ -6,7 +6,12 @@ import { ReflectionKind } from "./kind";
import type { Serializer, Deserializer, JSONOutput } from "../../serialization";
import type { ReflectionVariant } from "./variant";
import type { DeclarationReflection } from "./declaration";
+import type { DocumentReflection } from "./document";
import { NonEnumerable } from "../../utils/general";
+import type {
+ Internationalization,
+ TranslatedString,
+} from "../../internationalization";
/**
* Current reflection id.
@@ -24,28 +29,24 @@ export function resetReflectionID() {
export enum ReflectionFlag {
None = 0,
- Private = 1,
- Protected = 2,
- Public = 4,
- Static = 8,
- ExportAssignment = 16,
- External = 32,
- Optional = 64,
- DefaultValue = 128,
- Rest = 256,
- Abstract = 512,
- Const = 1024,
- Let = 2048,
- Readonly = 4096,
+ Private = 1 << 0,
+ Protected = 1 << 1,
+ Public = 1 << 2,
+ Static = 1 << 3,
+ External = 1 << 4,
+ Optional = 1 << 5,
+ Rest = 1 << 6,
+ Abstract = 1 << 7,
+ Const = 1 << 8,
+ Readonly = 1 << 9,
+ Inherited = 1 << 10,
}
const relevantFlags: ReflectionFlag[] = [
ReflectionFlag.Private,
ReflectionFlag.Protected,
ReflectionFlag.Static,
- ReflectionFlag.ExportAssignment,
ReflectionFlag.Optional,
- ReflectionFlag.DefaultValue,
ReflectionFlag.Rest,
ReflectionFlag.Abstract,
ReflectionFlag.Const,
@@ -55,7 +56,7 @@ const relevantFlags: ReflectionFlag[] = [
/**
* This must extend Array in order to work with Handlebar's each helper.
*/
-export class ReflectionFlags extends Array${part.text}
` : part.text;
+ result.push(
+ url
+ ? `${text}`
+ : part.text,
+ );
+ } else {
+ const text = part.tag === "@linkcode" ? "`" + part.text + "`" : part.text;
+ result.push(url ? `[${text}](${url})` : text);
+ }
+ } else {
+ result.push(part.text);
+ }
+ break;
+ }
+ default:
+ // Hmm... probably want to be able to render these somehow, so custom inline tags can be given
+ // special rendering rules. Future capability. For now, just render their text.
+ result.push(`{${part.tag} ${part.text}}`);
+ break;
+ }
+ break;
+ case "relative-link":
+ switch (typeof part.target) {
+ case "number": {
+ const refl = page.project.files.resolve(part.target);
+ if (typeof refl === "object") {
+ result.push(context.urlTo(refl));
+ break;
+ }
+
+ const fileName = page.project.files.getName(part.target);
+ if (fileName) {
+ result.push(context.relativeURL(`media/${fileName}`));
+ break;
+ }
+ }
+ // fall through
+ case "undefined":
+ result.push(part.text);
+ break;
+ }
+ break;
+ default:
+ assertNever(part);
+ }
+ }
- this.owner.trigger(event);
- return event.parsedText;
+ return result.join("");
}
/**
@@ -131,27 +202,14 @@ output file :
*/
protected override onBeginRenderer(event: RendererEvent) {
super.onBeginRenderer(event);
+ this.setupParser();
+ }
- Marked.marked.setOptions(this.createMarkedOptions());
-
- delete this.includes;
- if (this.includeSource) {
- if (fs.existsSync(this.includeSource) && fs.statSync(this.includeSource).isDirectory()) {
- this.includes = this.includeSource;
- } else {
- this.application.logger.warn("Could not find provided includes directory: " + this.includeSource);
- }
- }
-
- if (this.mediaSource) {
- if (fs.existsSync(this.mediaSource) && fs.statSync(this.mediaSource).isDirectory()) {
- this.mediaDirectory = Path.join(event.outputDirectory, "media");
- copySync(this.mediaSource, this.mediaDirectory);
- } else {
- this.mediaDirectory = undefined;
- this.application.logger.warn("Could not find provided media directory: " + this.mediaSource);
- }
+ private getSlugger() {
+ if ("getSlugger" in this.owner.theme!) {
+ return (this.owner.theme as DefaultTheme).getSlugger(this.page!.model);
}
+ return getDefaultSlugger(this.application.logger);
}
/**
@@ -159,51 +217,56 @@ output file :
*
* @returns The options object for the markdown parser.
*/
- private createMarkedOptions(): Marked.marked.MarkedOptions {
- const markedOptions = (this.application.options.getValue("markedOptions") ?? {}) as Marked.marked.MarkedOptions;
-
- // Set some default values if they are not specified via the TypeDoc option
- markedOptions.highlight ??= (text, lang) => this.getHighlighted(text, lang);
-
- if (!markedOptions.renderer) {
- markedOptions.renderer = new Marked.Renderer();
-
- markedOptions.renderer.link = (href, title, text) => {
- // Prefix the #anchor links `#md:`.
- const target = href?.replace(/^#(?:md:)?(.+)/, "#md:$1") || undefined;
- return renderElement(
-
- ${code}
\n`;
+ }
+
+ return `${code}
\n`;
+ },
+ });
- markedOptions.mangle ??= false; // See https://github.com/TypeStrong/typedoc/issues/1395
+ const loader = this.application.options.getValue("markdownItLoader");
+ loader(this.parser);
- return markedOptions;
+ // Add anchor links for headings in readme, and add them to the "On this page" section
+ this.parser.renderer.rules["heading_open"] = (tokens, idx) => {
+ const token = tokens[idx];
+ const content = getTokenTextContent(tokens[idx + 1]);
+ const level = token.markup.length;
+
+ const slug = this.getSlugger().slug(content);
+ this.lastHeaderSlug = slug;
+
+ // Prefix the slug with an extra `md:` to prevent conflicts with TypeDoc's anchors.
+ this.page!.pageHeadings.push({
+ link: `#md:${slug}`,
+ text: content,
+ level,
+ });
+
+ return `<${token.tag} class="tsd-anchor-link">`;
+ };
+ this.parser.renderer.rules["heading_close"] = (tokens, idx) => {
+ return `${renderElement(anchorIcon(this.renderContext, `md:${this.lastHeaderSlug}`))}${tokens[idx].tag}>`;
+ };
+
+ // Rewrite anchor links inline in a readme file to links targeting the `md:` prefixed anchors
+ // that TypeDoc creates.
+ this.parser.renderer.rules["link_open"] = (tokens, idx, options, _env, self) => {
+ const token = tokens[idx];
+ const href = token.attrGet("href")?.replace(/^#(?:md:)?(.+)/, "#md:$1");
+ if (href) {
+ token.attrSet("href", href);
+ }
+ return self.renderToken(tokens, idx, options);
+ };
}
/**
@@ -212,29 +275,13 @@ output file :
* @param event
*/
onParseMarkdown(event: MarkdownEvent) {
- event.parsedText = Marked.marked(event.parsedText);
+ event.parsedText = this.parser!.render(event.parsedText);
}
}
-// Basically a copy/paste of Marked's code, with the addition of the button
-// https://github.com/markedjs/marked/blob/v4.3.0/src/Renderer.js#L15-L39
-function renderCode(this: Marked.marked.Renderer, code: string, infostring: string | undefined, escaped: boolean) {
- const lang = (infostring || "").match(/\S*/)![0];
- if (this.options.highlight) {
- const out = this.options.highlight(code, lang);
- if (out != null && out !== code) {
- escaped = true;
- code = out;
- }
+function getTokenTextContent(token: markdown.Token): string {
+ if (token.children) {
+ return token.children.map(getTokenTextContent).join("");
}
-
- code = code.replace(/\n$/, "") + "\n";
-
- if (!lang) {
- return `${escaped ? code : escapeHtml(code)}
\n`;
- }
-
- return `${
- escaped ? code : escapeHtml(code)
- }
\n`;
+ return token.content;
}
diff --git a/src/lib/output/themes/default/DefaultTheme.tsx b/src/lib/output/themes/default/DefaultTheme.tsx
index 972fa19a5..553936c8a 100644
--- a/src/lib/output/themes/default/DefaultTheme.tsx
+++ b/src/lib/output/themes/default/DefaultTheme.tsx
@@ -1,17 +1,18 @@
import { Theme } from "../../theme";
import type { Renderer } from "../../renderer";
import {
- Reflection,
ReflectionKind,
ProjectReflection,
- ContainerReflection,
+ type ContainerReflection,
DeclarationReflection,
+ type Reflection,
SignatureReflection,
ReflectionCategory,
ReflectionGroup,
TypeParameterReflection,
+ type DocumentReflection,
} from "../../../models";
-import { RenderTemplate, UrlMapping } from "../../models/UrlMapping";
+import { type RenderTemplate, UrlMapping } from "../../models/UrlMapping";
import type { PageEvent } from "../../events";
import type { MarkedPlugin } from "../../plugins";
import { DefaultThemeRenderContext } from "./DefaultThemeRenderContext";
@@ -49,6 +50,43 @@ export interface NavigationElement {
children?: NavigationElement[];
}
+/**
+ * Responsible for getting a unique anchor for elements within a page.
+ */
+export class Slugger {
+ private seen = new Map{item}
{" "}
- >
- ))}
- >
- );
+ return join(" ", allFlags, (item) => {item}
);
}
diff --git a/src/lib/output/themes/default/partials/footer.tsx b/src/lib/output/themes/default/partials/footer.tsx
index 0bca03947..137c80c6c 100644
--- a/src/lib/output/themes/default/partials/footer.tsx
+++ b/src/lib/output/themes/default/partials/footer.tsx
@@ -3,18 +3,49 @@ import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
export function footer(context: DefaultThemeRenderContext) {
const hideGenerator = context.options.getValue("hideGenerator");
- return (
-
{name}
-+ + {name} + {anchorIcon(context, anchor)} +
+