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.0.tar.gz
(11.2 kB
view hashes)
Built Distribution
Close
Hashes for jsonschema_lexer-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6808ca2d066f612613306cf1330c3e39ec863a6e1f4329f78809fb3199829c7b |
|
MD5 | 68b9c01d7642d2dd76e9495166cfb5a9 |
|
BLAKE2b-256 | afee2ba42d1af0a6d101cc01b1bceee7ced3809bc493eb81669347507b48cc50 |