Skip to content

Instantly share code, notes, and snippets.

@tony
Last active August 28, 2022 16:43
Show Gist options
  • Save tony/05a3043d97d37c158763fb2f6a2d5392 to your computer and use it in GitHub Desktop.
Save tony/05a3043d97d37c158763fb2f6a2d5392 to your computer and use it in GitHub Desktop.
sphinxcontrib-issuetracker working as of sphinx 5.1.1, includes strict mypy typings (sphinx-doc with github style linking)

Autolink plain text issues in Sphinx

Smart linking of text issues w/ sphinx-doc, "GitHub" / "GitLab" / etc. style. No roles / without roles being required.

Original package / credit

https://github.com/ignatenkobrain/sphinxcontrib-issuetracker

StackOverflow post

https://stackoverflow.com/q/72424748/1396928

Problem

Projects like https://github.com/sloria/sphinx-issues require using docutils roles, e.g.

plain-old docutils / reStructuredText:

:issue:`1`

myst-parser:

{issue}`1`

So it won't render issues properly when viewing in GitHub / Gitlab / etc previews.

We need something that'll work in standard GitHub / GitLab / etc viewers

mypy users

Install:

You can use mypy --strict (tested as of mypy .971, released July 19, 2022)

import sys
from pathlib import Path
cwd = Path(__file__).parent
project_root = cwd.parent
sys.path.insert(0, str(project_root))
sys.path.insert(0, str(cwd / "_ext"))
extensions = [
"link_issues",
]
# issuetracker
issuetracker = "github"
issuetracker_project = "cihai/unihan-etl" # e.g. for https://github.com/cihai/unihan-etl
@tony
Copy link
Author

tony commented Aug 21, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment