Sphinx ExtensionΒΆ

Use the extension in your build:

extensions += ["jsonschema_diff.sphinx"]

You must also configure the extension. Add the following variable to your conf.py:

from jsonschema_diff import ConfigMaker, JsonSchemaDiff
from jsonschema_diff.color import HighlighterPipeline
from jsonschema_diff.color.stages import (
    MonoLinesHighlighter, PathHighlighter, ReplaceGenericHighlighter,
)

jsonschema_diff = JsonSchemaDiff(
    config=ConfigMaker.make(),
    colorize_pipeline=HighlighterPipeline(
        [MonoLinesHighlighter(), ReplaceGenericHighlighter(), PathHighlighter()],
    ),
)

After that, you can use it in your .rst files:

.. jsonschemadiff:: path/to/file.old.schema.json path/to/file.new.schema.json # from folder `source`
    :name: filename.svg # optional
    :title: Title in virtual terminal # optional
    :no-legend: # optional
diff example.old.schema.json

See also for more: jsonschema_diff.sphinx.directive