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

Customization options for bitbucket, gitlab, and github are undocumented #465

Open
jpsenior opened this issue Sep 16, 2017 · 6 comments
Open
Assignees
Labels
Good First Issue Good for new contributors Needed: documentation Documentation is required
Milestone

Comments

@jpsenior
Copy link
Contributor

I had to search the source-code to learn of the existence of these options for 'edit page' links. These should be documented properly with descriptions of their usages.

@Blendify
Copy link
Member

Yeah I need to write some documentation.

@Blendify Blendify self-assigned this Sep 16, 2017
@Blendify Blendify added the Needed: documentation Documentation is required label Sep 16, 2017
This was referenced Feb 1, 2018
@agjohnson agjohnson added this to the v0.4.0 milestone Mar 29, 2018
@agjohnson agjohnson modified the milestones: v0.4.0, 0.5 Jun 7, 2018
@peterjc
Copy link

peterjc commented Aug 14, 2019

Based on #231 (comment) from @IKavanagh (thank you!), you can do the following in your conf.py file:

html_context = {
  "display_github": True, # Add 'Edit on Github' link instead of 'View page source'
  "github_user": "peterjc",
  "github_repo": project,  # assuming an exact match
  "github_version": "master",
  "conf_py_path": "/doc/", # needs leading and trailing slashes!
  # "source_suffix": source_suffix,
}

I've not explored why conf_py_path is called that, but it seems to be the relative path from the GitHub repository root to your documentation folder (where conf.py lives etc), and it needs leading and trailing slashes.

I have not needed to set source_suffix myself yet.

e.g. peterjc/thapbi-pict@9ec5300

If you need to over-ride this in any particular *.rst files, for example automatically generated ones which are not in GitHub, they need a line like the following added at the start:

:github_url: https://github.com/peterjc/...

e.g. peterjc/thapbi-pict@f14b1df does this via a function in conf.py

@agjohnson agjohnson modified the milestones: 0.5, 0.6 May 3, 2020
ax3l added a commit to snowmass-compf2-accbeammodel/snowmass-compf2-accbeammodel.github.io that referenced this issue Jul 10, 2020
@cglacet
Copy link

cglacet commented Sep 10, 2020

The example show here does seem to work fine for gitlab, on the other hand it doesn't open the edit view but rather the main view, is that normal?

@stsewd
Copy link
Member

stsewd commented Oct 8, 2020

@cglacet you can customize that with the vcs_pageview_mode option (defaults to blob for gitlab, but currently is broken #1010

@thompol
Copy link

thompol commented May 5, 2022

What would be the config for GitLab users?

EDIT: I figured it out by looking at the source code. This is it:

html_context = {
  'display_gitlab': True,
  'gitlab_host': 'git.example.com',
  'gitlab_user': 'example',
  'gitlab_repo': 'example,
  'gitlab_version': 'master/',
}

@jreed1701
Copy link

While on the subject, the URL for bitbucket is hardcoded to be "bitbucket.org"

{%- elif display_bitbucket %}
{%- if check_meta and 'bitbucket_url' in meta %}
<!-- User defined Bitbucket URL -->
<a href="{{ meta['bitbucket_url'] }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
{%- else %}
<a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ page_source_suffix }}?mode={{ theme_vcs_pageview_mode or "view" }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
{%- endif %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good for new contributors Needed: documentation Documentation is required
Projects
None yet
Development

No branches or pull requests

9 participants