sphinx-github-style


Namesphinx-github-style JSON
Version 1.2.1 PyPI version JSON
download
home_pagehttps://github.com/tdkorn/sphinx-github-style
SummaryGitHub source code links and syntax highlighting for Sphinx documentation
upload_time2024-04-07 11:31:10
maintainerNone
docs_urlNone
authorAdam Korn
requires_pythonNone
licenseMIT License
keywords sphinx sphinx-extension sphinx-theme pygments pygments-style github linkcode
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. |.add_linkcode_class+styled with CSS| replace:: styled with CSS
.. _.add_linkcode_class+styled with CSS: https://sphinx-github-style.readthedocs.io/en/latest/add_linkcode_class.html
.. |.~.get_linkcode_resolve| replace:: get_linkcode_resolve()
.. _.~.get_linkcode_resolve: https://sphinx-github-style.readthedocs.io/en/latest/linkcode.html#sphinx_github_style.utils.linkcode.get_linkcode_resolve
.. |.linkcode_blob| replace:: linkcode_blob
.. _.linkcode_blob: https://sphinx-github-style.readthedocs.io/en/latest/index.html#confval-linkcode_blob
.. |.linkcode_link_text| replace:: linkcode_link_text
.. _.linkcode_link_text: https://sphinx-github-style.readthedocs.io/en/latest/index.html#confval-linkcode_link_text
.. |.linkcode_resolve| replace:: linkcode_resolve
.. _.linkcode_resolve: https://sphinx-github-style.readthedocs.io/en/latest/index.html#confval-linkcode_resolve
.. |.linkcode_url| replace:: linkcode_url
.. _.linkcode_url: https://sphinx-github-style.readthedocs.io/en/latest/index.html#confval-linkcode_url
.. |.sphinx+html_context| replace:: html_context
.. _.sphinx+html_context: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_context
.. |.sphinx.ext.linkcode| replace:: sphinx.ext.linkcode
.. _.sphinx.ext.linkcode: https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html#module-sphinx.ext.linkcode
.. |.sphinx.ext.viewcode| replace:: sphinx.ext.viewcode
.. _.sphinx.ext.viewcode: https://www.sphinx-doc.org/en/master/usage/extensions/viewcode.html#module-sphinx.ext.viewcode


..  Title: Sphinx Github Style
..  Description: A Sphinx extension to add GitHub source code links and syntax highlighting
..  Author: TDKorn (Adam Korn)

.. meta::
   :title: Sphinx Github Style
   :description: A Sphinx extension to add GitHub source code links and syntax highlighting


sphinx-github-style - GitHub source code links and syntax highlighting for Sphinx documentation
-------------------------------------------------------------------------------------------------

.. image:: https://raw.githubusercontent.com/TDKorn/sphinx-github-style/v1.2.1/docs/source/_static/logo_pypi.png
   :alt: Sphinx GitHub Style: GitHub Integration and Pygments Style for Sphinx Documentation
   :width: 50%
   :align: center












GitHub source code links and syntax highlighting for Sphinx documentation


.. |docs| replace:: **Explore the docs ยป**
.. _docs: https://sphinx-github-style.readthedocs.io/en/latest/

|docs|_

|


.. image:: https://img.shields.io/pypi/v/sphinx-github-style?color=eb5202
   :target: https://pypi.org/project/sphinx-github-style/
   :alt: PyPI Version

.. image:: https://img.shields.io/badge/GitHub-sphinx--github--style-4f1abc
   :target: https://github.com/tdkorn/sphinx-github-style/
   :alt: GitHub Repository

.. image:: https://static.pepy.tech/personalized-badge/sphinx-github-style?period=total&units=none&left_color=grey&right_color=blue&left_text=Downloads
    :target: https://pepy.tech/project/sphinx-github-style/

.. image:: https://readthedocs.org/projects/sphinx-github-style/badge/?version=latest
    :target: https://sphinx-github-style.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status



|

About
~~~~~~~~~~~~~

``sphinx-github-style`` is a Sphinx extension that links your documentation to GitHub source code.
It also adds syntax highlighting for code blocks similar to GitHub's pretty lights dark theme.

...


GitHub Source Code Links
===============================


Using |.sphinx.ext.linkcode|_,  a ``View on GitHub`` link is added to the documentation of every class, method, function, and property:

|



.. image:: https://raw.githubusercontent.com/TDKorn/sphinx-github-style/v1.2.1/docs/source/_static/github_link.png
   :alt: sphinx-github-style adds a "View on GitHub" link


They link to and highlight the corresponding code block in your GitHub repository:

|

.. image:: https://raw.githubusercontent.com/TDKorn/sphinx-github-style/v1.2.1/docs/source/_static/github_linked_code.png
   :alt: The linked corresponding highlighted source code block on GitHub



.. list-table::
   :header-rows: 1
   
   * - ๐Ÿ“ Note
   * - These links can be |.add_linkcode_class+styled with CSS|_ and used with/instead
       of the links added by |.sphinx.ext.viewcode|_



Syntax Highlighting
====================

``sphinx-github-style`` also contains a ``Pygments`` style to highlight code blocks similar to GitHub:



.. image:: https://raw.githubusercontent.com/TDKorn/sphinx-github-style/v1.2.1/docs/source/_static/syntax_highlighting.png
   :alt: A code block highlighted by the Pygments style. It looks identical to GitHub.



Installation
~~~~~~~~~~~~~~~~

To install using ``pip``::

 pip install sphinx-github-style


Configuration
~~~~~~~~~~~~~~~

Add the extension to your ``conf.py``

.. code-block:: python

   extensions = [
       "sphinx_github_style",
   ]

Optional Configuration Variables
===================================

Add any (or none) of the following configuration variables to your ``conf.py``




|.linkcode_blob|_
 The blob to link to on GitHub - any of ``"head"``, ``"last_tag"``, or ``"{blob}"``

  **Type:** ``str``

  **Default:** ``"head"``

 * ``"head"`` (default): links to the most recent commit hash; if this commit is tagged, uses the tag instead
 * ``"last_tag"``: links to the most recent commit tag on the currently checked out branch
 * ``"blob"``: links to any blob you want, for example ``"master"`` or ``"v2.0.1"``

|

|.linkcode_url|_
 The link to your GitHub repository formatted as ``https://github.com/user/repo``

  **Type:** ``str``

  **Default:** ``f"https://github.com/{html_context['github_user']}/{html_context['github_repo']}/{html_context['github_version']}"``

 * If not provided, will attempt to create the link from the |.sphinx+html_context|_ dict

|

|.linkcode_link_text|_
 The text to use for the linkcode link

  **Type:** ``str``

  **Default:** ``"View on GitHub"``

|

|.linkcode_resolve|_
 A ``linkcode_resolve()`` function to use when resolving the link target with |.sphinx.ext.linkcode|_

  **Type:** ``Callable``

  **Default:** Return value from |.~.get_linkcode_resolve|_





            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tdkorn/sphinx-github-style",
    "name": "sphinx-github-style",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "sphinx, sphinx-extension, sphinx-theme, pygments, pygments-style, github, linkcode",
    "author": "Adam Korn",
    "author_email": "hello@dailykitten.net",
    "download_url": "https://files.pythonhosted.org/packages/02/03/dd68d753d53313a86a16e4089a737b67690f013a96ba6e1538f5e52e552e/sphinx-github-style-1.2.1.tar.gz",
    "platform": null,
    "description": ".. |.add_linkcode_class+styled with CSS| replace:: styled with CSS\n.. _.add_linkcode_class+styled with CSS: https://sphinx-github-style.readthedocs.io/en/latest/add_linkcode_class.html\n.. |.~.get_linkcode_resolve| replace:: get_linkcode_resolve()\n.. _.~.get_linkcode_resolve: https://sphinx-github-style.readthedocs.io/en/latest/linkcode.html#sphinx_github_style.utils.linkcode.get_linkcode_resolve\n.. |.linkcode_blob| replace:: linkcode_blob\n.. _.linkcode_blob: https://sphinx-github-style.readthedocs.io/en/latest/index.html#confval-linkcode_blob\n.. |.linkcode_link_text| replace:: linkcode_link_text\n.. _.linkcode_link_text: https://sphinx-github-style.readthedocs.io/en/latest/index.html#confval-linkcode_link_text\n.. |.linkcode_resolve| replace:: linkcode_resolve\n.. _.linkcode_resolve: https://sphinx-github-style.readthedocs.io/en/latest/index.html#confval-linkcode_resolve\n.. |.linkcode_url| replace:: linkcode_url\n.. _.linkcode_url: https://sphinx-github-style.readthedocs.io/en/latest/index.html#confval-linkcode_url\n.. |.sphinx+html_context| replace:: html_context\n.. _.sphinx+html_context: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_context\n.. |.sphinx.ext.linkcode| replace:: sphinx.ext.linkcode\n.. _.sphinx.ext.linkcode: https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html#module-sphinx.ext.linkcode\n.. |.sphinx.ext.viewcode| replace:: sphinx.ext.viewcode\n.. _.sphinx.ext.viewcode: https://www.sphinx-doc.org/en/master/usage/extensions/viewcode.html#module-sphinx.ext.viewcode\n\n\n..  Title: Sphinx Github Style\n..  Description: A Sphinx extension to add GitHub source code links and syntax highlighting\n..  Author: TDKorn (Adam Korn)\n\n.. meta::\n   :title: Sphinx Github Style\n   :description: A Sphinx extension to add GitHub source code links and syntax highlighting\n\n\nsphinx-github-style - GitHub source code links and syntax highlighting for Sphinx documentation\n-------------------------------------------------------------------------------------------------\n\n.. image:: https://raw.githubusercontent.com/TDKorn/sphinx-github-style/v1.2.1/docs/source/_static/logo_pypi.png\n   :alt: Sphinx GitHub Style: GitHub Integration and Pygments Style for Sphinx Documentation\n   :width: 50%\n   :align: center\n\n\n\n\n\n\n\n\n\n\n\n\nGitHub source code links and syntax highlighting for Sphinx documentation\n\n\n.. |docs| replace:: **Explore the docs \u00bb**\n.. _docs: https://sphinx-github-style.readthedocs.io/en/latest/\n\n|docs|_\n\n|\n\n\n.. image:: https://img.shields.io/pypi/v/sphinx-github-style?color=eb5202\n   :target: https://pypi.org/project/sphinx-github-style/\n   :alt: PyPI Version\n\n.. image:: https://img.shields.io/badge/GitHub-sphinx--github--style-4f1abc\n   :target: https://github.com/tdkorn/sphinx-github-style/\n   :alt: GitHub Repository\n\n.. image:: https://static.pepy.tech/personalized-badge/sphinx-github-style?period=total&units=none&left_color=grey&right_color=blue&left_text=Downloads\n    :target: https://pepy.tech/project/sphinx-github-style/\n\n.. image:: https://readthedocs.org/projects/sphinx-github-style/badge/?version=latest\n    :target: https://sphinx-github-style.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n\n\n|\n\nAbout\n~~~~~~~~~~~~~\n\n``sphinx-github-style`` is a Sphinx extension that links your documentation to GitHub source code.\nIt also adds syntax highlighting for code blocks similar to GitHub's pretty lights dark theme.\n\n...\n\n\nGitHub Source Code Links\n===============================\n\n\nUsing |.sphinx.ext.linkcode|_,  a ``View on GitHub`` link is added to the documentation of every class, method, function, and property:\n\n|\n\n\n\n.. image:: https://raw.githubusercontent.com/TDKorn/sphinx-github-style/v1.2.1/docs/source/_static/github_link.png\n   :alt: sphinx-github-style adds a \"View on GitHub\" link\n\n\nThey link to and highlight the corresponding code block in your GitHub repository:\n\n|\n\n.. image:: https://raw.githubusercontent.com/TDKorn/sphinx-github-style/v1.2.1/docs/source/_static/github_linked_code.png\n   :alt: The linked corresponding highlighted source code block on GitHub\n\n\n\n.. list-table::\n   :header-rows: 1\n   \n   * - \ud83d\udcdd Note\n   * - These links can be |.add_linkcode_class+styled with CSS|_ and used with/instead\n       of the links added by |.sphinx.ext.viewcode|_\n\n\n\nSyntax Highlighting\n====================\n\n``sphinx-github-style`` also contains a ``Pygments`` style to highlight code blocks similar to GitHub:\n\n\n\n.. image:: https://raw.githubusercontent.com/TDKorn/sphinx-github-style/v1.2.1/docs/source/_static/syntax_highlighting.png\n   :alt: A code block highlighted by the Pygments style. It looks identical to GitHub.\n\n\n\nInstallation\n~~~~~~~~~~~~~~~~\n\nTo install using ``pip``::\n\n pip install sphinx-github-style\n\n\nConfiguration\n~~~~~~~~~~~~~~~\n\nAdd the extension to your ``conf.py``\n\n.. code-block:: python\n\n   extensions = [\n       \"sphinx_github_style\",\n   ]\n\nOptional Configuration Variables\n===================================\n\nAdd any (or none) of the following configuration variables to your ``conf.py``\n\n\n\n\n|.linkcode_blob|_\n The blob to link to on GitHub - any of ``\"head\"``, ``\"last_tag\"``, or ``\"{blob}\"``\n\n  **Type:** ``str``\n\n  **Default:** ``\"head\"``\n\n * ``\"head\"`` (default): links to the most recent commit hash; if this commit is tagged, uses the tag instead\n * ``\"last_tag\"``: links to the most recent commit tag on the currently checked out branch\n * ``\"blob\"``: links to any blob you want, for example ``\"master\"`` or ``\"v2.0.1\"``\n\n|\n\n|.linkcode_url|_\n The link to your GitHub repository formatted as ``https://github.com/user/repo``\n\n  **Type:** ``str``\n\n  **Default:** ``f\"https://github.com/{html_context['github_user']}/{html_context['github_repo']}/{html_context['github_version']}\"``\n\n * If not provided, will attempt to create the link from the |.sphinx+html_context|_ dict\n\n|\n\n|.linkcode_link_text|_\n The text to use for the linkcode link\n\n  **Type:** ``str``\n\n  **Default:** ``\"View on GitHub\"``\n\n|\n\n|.linkcode_resolve|_\n A ``linkcode_resolve()`` function to use when resolving the link target with |.sphinx.ext.linkcode|_\n\n  **Type:** ``Callable``\n\n  **Default:** Return value from |.~.get_linkcode_resolve|_\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "GitHub source code links and syntax highlighting for Sphinx documentation",
    "version": "1.2.1",
    "project_urls": {
        "Download": "https://github.com/TDKorn/sphinx-github-style/tarball/master",
        "Homepage": "https://github.com/tdkorn/sphinx-github-style"
    },
    "split_keywords": [
        "sphinx",
        " sphinx-extension",
        " sphinx-theme",
        " pygments",
        " pygments-style",
        " github",
        " linkcode"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4ca038eb4726baaaeaa994743ed8d5bba1ffb2419fbd08498bf9837470d38d91",
                "md5": "da74e8c19ed62d778d3ccfc07a478d40",
                "sha256": "044f9c71f559a13cbc2b1a9fbc828d4b5e71bcded506bd95e1b586e7e9c5fe9e"
            },
            "downloads": -1,
            "filename": "sphinx_github_style-1.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "da74e8c19ed62d778d3ccfc07a478d40",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12313,
            "upload_time": "2024-04-07T11:31:08",
            "upload_time_iso_8601": "2024-04-07T11:31:08.639683Z",
            "url": "https://files.pythonhosted.org/packages/4c/a0/38eb4726baaaeaa994743ed8d5bba1ffb2419fbd08498bf9837470d38d91/sphinx_github_style-1.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0203dd68d753d53313a86a16e4089a737b67690f013a96ba6e1538f5e52e552e",
                "md5": "fb15c35c6f96573ad58d3a259747eb97",
                "sha256": "63bbdcd684d0087b24dd0cde4733b0de7a93a9d60721ff1857e7c79e3b6f620a"
            },
            "downloads": -1,
            "filename": "sphinx-github-style-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "fb15c35c6f96573ad58d3a259747eb97",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11977,
            "upload_time": "2024-04-07T11:31:10",
            "upload_time_iso_8601": "2024-04-07T11:31:10.345874Z",
            "url": "https://files.pythonhosted.org/packages/02/03/dd68d753d53313a86a16e4089a737b67690f013a96ba6e1538f5e52e552e/sphinx-github-style-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-07 11:31:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tdkorn",
    "github_project": "sphinx-github-style",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "sphinx-github-style"
}
        
Elapsed time: 0.22238s