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.3.13.tar.gz (25.4 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.3.13-py2.py3-none-any.whl (11.3 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: sphinx_combine-2026.3.13.tar.gz
  • Upload date:
  • Size: 25.4 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.3.13.tar.gz
Algorithm Hash digest
SHA256 c663b775f71f23d0e190b98ba2ad84695504d76bde39c145b0b7689bba121679
MD5 299030049fe8d4a3e2b8e7814c40812b
BLAKE2b-256 66f18b3a6381931c73478b2990dbbb593130b4ed28b80b3e021ec0a3563cac22

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_combine-2026.3.13.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.3.13-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_combine-2026.3.13-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0518fa6e3fedb95cd63cce9d3604c5226f8fdc815d6f1f4b79dcdf74cf9b9de5
MD5 043ba2604e022ab8134342c86eb2e600
BLAKE2b-256 7e6c2324ff5b258d0f6e90b10ba26608d37b9f60e76c9a027ac829bdd6868034

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_combine-2026.3.13-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