Metadata-Version: 2.4
Name: sphinx-literalizer
Version: 2026.10.19
Summary: Sphinx extension for literalizer — convert JSON, YAML, TOML, and JSON5 to native language literals
Author-email: Adam Dangoor <adamdangoor@gmail.com>
License-Expression: MIT
Project-URL: Documentation, https://adamtheturtle.github.io/sphinx-literalizer/
Project-URL: Source, https://github.com/adamtheturtle/sphinx-literalizer
Keywords: extension,json,literal,literalizer,sphinx
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Sphinx :: Extension
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Requires-Python: >=3.12
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: beartype==0.23.1
Requires-Dist: docutils
Requires-Dist: literalizer==2026.9.16
Requires-Dist: sphinx>=7.0
Requires-Dist: typing-extensions
Dynamic: license-file

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

.. contents::
   :local:

Installation
------------

Requires Python |minimum-python-version|\+.

.. code-block:: sh

   pip install sphinx-literalizer


Usage
-----

Add to your Sphinx ``conf.py``:

.. code-block:: python

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

Then use the ``literalizer`` directive in your ``.rst`` files:

.. code-block:: rst

   .. 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 <https://adamtheturtle.github.io/sphinx-literalizer/>`__ for more information including how to contribute.

.. _literalizer: https://github.com/adamtheturtle/literalizer

.. |Build Status| image:: https://github.com/adamtheturtle/sphinx-literalizer/actions/workflows/ci.yml/badge.svg?branch=main
   :target: https://github.com/adamtheturtle/sphinx-literalizer/actions
.. |PyPI| image:: https://badge.fury.io/py/sphinx-literalizer.svg
   :target: https://badge.fury.io/py/sphinx-literalizer
.. |minimum-python-version| replace:: 3.12
