Skip to main content

Extension for Sphinx which enables combining code blocks.

Project description

Build Status PyPI

Sphinx Combine

Extension for Sphinx which enables combining code blocks.

Installation

sphinx-combine is compatible with Sphinx 7.2.0+ using Python 3.11+.

$ pip install sphinx-combine

Setup

Add the following to conf.py to enable the extension:

"""Configuration for Sphinx."""

extensions = ["sphinxcontrib.spelling"]  # Example existing extensions

extensions += ["sphinx_combine"]

Using combined-code-block

The extension provides a new directive, combined-code-block, which allows you to combine multiple code blocks into a single code block.

The directive takes a language argument which is used to determine the syntax, as well as all options that the code-block directive supports.

Languages and options of code blocks within the directive are ignored.

.. combined-code-block:: python

   .. literalinclude:: my_code.js
      :language: javascript

   .. code-block:: python

      """First code block."""

   .. code-block:: cpp

      // Second code block.

By default, there are no blank lines between the code blocks. To add a blank line, use |.

Contributing

See CONTRIBUTING.rst.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_combine-2026.1.11.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_combine-2026.1.11-py2.py3-none-any.whl (11.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sphinx_combine-2026.1.11.tar.gz.

File metadata

  • Download URL: sphinx_combine-2026.1.11.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sphinx_combine-2026.1.11.tar.gz
Algorithm Hash digest
SHA256 b07e448fceff7b61c53308fb19f27eb5905dc0892677f8e6d04eb1dcf6bbbba0
MD5 b394cb7817ec04c89afd55a5d9206575
BLAKE2b-256 27e2447c76d79549d9f298a5d81f359e092a00e5dbf781d77e4fd9ddbbcafbcf

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_combine-2026.1.11.tar.gz:

Publisher: release.yml on adamtheturtle/sphinx-combine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sphinx_combine-2026.1.11-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_combine-2026.1.11-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 877acb076688ceca8a87b8d88f79b10fa4b4734a5c36b18eb8b88d24c65b0bc0
MD5 2b23046324c74dbdd626dac24f3e6a9b
BLAKE2b-256 cddf9f523c314a5062ede760d4a249b90edcb1b72bb9a16089da3e05e4c1acec

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_combine-2026.1.11-py2.py3-none-any.whl:

Publisher: release.yml on adamtheturtle/sphinx-combine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page