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

"go to this page in repository" button #930

Open
cranmer opened this issue Sep 1, 2020 · 3 comments
Open

"go to this page in repository" button #930

cranmer opened this issue Sep 1, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@cranmer
Copy link

cranmer commented Sep 1, 2020

Is your feature request related to a problem? Please describe.

I wish there was a button that would go to the corresponding file in the repository

Describe the solution you'd like

Either a new configuration option like use_go_to_page_in_repo_button: true that can be used in _config.yml like this:

  home_page_in_navbar : true
  use_repository_button: true
  use_issues_button: true
  use_edit_page_button: true
  use_go_to_page_in_repo_button: true

Describe alternatives you've considered

A flag that makes "edit page" "go to page"

Change default behavior of "repository" / use_repository_button to point to the corresponding source page.

Additional context

For content creators it is very nice to see the source of another book to see "how'd they do that!?". Currently there isn't a convenient way to find the corresponding source page:

  • The "repository" / use_repository_button goes to the source repository, but then one has to find the corresponding file, which is often not obvious.
  • The "suggest edit" / use_edit_page_button knows where the corresponding source is, but you won't see it unless you have already forked the repo (which most people haven't), so if you click it it will prompt you to fork the repo, which isn't what you want to do if you just want to see the source.
@cranmer cranmer added the enhancement New feature or request label Sep 1, 2020
@choldgraf
Copy link
Member

interesting idea - and just to clarify, you don't think it's enough to be able to download the source file directly? I think we hadn't implemented this just because people can click the download button to see the raw markdown/ipynb/etc that way.

@cranmer
Copy link
Author

cranmer commented Sep 1, 2020

Well embarrassingly that didn't occur to me :-) I associated that with PDF download or getting the .ipynb to run locally and the buttons under the GitHub icon with the source. I'm thinking now about the functionality of the download button since it does address what I want in some way.

Cons:

  • I do often prefer to be able to browse the source on GitHub (since I might be on a phone, tablet, a computer that doesn't have a nice editor, etc.) and because from there I can do all the things the GitHub UI provides
  • I can use "open in a new tab" to see the text in a browser, though that takes me to the raw, static version (no syntax on the site that lacks the extra functionality of GitHub
  • Most importantly, the location of the download link is <SITE_URL>/_sources/nbgrader.md, so if you are trying to understand how the book is put together in terms of _toc.yml, the source directory structure, and the target _build directory the repository source is more useful than the target html after building the book.

@choldgraf
Copy link
Member

I think it makes sense to add something like this optionally, something like "go to source" in github. The templates for that are here:

https://github.com/executablebooks/sphinx-book-theme/blob/master/sphinx_book_theme/topbar/repobuttons.html

So I think that's where the code would go, and then we'd just need to add support for the extra configuration value.

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

No branches or pull requests

2 participants