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-2025.11.15.tar.gz (23.6 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-2025.11.15-py2.py3-none-any.whl (11.2 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for sphinx_combine-2025.11.15.tar.gz
Algorithm Hash digest
SHA256 3d0a3d4b9d439ccba97e8913623be1b9960c5ad71bcfeff5b6ff8107bd890ba1
MD5 80cf48da5b32d5f8d11619145290bbec
BLAKE2b-256 a3120558ee0a0ca052ce7a3e8e87f0bd6b4f5051600fd6e2191e6573b676ed6f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sphinx_combine-2025.11.15-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 97961b515fa1f7ba5b0904cf9b1d6af06ed92db9a700daef77e72e474d281d4d
MD5 286842306127ef4e1e893c58cc867f0c
BLAKE2b-256 26936662a6fe6bbc18339c85552b16c70893606db77fa07fca7daa8498713e88

See more details on using hashes here.

Provenance

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