Skip to main content

Sphinx extension for literalizer — convert JSON, YAML, TOML, and JSON5 to native language literals

Project description

Build Status PyPI

sphinx-literalizer

sphinx-literalizer is a Sphinx extension for literalizer, which converts JSON, YAML, TOML, and JSON5 data structures to native language literal syntax (Python, TypeScript, Go, etc.).

Installation

Requires Python 3.12+.

pip install sphinx-literalizer

Usage

Add to your Sphinx conf.py:

extensions = [
    # ...
    "sphinx_literalizer",
]

Then use the literalizer directive in your .rst files:

.. literalizer:: path/to/data.json
   :language: python
   :wrap:

This reads the data file and renders its contents as a native Python literal in a code block. Input format is auto-detected from the file extension (.json, .yaml/.yml, .toml, .json5), or can be set explicitly with :input-format:.

Full documentation

See the full documentation for more information including how to contribute.

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_literalizer-2026.5.1.2.tar.gz (135.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_literalizer-2026.5.1.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_literalizer-2026.5.1.2.tar.gz.

File metadata

  • Download URL: sphinx_literalizer-2026.5.1.2.tar.gz
  • Upload date:
  • Size: 135.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sphinx_literalizer-2026.5.1.2.tar.gz
Algorithm Hash digest
SHA256 3f6be321bb9a713a1657f4e8b51b8d0d8ec8aa3f3695a07befa7a9daadf2fee2
MD5 d735910bf3bd7513f714cac364022cae
BLAKE2b-256 570a1972a53f691c02502d8b008b03302d59e636469009f29768a65dfb713bb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_literalizer-2026.5.1.2.tar.gz:

Publisher: release.yml on adamtheturtle/sphinx-literalizer

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_literalizer-2026.5.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_literalizer-2026.5.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1609c079d8ee09d2c42a0955c0a1a573af1997df4b342b5cd990f470bf608e74
MD5 a783220db96a0f5dfa04c0c59a2a06ef
BLAKE2b-256 8877a30f133e25ec8be4e4473a495de231f91f5e1a37bac320b280a492db4c3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_literalizer-2026.5.1.2-py3-none-any.whl:

Publisher: release.yml on adamtheturtle/sphinx-literalizer

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