A `:github:` role for Sphinx

Overview

sphinx-github-role

Documentation Status Code style: black

A github role for Sphinx.

Usage

Basic usage

MyST:

:caption: index.md
See {github}`astrojuanlu/sphinx-github-role#1`.

reStructuredText:

:caption: index.rst
See :github:`astrojuanlu/sphinx-github-role#1`.

Configuring a default organization and project

The extension accepts a configuration github_default_org_project that can be a tuple ("default_org", "default_project") to save some typing. For example, with this configuration:

:caption: conf.py
github_default_org_project = ("astrojuanlu", None)

you can type this:

:caption: index.md
See {github}`sphinx-github-role#1`.

and with this configuration:

:caption: conf.py
github_default_org_project = ("astrojuanlu", "sphinx-github-role")

you only need to type this:

:caption: index.md
See {github}`#1`.

Customizing link text

You can also customize the link text, by wrapping the target in angle brackets:

:caption: index.md
See {github}`this issue <#1>`.

Contribute

Feel free to open an issue to report problems or suggest new features!

Comments
  • Using in RST: Unknown interpreted text role

    Using in RST: Unknown interpreted text role "github".

    Hi there, having seen your recent tweet I wanted to give this package (thanks for developing it!) a shot at https://github.com/autoreject/autoreject/pull/251.

    I did the following:

    • pip-installed sphinx-github-role in my doc build job
    • added the following to my conf.py: github_default_org_project = ("autoreject", "autoreject")
    • used the following syntax in my changelog:
    :github:`#225`
    

    Yet, the rendered docs look broken.

    And the build log gives me an error:

    Using in RST: Unknown interpreted text role "github".

    Can you see what's going wrong? Is that some user error of mine? Or something with sphinx-github-role?

    bug documentation 
    opened by sappelhoff 2
  • Extend the role to allow linking to entire repos

    Extend the role to allow linking to entire repos

    Fixes #17

    This implements the change I described in #17.

    There was one required change to an existing test, since what was previously a malformed link now could now be a reference to a GitHub repository. This has produced a different failure message.

    I've not spent a ton of time working with Python projects before, so let me know if there's anything you'd like changed.

    opened by zml2008 1
  • Support linking directly to projects without an issue

    Support linking directly to projects without an issue

    I'd like to use this role to be able to link directly to GitHub projects, rather than just to specific issues within the projects.

    For example:

    :github:`astrojuanlu/sphinx-github-role`
    

    would link to this repository, without requiring an issue to be specified.

    I'm documenting a project with different components across a variety of repositories, so a shorthand syntax for referencing specific repositories would be helpful.

    enhancement 
    opened by zml2008 1
  • Allow link text change

    Allow link text change

    In the same way that folks can do

    {ref}`doc`
    {ref}`My document <doc>`
    

    it would be cool if we could allow

    {github}`#13`
    {github}`PR #13 <#13>`
    
    enhancement 
    opened by astrojuanlu 0
  • Misc followup from twitter.

    Misc followup from twitter.

    1. docs don't seem to have easy link back to github.

    2. Do you think that non-github / gitlab will be a potential extensions, so you can just do :issue:`#31` regardless of the vcs, and this leads to

    3. Do you believe there could be a project mapping org -> github|gitlab, so that :issue:`projongithub#31` and :issue:`projongitlab#31`

    4. which is not dependent of previous ones, I'd love to have some standardization and use the same extensions on many projects of the scientific ecosystem, and I can try to replace the one we use in IPython when you belive this is ready enough.

    documentation enhancement 
    opened by Carreau 4
  • Float social media previews?

    Float social media previews?

    Wouldn't it be cool if we could show a modal or tooltip with these cool social media previews?

    Screenshot 2021-11-21 at 17-31-23 Card Validator Twitter Developers

    (source: https://cards-dev.twitter.com/validator)

    Content:

    <meta name="twitter:image:src" content="https://opengraph.githubassets.com/d0b6e212f5531e99b4deb14274afa748ddb99ff75bc5d1d8e28d1034ffa2e62d/poliastro/poliastro/pull/1184" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="Move flyby computation to core by Yash-10 · Pull Request #1184 · poliastro/poliastro" /><meta name="twitter:description" content="This PR tries to move computations for threebody flybys to core.
    Thanks!" />
    

    pinging @humitos as my local sphinx-hoverxref expert, and @choldgraf because I've seen you mention this topic a few times on Twitter

    enhancement 
    opened by astrojuanlu 9
  • Disambiguate URL

    Disambiguate URL

    The cool thing about the current approach is that URLs with /issues redirect to /pull if the ID corresponds to a pull request. See it in action:

    https://github.com/astrojuanlu/sphinx-github-role/issues/2 (https://github.com/astrojuanlu/sphinx-github-role/issues/2)

    However, it might "look bad" to have these URLs pointing to issues that are, in fact, pull requests. To my knowledge, the only way to disambiguate this is to make an API call:

    $ curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/astrojuanlu/sphinx-github-role/issues/2 | jq '.["pull_request"]["html_url"]'
    "https://github.com/astrojuanlu/sphinx-github-role/pull/2"
    $ curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/astrojuanlu/sphinx-github-role/issues/4 | jq '.["pull_request"]["html_url"]'
    null
    

    I wonder if it's worth the hassle?

    Pros:

    • Always uses correct-looking URL

    Cons:

    • Can be slow
    • Can be unreliable
    • Might be rate-limited
    • Might require an API key
    question 
    opened by astrojuanlu 0
Releases(v0.1.0)
Owner
Juan Luis Cano Rodríguez
Open Knowledge + Radical Transparency
Juan Luis Cano Rodríguez
Showing potential issues with merge strategies

Showing potential issues with merge strategies Context There are two branches in this repo: main and a feature branch feat/inverting-method (not the b

Rubén 2 Dec 20, 2021
[Unofficial] Python PEP in EPUB format

PEPs in EPUB format This is a unofficial repository where I stock all valid PEPs in the EPUB format. Repository Cloning git clone --recursive Mickaël Schoentgen 9 Oct 12, 2022

Members: Thomas Longuevergne Program: Network Security Course: 1DV501 Date of submission: 2021-11-02

Mini-project report Members: Thomas Longuevergne Program: Network Security Course: 1DV501 Date of submission: 2021-11-02 Introduction This project was

1 Nov 08, 2021
This programm checks your knowlege about the capital of Japan

Introduction This programm checks your knowlege about the capital of Japan. Now, what does it actually do? After you run the programm you get asked wh

1 Dec 16, 2021
NetBox plugin for BGP related objects documentation

Netbox BGP Plugin Netbox plugin for BGP related objects documentation. Compatibility This plugin in compatible with NetBox 2.10 and later. Installatio

Nikolay Yuzefovich 133 Dec 27, 2022
Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.

Introduction Swagger UI allows anyone — be it your development team or your end consumers — to visualize and interact with the API’s resources without

Swagger 23.2k Dec 29, 2022
Python Eacc is a minimalist but flexible Lexer/Parser tool in Python.

Python Eacc is a parsing tool it implements a flexible lexer and a straightforward approach to analyze documents.

Iury de oliveira gomes figueiredo 60 Nov 16, 2022
A set of Python libraries that assist in calling the SoftLayer API.

SoftLayer API Python Client This library provides a simple Python client to interact with SoftLayer's XML-RPC API. A command-line interface is also in

SoftLayer 155 Sep 20, 2022
Python solutions to solve practical business problems.

Python Business Analytics Also instead of "watching" you can join the link-letter, it's already being sent out to about 90 people and you are free to

Derek Snow 357 Dec 26, 2022
EasyModerationKit is an open-source framework designed to moderate and filter inappropriate content.

EasyModerationKit is a public transparency statement. It declares any repositories and legalities used in the EasyModeration system. It allows for implementing EasyModeration into an advanced charact

Aarav 1 Jan 16, 2022
Seamlessly integrate pydantic models in your Sphinx documentation.

Seamlessly integrate pydantic models in your Sphinx documentation.

Franz Wöllert 71 Dec 26, 2022
Loudchecker - Python script to check files for earrape

loudchecker python script to check files for earrape automatically installs depe

1 Jan 22, 2022
A simple USI Shogi Engine written in python using python-shogi.

Revengeshogi My attempt at creating a USI Shogi Engine in python using python-shogi. Current State of Engine Currently only generating random moves us

1 Jan 06, 2022
Deduplicating archiver with compression and authenticated encryption.

More screencasts: installation, advanced usage What is BorgBackup? BorgBackup (short: Borg) is a deduplicating backup program. Optionally, it supports

BorgBackup 9k Jan 09, 2023
Variable Transformer Calculator

✠ VASCO - VAriable tranSformer CalculatOr Software que calcula informações de transformadores feita para a matéria de "Conversão Eletromecânica de Ene

Arthur Cordeiro Andrade 2 Feb 12, 2022
A repository of links with advice related to grad school applications, research, phd etc

A repository of links with advice related to grad school applications, research, phd etc

Shaily Bhatt 946 Dec 30, 2022
A powerful Sphinx changelog-generating extension.

What is Releases? Releases is a Python (2.7, 3.4+) compatible Sphinx (1.8+) extension designed to help you keep a source control friendly, merge frien

Jeff Forcier 166 Dec 29, 2022
Run `black` on python code blocks in documentation files

blacken-docs Run black on python code blocks in documentation files. install pip install blacken-docs usage blacken-docs provides a single executable

Anthony Sottile 460 Dec 23, 2022
layout-parser 3.4k Dec 30, 2022
A Python package develop for transportation spatio-temporal big data processing, analysis and visualization.

English 中文版 TransBigData Introduction TransBigData is a Python package developed for transportation spatio-temporal big data processing, analysis and

Qing Yu 251 Jan 03, 2023