-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschema.json
More file actions
432 lines (432 loc) · 12.2 KB
/
schema.json
File metadata and controls
432 lines (432 loc) · 12.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/jackchuka/mdschema/main/schema.json",
"$ref": "#/$defs/Schema",
"$defs": {
"CodeBlockRule": {
"properties": {
"lang": {
"type": "string",
"description": "Language identifier (bash, go, python, etc.) - omit for any language"
},
"min": {
"type": "integer",
"description": "Minimum required blocks"
},
"max": {
"type": "integer",
"description": "Maximum allowed blocks"
}
},
"additionalProperties": false,
"type": "object"
},
"CountConstraint": {
"properties": {
"min": {
"type": "integer",
"description": "Minimum occurrences required"
},
"max": {
"type": "integer",
"description": "Maximum occurrences allowed (0 = unlimited)"
}
},
"additionalProperties": false,
"type": "object"
},
"FieldFormat": {
"type": "string",
"enum": [
"date",
"email",
"url"
],
"description": "Field format: date (YYYY-MM-DD), email, or url"
},
"FieldType": {
"type": "string",
"enum": [
"string",
"number",
"boolean",
"array",
"date",
"object"
],
"description": "Field type: string, number, boolean, array, date, or object"
},
"FrontmatterConfig": {
"properties": {
"optional": {
"type": "boolean",
"description": "Frontmatter block is not required"
},
"fields": {
"items": {
"$ref": "#/$defs/FrontmatterField"
},
"type": "array",
"description": "Field definitions"
}
},
"additionalProperties": false,
"type": "object"
},
"FrontmatterField": {
"properties": {
"name": {
"type": "string",
"description": "Field name (dot-notation for nested keys, e.g. 'metadata.author')"
},
"optional": {
"type": "boolean",
"description": "Field is not required"
},
"type": {
"$ref": "#/$defs/FieldType",
"description": "String, number, boolean, array, date"
},
"format": {
"$ref": "#/$defs/FieldFormat",
"description": "Date, email, or url"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"name"
]
},
"HeadingRules": {
"properties": {
"no_skip_levels": {
"type": "boolean",
"description": "Disallow skipping levels (e.g., h1 -\u003e h3)"
},
"unique": {
"type": "boolean",
"description": "All headings must be unique"
},
"unique_per_level": {
"type": "boolean",
"description": "Headings unique within same level"
},
"max_depth": {
"type": "integer",
"description": "Maximum heading depth (1-6)"
}
},
"additionalProperties": false,
"type": "object"
},
"ImageRule": {
"properties": {
"min": {
"type": "integer",
"description": "Minimum required images"
},
"max": {
"type": "integer",
"description": "Maximum allowed images"
},
"require_alt": {
"type": "boolean",
"description": "Require alt text"
},
"formats": {
"items": {
"type": "string"
},
"type": "array",
"description": "Allowed formats (png, jpg, gif, etc.)"
}
},
"additionalProperties": false,
"type": "object"
},
"LinkRule": {
"properties": {
"validate_internal": {
"type": "boolean",
"description": "Check anchor links (#section-name)"
},
"validate_files": {
"type": "boolean",
"description": "Check relative file links (./other.md)"
},
"validate_external": {
"type": "boolean",
"description": "Check external URLs (http/https)"
},
"external_timeout": {
"type": "integer",
"description": "Timeout in seconds for external URL checks"
},
"allowed_domains": {
"items": {
"type": "string"
},
"type": "array",
"description": "Restrict external links to these domains"
},
"blocked_domains": {
"items": {
"type": "string"
},
"type": "array",
"description": "Block links to these domains"
}
},
"additionalProperties": false,
"type": "object"
},
"ListRule": {
"properties": {
"min": {
"type": "integer",
"description": "Minimum required lists"
},
"max": {
"type": "integer",
"description": "Maximum allowed lists"
},
"type": {
"type": "string",
"enum": [
"ordered",
"unordered"
],
"description": "Ordered, unordered, or empty for any"
},
"min_items": {
"type": "integer",
"description": "Minimum items per list"
}
},
"additionalProperties": false,
"type": "object"
},
"Schema": {
"properties": {
"structure": {
"items": {
"$ref": "#/$defs/StructureElement"
},
"type": "array",
"description": "Document structure defines required/optional sections and their validation rules"
},
"links": {
"$ref": "#/$defs/LinkRule",
"description": "Global link validation settings"
},
"heading_rules": {
"$ref": "#/$defs/HeadingRules",
"description": "Global heading validation rules"
},
"frontmatter": {
"$ref": "#/$defs/FrontmatterConfig",
"description": "YAML frontmatter validation"
}
},
"additionalProperties": false,
"type": "object"
},
"StructureElement": {
"oneOf": [
{
"type": "string",
"description": "Simple heading text (shorthand for {heading: '...'})"
},
{
"properties": {
"heading": {
"oneOf": [
{
"type": "string",
"description": "Simple heading text (e.g., '## Features')"
},
{
"properties": {
"pattern": {
"type": "string",
"description": "Heading text or regex pattern"
},
"regex": {
"type": "boolean",
"description": "Treat pattern as regular expression"
}
},
"type": "object",
"description": "Heading pattern with optional regex support"
}
],
"description": "Heading pattern to match"
},
"description": {
"type": "string",
"description": "Section description shown in generated output"
},
"optional": {
"type": "boolean",
"description": "Section is not required"
},
"count": {
"$ref": "#/$defs/CountConstraint",
"description": "Occurrence constraints {min, max}"
},
"severity": {
"type": "string",
"enum": [
"error",
"warning",
"info"
],
"description": "Violation severity: error, warning, or info"
},
"allow_additional": {
"type": "boolean",
"description": "Allow extra subsections not in schema"
},
"children": {
"items": {
"$ref": "#/$defs/StructureElement"
},
"type": "array",
"description": "Nested subsections"
},
"required_text": {
"items": {
"oneOf": [
{
"type": "string",
"description": "Simple text to match"
},
{
"properties": {
"pattern": {
"type": "string",
"description": "Text or regex to match"
},
"regex": {
"type": "boolean",
"description": "Treat as regex"
}
},
"type": "object",
"description": "Pattern with optional regex support"
}
]
},
"type": "array",
"description": "Text that must appear in this section"
},
"forbidden_text": {
"items": {
"oneOf": [
{
"type": "string",
"description": "Simple text that must not appear"
},
{
"properties": {
"pattern": {
"type": "string",
"description": "Text or regex that must NOT appear"
},
"regex": {
"type": "boolean",
"description": "Treat as regex"
}
},
"type": "object",
"description": "Pattern with optional regex support"
}
]
},
"type": "array",
"description": "Text that must NOT appear"
},
"code_blocks": {
"items": {
"$ref": "#/$defs/CodeBlockRule"
},
"type": "array",
"description": "Code block requirements"
},
"images": {
"items": {
"$ref": "#/$defs/ImageRule"
},
"type": "array",
"description": "Image requirements"
},
"tables": {
"items": {
"$ref": "#/$defs/TableRule"
},
"type": "array",
"description": "Table requirements"
},
"lists": {
"items": {
"$ref": "#/$defs/ListRule"
},
"type": "array",
"description": "List requirements"
},
"word_count": {
"$ref": "#/$defs/WordCountRule",
"description": "Word count constraints"
}
},
"additionalProperties": false,
"type": "object",
"description": "Structure element with heading pattern and validation rules"
}
],
"description": "Document structure element"
},
"TableRule": {
"properties": {
"min": {
"type": "integer",
"description": "Minimum required tables"
},
"max": {
"type": "integer",
"description": "Maximum allowed tables"
},
"min_columns": {
"type": "integer",
"description": "Minimum columns per table"
},
"required_headers": {
"items": {
"type": "string"
},
"type": "array",
"description": "Headers that must exist"
}
},
"additionalProperties": false,
"type": "object"
},
"WordCountRule": {
"properties": {
"min": {
"type": "integer",
"description": "Minimum words"
},
"max": {
"type": "integer",
"description": "Maximum words"
}
},
"additionalProperties": false,
"type": "object"
}
},
"title": "mdschema",
"description": "Schema for mdschema YAML configuration files (.mdschema.yml)"
}