{"id":13795111,"url":"https://github.com/adamtheturtle/sphinx-substitution-extensions","last_synced_at":"2025-10-08T01:20:35.183Z","repository":{"id":33266531,"uuid":"157119836","full_name":"adamtheturtle/sphinx-substitution-extensions","owner":"adamtheturtle","description":"Extensions for Sphinx which allow substitutions","archived":false,"fork":false,"pushed_at":"2024-04-22T11:07:58.000Z","size":1214,"stargazers_count":36,"open_issues_count":4,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-22T12:27:42.942Z","etag":null,"topics":["sphinx-extension"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adamtheturtle.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-11-11T20:49:44.000Z","updated_at":"2024-04-22T12:27:44.603Z","dependencies_parsed_at":"2023-10-23T16:39:01.300Z","dependency_job_id":"92880aa5-ce66-4ad3-80e4-bbb7253c5dc8","html_url":"https://github.com/adamtheturtle/sphinx-substitution-extensions","commit_stats":{"total_commits":649,"total_committers":9,"mean_commits":72.11111111111111,"dds":0.6009244992295839,"last_synced_commit":"3f90d9d2531429c1f528d020f6a839ecdd861db8"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamtheturtle%2Fsphinx-substitution-extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamtheturtle%2Fsphinx-substitution-extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamtheturtle%2Fsphinx-substitution-extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamtheturtle%2Fsphinx-substitution-extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adamtheturtle","download_url":"https://codeload.github.com/adamtheturtle/sphinx-substitution-extensions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225157000,"owners_count":17429698,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sphinx-extension"],"created_at":"2024-08-03T23:00:52.250Z","updated_at":"2025-10-08T01:20:35.158Z","avatar_url":"https://github.com/adamtheturtle.png","language":"Python","funding_links":[],"categories":["Site Generators"],"sub_categories":["Sphinx Extensions"],"readme":"|Build Status| |PyPI|\n\nSphinx Substitution Extensions\n==============================\n\nExtensions for Sphinx which allow substitutions within code blocks.\n\n.. contents::\n\nInstallation\n------------\n\nSphinx Substitution Extensions is compatible with Sphinx 8.2.0+ using Python |minimum-python-version|\\+.\n\n.. code-block:: console\n\n   $ pip install Sphinx-Substitution-Extensions\n\nrST setup\n---------\n\n1. Add the following to ``conf.py`` to enable the extension:\n\n.. code-block:: python\n\n   \"\"\"Configuration for Sphinx.\"\"\"\n\n   extensions = [\"sphinxcontrib.spelling\"]  # Example existing extensions\n\n   extensions += [\"sphinx_substitution_extensions\"]\n\n2. Set the following variable in ``conf.py`` to define substitutions:\n\n.. code-block:: python\n\n   \"\"\"Configuration for Sphinx.\"\"\"\n\n   rst_prolog = \"\"\"\n   .. |release| replace:: 0.1\n   .. |author| replace:: Eleanor\n   \"\"\"\n\nThis will replace ``|release|`` in the new directives with ``0.1``, and ``|author|`` with ``Eleanor``.\n\nUsing substitutions in rST documents\n------------------------------------\n\n``code-block``\n~~~~~~~~~~~~~~\n\nThis adds a ``:substitutions:`` option to Sphinx's built-in `code-block`_ directive.\n\n.. code-block:: rst\n\n   .. code-block:: shell\n      :substitutions:\n\n      echo \"|author| released version |release|\"\n\nInline ``:substitution-code:``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: rst\n\n   :substitution-code:`echo \"|author| released version |release|\"`\n\n``substitution-download``\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: rst\n\n   :substitution-download:`|author|'s manuscript \u003c|author|_manuscript.txt\u003e`\n\n\nMyST Markdown setup\n-------------------\n\n1. Add ``sphinx_substitution_extensions`` to ``extensions`` in ``conf.py`` to enable the extension:\n\n.. code-block:: python\n\n   \"\"\"Configuration for Sphinx.\"\"\"\n\n   extensions = [\"myst_parser\"]  # Example existing extensions\n\n   extensions += [\"sphinx_substitution_extensions\"]\n\n2. Set the following variables in ``conf.py`` to define substitutions:\n\n.. code-block:: python\n\n   \"\"\"Configuration for Sphinx.\"\"\"\n\n   myst_enable_extensions = [\"substitution\"]\n\n   myst_substitutions = {\n       \"release\": \"0.1\",\n       \"author\": \"Eleanor\",\n   }\n\nThis will replace ``|release|`` in the new directives with ``0.1``, and ``|author|`` with ``Eleanor``.\n\nUsing substitutions in MyST Markdown\n------------------------------------\n\n``code-block``\n~~~~~~~~~~~~~~\n\nThis adds a ``:substitutions:`` option to Sphinx's built-in `code-block`_ directive.\n\n.. code-block:: markdown\n\n   ```{code-block} bash\n      :substitutions:\n\n      echo \"|author| released version |release|\"\n   ```\n\nAs well as using ``|author|``, you can also use ``{{author}}``.\nThis will respect the value of ``myst_sub_delimiters`` as set in ``conf.py``.\n\nInline ``:substitution-code:``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: rst\n\n   {substitution-code}`echo \"|author| released version |release|\"`\n\n``substitution-download``\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: rst\n\n   {substitution-download}`|author|'s manuscript \u003c|author|_manuscript.txt\u003e`\n\nCredits\n-------\n\nClusterHQ Developers\n~~~~~~~~~~~~~~~~~~~~\n\nThis package is largely inspired by code written for Flocker by ClusterHQ.\nDevelopers of the relevant code include, at least, Jon Giddy and Tom Prince.\n\nContributing\n------------\n\nSee `CONTRIBUTING.rst \u003c./CONTRIBUTING.rst\u003e`_.\n\n.. |Build Status| image:: https://github.com/adamtheturtle/sphinx-substitution-extensions/actions/workflows/ci.yml/badge.svg?branch=main\n   :target: https://github.com/adamtheturtle/sphinx-substitution-extensions/actions\n.. _code-block: http://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-code-block\n.. |PyPI| image:: https://badge.fury.io/py/Sphinx-Substitution-Extensions.svg\n   :target: https://badge.fury.io/py/Sphinx-Substitution-Extensions\n.. |minimum-python-version| replace:: 3.10\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamtheturtle%2Fsphinx-substitution-extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamtheturtle%2Fsphinx-substitution-extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamtheturtle%2Fsphinx-substitution-extensions/lists"}