Skip to main content

A Pygments lexer for JSON Schema

Project description

PyPI version Supported Python versions Build status

Introduction

jsonschema-lexer provides a lexer for syntax highlighting JSON Schema documents via Pygments.

Usage

Once installed, you can use it in your Python code to highlight JSON Schema documents.

Here’s a simple example:

from jsonschema_lexer import JSONSchemaLexer

from rich.console import Console
from rich.syntax import Syntax

console = Console()

code = """
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/product.schema.json",
  "title": "Product",
  "description": "A product from Acme's catalog",
  "type": "object",
  "properties": {
    "productId": {
      "description": "The unique identifier for a product",
      "type": "integer"
    },
    "productName": {
      "description": "Name of the product",
      "type": "string"
    }
  }
}
"""

syntax = Syntax(code, lexer=JSONSchemaLexer(), background_color="default", word_wrap=True)
console.print(syntax)

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

jsonschema_lexer-0.3.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonschema_lexer-0.3.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file jsonschema_lexer-0.3.0.tar.gz.

File metadata

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

File hashes

Hashes for jsonschema_lexer-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cd0e63bcee6d9b6470d4e4963bf6bd24a208d619c895071708dbbbee6afb5f6d
MD5 dbd2514c01ec5a20fa033a5c87d9299d
BLAKE2b-256 31da0fb7df72257986fc706a324d6eb05790b60492111c98a756e046b018c7de

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonschema_lexer-0.3.0.tar.gz:

Publisher: ci.yml on python-jsonschema/jsonschema-lexer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonschema_lexer-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jsonschema_lexer-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2fda8187aa7348656df77decaf8f3931492818c082714cc7e3a26376d9587f67
MD5 91b6026c05afd042441acbe52029f98a
BLAKE2b-256 077f2e04eebdc90eea0eebf10d697fcd599eadf921e436caa2a43f46df747358

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonschema_lexer-0.3.0-py3-none-any.whl:

Publisher: ci.yml on python-jsonschema/jsonschema-lexer

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