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 hashes)
Built Distribution
Close
Hashes for jsonschema_lexer-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c46fd6a4a707fe1ca45d0704f7df090c53a312e5a345a7739996586f55ea8971 |
|
MD5 | 3fb9bec53c6490b7742484373215b117 |
|
BLAKE2b-256 | 7608ab7d5a1e1388bfd425ac95f1ff1e3a4d1c82a0214419a7648654d081ab63 |