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

Show source button #26

Closed
Evgenus opened this issue Aug 11, 2014 · 15 comments
Closed

Show source button #26

Evgenus opened this issue Aug 11, 2014 · 15 comments
Labels
enhancement Improved functionality

Comments

@Evgenus
Copy link

Evgenus commented Aug 11, 2014

Maybe it is not common case but I'd like to have ability of switching from documentation to source. Like this project do http://www.xperiments.io/TSDoc/docs/index.html

@sebastian-lenz
Copy link
Member

I've seen some doc tools that copy over the source code to the documentation, while others like TypeDoc don't do this. I'm personally not a big fan of this as it seems to me some kind of illogical to ship the source code with the documentation, but I'm pretty sure there are more guys who think like you.

I would like to focus on the new template and your other issues before starting on this one, so please give me some time before investigating this one.

@Evgenus
Copy link
Author

Evgenus commented Aug 11, 2014

As long as I know github (maybe other hubs do as well) supports highlighting part of the file. typedoc could generate automatic link to github published repository. In that case no copying is necessary. Of course this feature should be optional.

@sebastian-lenz
Copy link
Member

Clever. I like this idea!

@sebastian-lenz
Copy link
Member

I've added support for automatic GitHub discovery with this commit. If TypeDoc detects a GitHub repository, the file names in the documentation are linked to the related GitHub pages.

@Evgenus
Copy link
Author

Evgenus commented Aug 31, 2014

It somehow doesn't work for me. I guess your pattern for matching urls is not valid in my case.

$ git ls-remote --get-url
https://github.com/Evgenus/bigint-typescript-definitions

I'm hosting it at http://evgenus.github.io/bigint-typescript-definitions/

@sebastian-lenz
Copy link
Member

Hmpf, I actually tested it against your repository but I did not take HTTP urls into concern. I've changed the regular expression for detecting GitHup repositories to this one:

/github\.com[:\/]([^\/]+)\/(.*?)\.git/

@sebastian-lenz
Copy link
Member

Why is your url not ending on .git?

@Evgenus
Copy link
Author

Evgenus commented Aug 31, 2014

I don't know. Somehow it works that way too. I'm using SourceTree to manage my repositories.
Try https://www.debuggex.com/ it helps me a lot with regexes.

@sebastian-lenz
Copy link
Member

Okay, haven't been aware of this either. But I think we can just hardcode this one...

url = /github\.com[:\/]([^\/]+)\/(.*)/.exec(remotes[i]);
if (url) {
  this.gitHubProject = url[2];
  if (this.gitHubProject.substr(-4) == '.git') {
    this.gitHubProject = this.gitHubProject.substr(0, this.gitHubProject.length - 4);
  }
}

@Evgenus
Copy link
Author

Evgenus commented Aug 31, 2014

now it works. thanks

@sebastian-lenz
Copy link
Member

Cool! I really like this new feature, I've already used it on TypeDoc and it is a great improvement. Thank you very much for this idea!

By the way, did you try --theme minimal?

@Evgenus
Copy link
Author

Evgenus commented Sep 1, 2014

Minimal theme is even better for single module projects (and for definitions as well), because it leads directly into documentation. I will use it from now on. Default theme have a bit confusing main page.

I guess you can close this issue.

@Evgenus
Copy link
Author

Evgenus commented Sep 13, 2014

About github url. I've recently mentioned that a lot of people taking this as a problem. Check out this list https://www.npmjs.org/search?q=github%20url .

@sebastian-lenz
Copy link
Member

Interesting, thanks for sharing this. I've looked over the first modules but they don't seem to do what we need. Anyway, as the current solutions seems to work lets stick to that one. If any other problems arise, I'll check back on those modules.

As you suggested, I'll close this issue. The feature will be available with the next release.

@Spiralis
Copy link

Is there a way to force the documentation links to use i.e. master instead of the commit-id? The thing is that this means that for every github commit-change I have to include the docs in the commit too, even if all the docs are otherwise identical.

For example, this link: https://github.com/IntelliSearch/search-client/blob/f912698/src/AllCategories/AllCategories.ts#L19
depends on that commit to have been executed. Now, if I was hosting live docs for every version, then that would be fine. But, I am only hosting live docs for the latest version. Meaning that if the link instead was to master (which is my, and probably others' main branch too), then it would work and regenerating docs for newer commits could have the same results.

Actually, right now, the above blob/f912698/ link doesn't work as I dropped updating the source, since there were no changes. I since then realised that doing so meant that the links will not work.

But, this link using master works fine: https://github.com/IntelliSearch/search-client/blob/master/src/AllCategories/AllCategories.ts#L19

So, all I am asking is if there is a way to tell the typedoc generator to use the branch name instead of the commit when generating the paths?

lddubeau pushed a commit to lddubeau/typedoc that referenced this issue Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality
Projects
None yet
Development

No branches or pull requests

3 participants