A Pygments lexer for JSON Schema
Project description
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
Release history Release notifications | RSS feed
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.2.1.tar.gz
(11.3 kB
view details)
Built Distribution
File details
Details for the file jsonschema_lexer-0.2.1.tar.gz
.
File metadata
- Download URL: jsonschema_lexer-0.2.1.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45eb765bd428d849907e24ef989f421a4ca63447d10ab1b4f4171471d558939b |
|
MD5 | d72c4a7f6157050f5902c63c77591861 |
|
BLAKE2b-256 | 7debca0d9d49bdeb7e53dd0da0336a915caf41c3fa17a2e354217d9d5fa0252d |
File details
Details for the file jsonschema_lexer-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: jsonschema_lexer-0.2.1-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c46fd6a4a707fe1ca45d0704f7df090c53a312e5a345a7739996586f55ea8971 |
|
MD5 | 3fb9bec53c6490b7742484373215b117 |
|
BLAKE2b-256 | 7608ab7d5a1e1388bfd425ac95f1ff1e3a4d1c82a0214419a7648654d081ab63 |