Skip to main content

Extension for Sphinx which enables combining code blocks.

Project description

Build Status codecov PyPI

Sphinx Combine

Extension for Sphinx which enables combining code blocks.

Installation

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

$ 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.

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

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: sphinx_combine-2024.12.30.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for sphinx_combine-2024.12.30.tar.gz
Algorithm Hash digest
SHA256 bae9540e384daa307d5fb1284069795ec89c5c02e72c461e5c76d5d457fc8a72
MD5 4e7bc40a8dbb0dff7c983f54708fec1d
BLAKE2b-256 e7992bb2b399d66a13052d2b3cea7b50d89ed2f9d8e6fbe02c9af16f7c713a74

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sphinx_combine-2024.12.30-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f02d45a95e596cc10455b2bc15b90f95a08baac7f534d0ffe66d594904800a9f
MD5 972f9419742df389de4371469e4c070e
BLAKE2b-256 8d76a68951267fbb5d169b3068cc76bc9f6d5d1d57ac63bdbe89a86c2e93301e

See more details on using hashes here.

Provenance

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