gdelmas / typedoc-plugin-sourcefile-url

typedoc plugin to set custom source file URL links
MIT License
23 stars 17 forks source link

Configurable line number reference in link. #3

Open ZaneMiller opened 7 years ago

ZaneMiller commented 7 years ago

Currently the line number of a type definition is hard coded to be #L{line-number} in the generated URL. This should be able to be configured either on the command-line or in the configuration JSON to support source browsers that expect this information in a different URL format.

gdelmas commented 7 years ago

can you give some source browser examples?

ZaneMiller commented 7 years ago

Stash for example expects the line number as a hash with no extra information, i.e. http://my-stash-instance.com/projects/foo/repos/bar/browse/src/file.ts#25

However I can see many potential use cases where the format would not include a hash but rather a query parameter (my-repo.com/src/file.ts?line=25) or even as part of the URL (my-repo.com/src/file.ts/25).

I would see this working in the JSON configuration using a replacement pattern:

// config.json
{
   "pattern": "^modules/module-one",
   "replace": "https://www.your-repository.org/${fileName}#${lineNumber}"
}

This would allow for greater flexibility when doing replacements to cover a wider range of use cases.

brandonkal commented 5 years ago

VSCode uses a different format. It would be really neat to support this for local documentation.

vscode://file/{full_fs_path_to_src}/{local_path}:{line_number}

Since full_fs_path_to_src is likely to change between users, it would be really neat to have both a repository link and a "view in editor" link.