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
Autolookup GUI Plugin for Plover

Word Tray for Plover Word Tray is a GUI plugin that automatically looks up efficient outlines for words that start with the current input, much like a

Kathy 3 Jun 08, 2022
Docov - Light-weight, recursive docstring coverage analysis for python modules

docov Light-weight, recursive docstring coverage analysis for python modules. Ov

Richard D. Paul 3 Feb 04, 2022
Mayan EDMS is a document management system.

Mayan EDMS is a document management system. Its main purpose is to store, introspect, and categorize files, with a strong emphasis on preserving the contextual and business information of documents.

3 Oct 02, 2021
Sphinx Bootstrap Theme

Sphinx Bootstrap Theme This Sphinx theme integrates the Bootstrap CSS / JavaScript framework with various layout options, hierarchical menu navigation

Ryan Roemer 584 Nov 16, 2022
A collection and example code of every topic you need to know about in the basics of Python.

The Python Beginners Guide: Master The Python Basics Tonight This guide is a collection of every topic you need to know about in the basics of Python.

Ahmed Baari 1 Dec 19, 2021
A Python library that simplifies the extraction of datasets from XML content.

xmldataset: simple xml parsing 🗃️ XML Dataset: simple xml parsing Documentation: https://xmldataset.readthedocs.io A Python library that simplifies t

James Spurin 75 Dec 30, 2022
Swagger Documentation Generator for Django REST Framework: deprecated

Django REST Swagger: deprecated (2019-06-04) This project is no longer being maintained. Please consider drf-yasg as an alternative/successor. I haven

Marc Gibbons 2.6k Jan 03, 2023
More detailed upload statistics for Nicotine+

More Upload Statistics A small plugin for Nicotine+ 3.1+ to create more detailed upload statistics. ⚠ No data previous to enabling this plugin will be

Nick 1 Dec 17, 2021
An introduction to hikari, complete with different examples for different command handlers.

An intro to hikari This repo provides some simple examples to get you started with hikari. Contained in this repo are bots designed with both the hika

Ethan Henderson 18 Nov 29, 2022
Markdown documentation generator from Google docstrings

mkgendocs A Python package for automatically generating documentation pages in markdown for Python source files by parsing Google style docstring. The

Davide Nunes 44 Dec 18, 2022
MonsterManualPlus - An advanced monster manual for Tower of the Sorcerer.

Monster Manual + This is an advanced monster manual for Tower of the Sorcerer mods. Users can get a plenty of extra imformation for decision making wh

Yifan Zhou 1 Jan 01, 2022
📚 Papers & tech blogs by companies sharing their work on data science & machine learning in production.

applied-ml Curated papers, articles, and blogs on data science & machine learning in production. ⚙️ Figuring out how to implement your ML project? Lea

Eugene Yan 22.1k Jan 03, 2023
Gtech μLearn Sample_bot

Ser_bot Gtech μLearn Sample_bot Do Greet a newly joined member in a channel (random message) While adding a reaction to a message send a message to a

Jerin Paul 1 Jan 19, 2022
Poetry plugin to export the dependencies to various formats

Poetry export plugin This package is a plugin that allows the export of locked packages to various formats. Note: For now, only the requirements.txt f

Poetry 90 Jan 05, 2023
:blue_book: Automatic documentation from sources, for MkDocs.

mkdocstrings Automatic documentation from sources, for MkDocs. Features Python handler features Requirements Installation Quick usage Features Languag

Timothée Mazzucotelli 1.1k Dec 31, 2022
python package sphinx template

python-package-sphinx-template python-package-sphinx-template

Soumil Nitin Shah 2 Dec 26, 2022
Collections of Beautiful Latex Snippets

HandyLatex Collections of Beautiful Latex Snippets Table 👉 Succinct table with bold separation line and gray text %################## Dependencies ##

Xintao 15 Apr 11, 2022
AiiDA plugin for the HyperQueue metascheduler.

aiida-hyperqueue WARNING: This plugin is still in heavy development. Expect bugs to pop up and the API to change. AiiDA plugin for the HyperQueue meta

AiiDA team 3 Jun 19, 2022
Pydocstringformatter - A tool to automatically format Python docstrings that tries to follow recommendations from PEP 8 and PEP 257.

Pydocstringformatter A tool to automatically format Python docstrings that tries to follow recommendations from PEP 8 and PEP 257. See What it does fo

Daniël van Noord 31 Dec 29, 2022
freeCodeCamp Scientific Computing with Python Project for Certification.

Polygon_Area_Calculator freeCodeCamp Python Project freeCodeCamp Scientific Computing with Python Project for Certification. In this project you will

Rajdeep Mondal 1 Dec 23, 2021