Skip to content

About

Pull reST and MyST source from GitHub into your Sphinx project.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

This extension was written by a Sphinx development agent.

sphinx-github-include

sphinx-github-include adds a Sphinx directive for including content directly from GitHub repositories using the format owner/repo:path.

Basic usage

Include and parse RST or Markdown content:

.. github-include:: sphinx-doc/sphinx:README.rst
   :branch: master
   :start-line: 21
   :end-line: 25

Display code with syntax highlighting using :code::

.. github-include:: python/cpython:Lib/this.py
   :code: python
   :number-lines:

Display literal text using :literal::

.. github-include:: github/gitignore:Python.gitignore
   :literal:

Specify a version with :branch:, :tag:, or :commit: (defaults to main):

.. github-include:: owner/repo:path/to/file.py
   :tag: v1.0.0

Filter lines with :start-line:, :end-line:, :start-after:, or :end-before::

.. github-include:: owner/repo:example.py
   :start-line: 10
   :end-line: 50

Project setup

Install via pip:

pip install sphinx-github-include

Add to your conf.py:

extensions = [
    "sphinx_github_include"
]

Community and support

Report issues on the GitHub repository.

sphinx-github-include is covered by the Ubuntu Code of Conduct.

License and copyright

sphinx-github-include is released under the GPL-3.0 license.

About

Pull reST and MyST source from GitHub into your Sphinx project.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages