{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "znote detection rules",
"description": "What znote hides besides the glossary: patterns such as e-mail addresses and amounts, and how the name finder's kinds map to hiding levels. Language-specific words live in languages/.",
"type": "object",
"additionalProperties": false,
"required": [
"ignorable",
"spaces",
"currencyCodes",
"currencySymbols",
"number",
"patterns",
"finder",
"levels",
"defaultLevel"
],
"properties": {
"$schema": {
"type": "string"
},
"ignorable": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[0-9A-F]{4,6}(-[0-9A-F]{4,6})?$"
},
"description": "Unicode code points (hex, or a range \"200B-200F\") that are invisible and skipped when matching, such as zero-width spaces and soft hyphens."
},
"spaces": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 1
},
"description": "Characters read as a space when matching, such as Typst's non-breaking ~."
},
"currencyCodes": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"uniqueItems": true
},
"currencySymbols": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
},
"uniqueItems": true
},
"number": {
"type": "string",
"description": "Regular expression for the number in an amount."
},
"patterns": {
"type": "array",
"items": {
"$ref": "#/$defs/pattern"
}
},
"finder": {
"type": "object",
"additionalProperties": false,
"required": [
"threshold",
"labels"
],
"properties": {
"threshold": {
"type": "number",
"exclusiveMinimum": 0,
"exclusiveMaximum": 1
},
"labels": {
"type": "array",
"items": {
"type": "array",
"prefixItems": [
{
"type": "string"
},
{
"type": "string",
"pattern": "^[A-Z_]+$"
}
],
"minItems": 2,
"maxItems": 2
},
"description": "Pairs of the label the name finder is asked for and the kind of token it becomes."
}
}
},
"levels": {
"type": "object",
"additionalProperties": {
"type": "integer",
"minimum": 0,
"maximum": 3
},
"description": "The lowest hiding level at which a kind found by the name finder is hidden."
},
"defaultLevel": {
"type": "integer",
"minimum": 0,
"maximum": 3,
"description": "The level for kinds not listed in levels."
}
},
"$defs": {
"pattern": {
"type": "object",
"additionalProperties": false,
"required": [
"kind",
"regex"
],
"properties": {
"kind": {
"type": "string",
"pattern": "^[A-Z_]+$"
},
"regex": {
"type": "string",
"description": "Regular expression (Rust regex syntax). {symbols}, {codes}, {number}, {scale} and {trunk} are filled in from the currencies, the number and every language's scale words and phone trunks."
},
"check": {
"enum": [
"iban",
"luhn",
"ipv4",
"ipv6",
"phone",
"amount"
],
"description": "An extra check a hit must pass."
},
"trim": {
"type": "string",
"description": "Characters taken off the end of a hit."
},
"amounts": {
"type": "boolean",
"description": "Hidden only when hiding amounts is on."
}
}
}
}
}