Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sourceLinkTemplate option is not supported #617

Closed
haroldadmin opened this issue May 15, 2024 · 2 comments
Closed

sourceLinkTemplate option is not supported #617

haroldadmin opened this issue May 15, 2024 · 2 comments

Comments

@haroldadmin
Copy link

What package is the bug related to?

typedoc-plugin-markdown

Describe the issue

I use this plugin with typedoc in a monorepo with 50 packages to generate API reference docs for them. The API reference is generated in PRs, and deployed on each push to the main branch.

For each symbol in the generated docs, this plugin emits source links for them pointing to Github. The link includes the commit hash, which changes with each commit. This causes PRs to have massive diffs, just because the commit hash changed.

I want to work around this behaviour with the sourceLinkTemplate option. I want to use a template that points to the main branch instead of the latest commit hash (e.g. https://github.com/<org>/<repo>/blob/main/{path}#line={line}).

The plugin does not seem to respect this option. Can we please fix this behaviour?

TypeDoc configuration

{
  "$schema": "https://typedoc-plugin-markdown.org/schema.json",
  "entryPoints": ["packages/*"],
  "entryPointStrategy": "packages",
  "includeVersion": false,
  "cleanOutputDir": true,
  "out": "./apps/docs/src/pages/api-reference",
  "plugin": ["typedoc-plugin-markdown"],
  "hideBreadcrumbs": true,
  "hidePageHeader": true,
  "entryFileName": "index",
  "sourceLinkTemplate": "https://github.com/<org-name>/<repo-name>/blob/main/{path}#line={line}"
}

Expected behavior

The generated source link should respect the supplied template.

@haroldadmin haroldadmin added the bug Issue raised as a bug. label May 15, 2024
@tgreyuk
Copy link
Member

tgreyuk commented May 15, 2024

Hello. This is more of a TypeDoc question that a plugin question, however this is supported but the config needs to be set in the config file for each package. TypeDoc 0.26 will be introducing a packageOptions option to address this very issue. TypeStrong/typedoc#2523

@tgreyuk tgreyuk removed the bug Issue raised as a bug. label May 15, 2024
@haroldadmin
Copy link
Author

Thanks! Adding config at the package level fixed my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants