@zotlit/obsidian-plugin 0.0.0-stage → 2.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/NOTICE +110 -0
- package/README.md +14 -2
- package/main.d.ts +3 -0
- package/main.js +216095 -0
- package/package.json +28 -3
- package/resources/annotation.schema.json +2192 -0
- package/resources/citation.schema.json +465 -0
- package/resources/filename.schema.json +1889 -0
- package/resources/note.schema.json +3931 -0
- package/resources/query.schema.json +8185 -0
- package/resources/zh-CN.json +1 -0
- package/styles.css +2 -0
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "urn:zotlit:template-contract:v3:citation",
|
|
4
|
+
"$comment": "Generated by scripts/generate-contract.ts - DO NOT EDIT.",
|
|
5
|
+
"title": "zt (citation root)",
|
|
6
|
+
"description": "The serialized `zt` data of the `citation` root.",
|
|
7
|
+
"$ref": "#/$defs/CitationTemplateData",
|
|
8
|
+
"$defs": {
|
|
9
|
+
"CitationTemplateData": {
|
|
10
|
+
"description": "The citation-template data root (`zt`): `citations[i].item === items[i]`.",
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"variant": {
|
|
14
|
+
"$ref": "#/$defs/CitationVariant",
|
|
15
|
+
"description": "The gesture this Citation was requested with."
|
|
16
|
+
},
|
|
17
|
+
"items": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"items": {
|
|
20
|
+
"$ref": "#/$defs/TemplateCiteItemData"
|
|
21
|
+
},
|
|
22
|
+
"description": "The cited items bare, in Citation order."
|
|
23
|
+
},
|
|
24
|
+
"citations": {
|
|
25
|
+
"type": "array",
|
|
26
|
+
"items": {
|
|
27
|
+
"$ref": "#/$defs/CitationTemplateItem"
|
|
28
|
+
},
|
|
29
|
+
"description": "The Citation Items: each pairs a cited item with the citation-scoped properties the Pandoc Citation formatter reads."
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": ["variant", "items", "citations"],
|
|
33
|
+
"additionalProperties": false
|
|
34
|
+
},
|
|
35
|
+
"CitationVariant": {
|
|
36
|
+
"oneOf": [
|
|
37
|
+
{
|
|
38
|
+
"const": "main",
|
|
39
|
+
"description": "Enter in the suggester, the insert modal, and an annotation's `citation`."
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"const": "alt",
|
|
43
|
+
"description": "Shift+Enter, or a trailing `/` in the suggester query."
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"description": "The gesture a Citation was requested with, handed to the Citation Template as `zt.variant`: `\"main\"` for Enter, `\"alt\"` for Shift+Enter or a trailing `/` in the suggester query. The enum names the gesture alone — the Citation Template decides what each variant renders."
|
|
47
|
+
},
|
|
48
|
+
"TemplateCiteItemData": {
|
|
49
|
+
"description": "A cited item's data, in the same template vocabulary as the note root and narrowed to the fields both a live Zotero item and a note's embedded CSL-JSON snapshot supply. Vault and library context — tags, dates-added/modified, library identity, and the note resolvers — stays on the note root, which the embedded snapshot cannot express. An unresolved reference becomes a stub with every field null, so a citation template never null-checks the item itself.",
|
|
50
|
+
"type": "object",
|
|
51
|
+
"properties": {
|
|
52
|
+
"itemType": {
|
|
53
|
+
"type": ["string", "null"],
|
|
54
|
+
"description": "Zotero item type, e.g. `\"journalArticle\"`, `\"book\"`."
|
|
55
|
+
},
|
|
56
|
+
"creators": {
|
|
57
|
+
"type": "array",
|
|
58
|
+
"items": {
|
|
59
|
+
"$ref": "#/$defs/TemplateCreator"
|
|
60
|
+
},
|
|
61
|
+
"description": "Every creator on the item, in Zotero's own order."
|
|
62
|
+
},
|
|
63
|
+
"primaryCreatorType": {
|
|
64
|
+
"type": ["string", "null"],
|
|
65
|
+
"description": "The creator role Zotero treats as primary for this item type."
|
|
66
|
+
},
|
|
67
|
+
"title": {
|
|
68
|
+
"type": ["string", "null"],
|
|
69
|
+
"description": "Item title."
|
|
70
|
+
},
|
|
71
|
+
"abstract": {
|
|
72
|
+
"type": ["string", "null"],
|
|
73
|
+
"description": "Abstract text; the CSL-inspired rename of Zotero's `abstractNote`."
|
|
74
|
+
},
|
|
75
|
+
"containerTitle": {
|
|
76
|
+
"type": ["string", "null"],
|
|
77
|
+
"description": "Journal or container title; the CSL-inspired rename of `publicationTitle`."
|
|
78
|
+
},
|
|
79
|
+
"citationKey": {
|
|
80
|
+
"type": ["string", "null"],
|
|
81
|
+
"description": "Citation key, from Zotero's native citation key field, where Better BibTeX writes the keys it generates."
|
|
82
|
+
},
|
|
83
|
+
"citekey": {
|
|
84
|
+
"type": ["string", "null"],
|
|
85
|
+
"description": "Alias for `citationKey`; both stay accessible on the item."
|
|
86
|
+
},
|
|
87
|
+
"date": {
|
|
88
|
+
"anyOf": [
|
|
89
|
+
{
|
|
90
|
+
"$ref": "#/$defs/ItemDateYMD"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"$ref": "#/$defs/ItemDateYearMonth"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"$ref": "#/$defs/ItemDateYear"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"$ref": "#/$defs/ItemDateText"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"type": "null"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"description": "Publication date, parsed from Zotero's multipart `date` field."
|
|
106
|
+
},
|
|
107
|
+
"shortTitle": {
|
|
108
|
+
"type": ["string", "null"],
|
|
109
|
+
"description": "Short title."
|
|
110
|
+
},
|
|
111
|
+
"DOI": {
|
|
112
|
+
"type": ["string", "null"],
|
|
113
|
+
"description": "Digital Object Identifier."
|
|
114
|
+
},
|
|
115
|
+
"url": {
|
|
116
|
+
"type": ["string", "null"],
|
|
117
|
+
"description": "Item URL."
|
|
118
|
+
},
|
|
119
|
+
"ISBN": {
|
|
120
|
+
"type": ["string", "null"],
|
|
121
|
+
"description": "ISBN."
|
|
122
|
+
},
|
|
123
|
+
"ISSN": {
|
|
124
|
+
"type": ["string", "null"],
|
|
125
|
+
"description": "ISSN."
|
|
126
|
+
},
|
|
127
|
+
"volume": {
|
|
128
|
+
"type": ["string", "null"],
|
|
129
|
+
"description": "Volume."
|
|
130
|
+
},
|
|
131
|
+
"issue": {
|
|
132
|
+
"type": ["string", "null"],
|
|
133
|
+
"description": "Issue."
|
|
134
|
+
},
|
|
135
|
+
"pages": {
|
|
136
|
+
"type": ["string", "null"],
|
|
137
|
+
"description": "Page range."
|
|
138
|
+
},
|
|
139
|
+
"publisher": {
|
|
140
|
+
"type": ["string", "null"],
|
|
141
|
+
"description": "Publisher."
|
|
142
|
+
},
|
|
143
|
+
"place": {
|
|
144
|
+
"type": ["string", "null"],
|
|
145
|
+
"description": "Place of publication."
|
|
146
|
+
},
|
|
147
|
+
"edition": {
|
|
148
|
+
"type": ["string", "null"],
|
|
149
|
+
"description": "Edition."
|
|
150
|
+
},
|
|
151
|
+
"language": {
|
|
152
|
+
"type": ["string", "null"],
|
|
153
|
+
"description": "Language, verbatim as Zotero stores it, e.g. `\"en-US\"`, `\"English\"`."
|
|
154
|
+
},
|
|
155
|
+
"extra": {
|
|
156
|
+
"anyOf": [
|
|
157
|
+
{
|
|
158
|
+
"$ref": "#/$defs/ItemExtra"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"type": "null"
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
"description": "Parsed view of Zotero's free-text `extra` field; `null` when empty."
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"required": [
|
|
168
|
+
"itemType",
|
|
169
|
+
"creators",
|
|
170
|
+
"primaryCreatorType",
|
|
171
|
+
"title",
|
|
172
|
+
"abstract",
|
|
173
|
+
"containerTitle",
|
|
174
|
+
"citationKey",
|
|
175
|
+
"citekey",
|
|
176
|
+
"date",
|
|
177
|
+
"shortTitle",
|
|
178
|
+
"DOI",
|
|
179
|
+
"url",
|
|
180
|
+
"ISBN",
|
|
181
|
+
"ISSN",
|
|
182
|
+
"volume",
|
|
183
|
+
"issue",
|
|
184
|
+
"pages",
|
|
185
|
+
"publisher",
|
|
186
|
+
"place",
|
|
187
|
+
"edition",
|
|
188
|
+
"language",
|
|
189
|
+
"extra"
|
|
190
|
+
],
|
|
191
|
+
"additionalProperties": {
|
|
192
|
+
"description": "Additional Zotero fields beyond the explicitly typed ones above."
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"TemplateCreator": {
|
|
196
|
+
"description": "One creator of an item, in the template vocabulary. Coerces to `TemplateCreator.fullName` in string contexts.",
|
|
197
|
+
"type": "object",
|
|
198
|
+
"properties": {
|
|
199
|
+
"family": {
|
|
200
|
+
"type": "string",
|
|
201
|
+
"description": "Family / last name; empty for institutional creators."
|
|
202
|
+
},
|
|
203
|
+
"given": {
|
|
204
|
+
"type": "string",
|
|
205
|
+
"description": "Given / first name; empty for institutional creators."
|
|
206
|
+
},
|
|
207
|
+
"literal": {
|
|
208
|
+
"type": ["string", "null"],
|
|
209
|
+
"description": "Full name for institutional / single-name authors (Zotero `fieldMode=1`); `null` for personal names."
|
|
210
|
+
},
|
|
211
|
+
"role": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"description": "Zotero creator type: `\"author\"`, `\"editor\"`, `\"translator\"`, etc."
|
|
214
|
+
},
|
|
215
|
+
"fullName": {
|
|
216
|
+
"type": "string",
|
|
217
|
+
"description": "`literal` for institutional creators, `\"given family\"` for personal names."
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
"required": ["family", "given", "literal", "role", "fullName"],
|
|
221
|
+
"additionalProperties": false
|
|
222
|
+
},
|
|
223
|
+
"ItemDateYMD": {
|
|
224
|
+
"description": "Full Y/M/D date parsed into a `Temporal.PlainDate`.",
|
|
225
|
+
"type": "object",
|
|
226
|
+
"properties": {
|
|
227
|
+
"kind": {
|
|
228
|
+
"const": "date",
|
|
229
|
+
"description": "Discriminator for the full-precision variant."
|
|
230
|
+
},
|
|
231
|
+
"value": {
|
|
232
|
+
"type": "string",
|
|
233
|
+
"description": "The parsed calendar date."
|
|
234
|
+
},
|
|
235
|
+
"year": {
|
|
236
|
+
"type": "number",
|
|
237
|
+
"description": "Numeric year."
|
|
238
|
+
},
|
|
239
|
+
"month": {
|
|
240
|
+
"type": "number",
|
|
241
|
+
"description": "Month, 1-12."
|
|
242
|
+
},
|
|
243
|
+
"day": {
|
|
244
|
+
"type": "number",
|
|
245
|
+
"description": "Day of month."
|
|
246
|
+
},
|
|
247
|
+
"raw": {
|
|
248
|
+
"type": "string",
|
|
249
|
+
"description": "The stored Zotero `date` value verbatim, retained for round-tripping."
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
"required": ["kind", "value", "year", "month", "day", "raw"],
|
|
253
|
+
"additionalProperties": false
|
|
254
|
+
},
|
|
255
|
+
"ItemDateYearMonth": {
|
|
256
|
+
"description": "Year and month only; `Temporal.PlainYearMonth` (no day).",
|
|
257
|
+
"type": "object",
|
|
258
|
+
"properties": {
|
|
259
|
+
"kind": {
|
|
260
|
+
"const": "yearMonth",
|
|
261
|
+
"description": "Discriminator for the year-and-month variant."
|
|
262
|
+
},
|
|
263
|
+
"value": {
|
|
264
|
+
"type": "string",
|
|
265
|
+
"description": "The parsed year and month."
|
|
266
|
+
},
|
|
267
|
+
"year": {
|
|
268
|
+
"type": "number",
|
|
269
|
+
"description": "Numeric year."
|
|
270
|
+
},
|
|
271
|
+
"month": {
|
|
272
|
+
"type": "number",
|
|
273
|
+
"description": "Month, 1-12."
|
|
274
|
+
},
|
|
275
|
+
"day": {
|
|
276
|
+
"type": "null",
|
|
277
|
+
"description": "Always `null` — this variant carries no day."
|
|
278
|
+
},
|
|
279
|
+
"raw": {
|
|
280
|
+
"type": "string",
|
|
281
|
+
"description": "The stored Zotero `date` value verbatim, retained for round-tripping."
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"required": ["kind", "value", "year", "month", "day", "raw"],
|
|
285
|
+
"additionalProperties": false
|
|
286
|
+
},
|
|
287
|
+
"ItemDateYear": {
|
|
288
|
+
"description": "Year only. Also covers Zotero's `01 2003` misparse where the user-string day is meaningful but month is missing (the spurious day is dropped since no `Temporal` type fits \"year + day without month\").",
|
|
289
|
+
"type": "object",
|
|
290
|
+
"properties": {
|
|
291
|
+
"kind": {
|
|
292
|
+
"const": "year",
|
|
293
|
+
"description": "Discriminator for the year-only variant."
|
|
294
|
+
},
|
|
295
|
+
"value": {
|
|
296
|
+
"type": "null",
|
|
297
|
+
"description": "Always `null` — no `Temporal` type holds a bare year."
|
|
298
|
+
},
|
|
299
|
+
"year": {
|
|
300
|
+
"type": "number",
|
|
301
|
+
"description": "Numeric year."
|
|
302
|
+
},
|
|
303
|
+
"month": {
|
|
304
|
+
"type": "null",
|
|
305
|
+
"description": "Always `null` — the month is missing or unparseable."
|
|
306
|
+
},
|
|
307
|
+
"day": {
|
|
308
|
+
"type": "null",
|
|
309
|
+
"description": "Always `null` — this variant carries no day."
|
|
310
|
+
},
|
|
311
|
+
"raw": {
|
|
312
|
+
"type": "string",
|
|
313
|
+
"description": "The stored Zotero `date` value verbatim, retained for round-tripping."
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
"required": ["kind", "value", "year", "month", "day", "raw"],
|
|
317
|
+
"additionalProperties": false
|
|
318
|
+
},
|
|
319
|
+
"ItemDateText": {
|
|
320
|
+
"description": "Unparseable / text-only: the year is missing or the SQL prefix is absent.",
|
|
321
|
+
"type": "object",
|
|
322
|
+
"properties": {
|
|
323
|
+
"kind": {
|
|
324
|
+
"const": "text",
|
|
325
|
+
"description": "Discriminator for the text variant."
|
|
326
|
+
},
|
|
327
|
+
"value": {
|
|
328
|
+
"type": "null",
|
|
329
|
+
"description": "Always `null` — nothing parsed, so there is no `Temporal` value."
|
|
330
|
+
},
|
|
331
|
+
"text": {
|
|
332
|
+
"type": "string",
|
|
333
|
+
"description": "The renderable user portion, or the entire raw value when non-multipart."
|
|
334
|
+
},
|
|
335
|
+
"year": {
|
|
336
|
+
"type": ["number", "null"],
|
|
337
|
+
"description": "Year extracted from `ItemDateText.text` when it holds a standalone 4-digit year in the 1000-2999 range, else `null`."
|
|
338
|
+
},
|
|
339
|
+
"month": {
|
|
340
|
+
"type": "null",
|
|
341
|
+
"description": "Always `null` — the text variant resolves no month."
|
|
342
|
+
},
|
|
343
|
+
"day": {
|
|
344
|
+
"type": "null",
|
|
345
|
+
"description": "Always `null` — the text variant resolves no day."
|
|
346
|
+
},
|
|
347
|
+
"raw": {
|
|
348
|
+
"type": "string",
|
|
349
|
+
"description": "The stored Zotero `date` value verbatim, retained for round-tripping."
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
"required": ["kind", "value", "text", "year", "month", "day", "raw"],
|
|
353
|
+
"additionalProperties": false
|
|
354
|
+
},
|
|
355
|
+
"ItemExtra": {
|
|
356
|
+
"description": "Best-effort structured view of Zotero's `extra` field. Plain data so it is directly indexable in Liquid, Eta, and JS.\n\n`toString` is non-enumerable, so a spread, `JSON.stringify`, or `Object.keys` sees the three data properties alone.",
|
|
357
|
+
"type": "object",
|
|
358
|
+
"properties": {
|
|
359
|
+
"raw": {
|
|
360
|
+
"type": "string",
|
|
361
|
+
"description": "Original field text verbatim, for a full round-trip."
|
|
362
|
+
},
|
|
363
|
+
"fields": {
|
|
364
|
+
"type": "object",
|
|
365
|
+
"additionalProperties": {
|
|
366
|
+
"type": "string"
|
|
367
|
+
},
|
|
368
|
+
"description": "First value per key — the common-case lookup, e.g. `zt.extra.fields[\"tex.mendeley-tags\"]`. First-wins: a repeated key keeps its first occurrence."
|
|
369
|
+
},
|
|
370
|
+
"lines": {
|
|
371
|
+
"type": "array",
|
|
372
|
+
"items": {
|
|
373
|
+
"$ref": "#/$defs/ExtraLine"
|
|
374
|
+
},
|
|
375
|
+
"description": "Every source row in order, the source of truth `ItemExtra.fields` derives from. Scan it to recover every value of a repeated key."
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
"required": ["raw", "fields", "lines"],
|
|
379
|
+
"additionalProperties": false
|
|
380
|
+
},
|
|
381
|
+
"ExtraLine": {
|
|
382
|
+
"anyOf": [
|
|
383
|
+
{
|
|
384
|
+
"type": "object",
|
|
385
|
+
"properties": {
|
|
386
|
+
"raw": {
|
|
387
|
+
"type": "string",
|
|
388
|
+
"description": "Verbatim source line."
|
|
389
|
+
},
|
|
390
|
+
"key": {
|
|
391
|
+
"type": "string",
|
|
392
|
+
"description": "Parsed key, trimmed."
|
|
393
|
+
},
|
|
394
|
+
"value": {
|
|
395
|
+
"type": "string",
|
|
396
|
+
"description": "Parsed value, trimmed; always non-empty on a pair row."
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
"required": ["raw", "key", "value"],
|
|
400
|
+
"additionalProperties": false
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
"type": "object",
|
|
404
|
+
"properties": {
|
|
405
|
+
"raw": {
|
|
406
|
+
"type": "string",
|
|
407
|
+
"description": "Verbatim source line."
|
|
408
|
+
},
|
|
409
|
+
"key": {
|
|
410
|
+
"type": "null",
|
|
411
|
+
"description": "Always `null` — prose, blank, and empty-value rows carry no key."
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
"required": ["raw", "key"],
|
|
415
|
+
"additionalProperties": false
|
|
416
|
+
}
|
|
417
|
+
],
|
|
418
|
+
"description": "One source row of an Extra field, in document order: a parsed pair (`key` plus trimmed `value`) or a non-pair text/blank row (`key: null`). `raw` is the verbatim line so interleaved prose is never dropped.\n\nA line splits on its first `:` or `=`, and is a pair only when the key starts with an ASCII letter and otherwise holds ASCII letters, digits, spaces, dots, hyphens, or underscores. A line that does not match, and one whose value is empty, becomes a text row.\n\nA non-enumerable `toString` returns `raw`, as on the extra field itself."
|
|
419
|
+
},
|
|
420
|
+
"CitationTemplateItem": {
|
|
421
|
+
"description": "One cited item within a Citation: the pure item data plus the citation-scoped properties, which never live on the item. Exposed to the Citation Template as `zt.citations`, with `zt.items` the same items bare.",
|
|
422
|
+
"type": "object",
|
|
423
|
+
"properties": {
|
|
424
|
+
"item": {
|
|
425
|
+
"$ref": "#/$defs/TemplateCiteItemData",
|
|
426
|
+
"description": "Never null; a stub with null fields when the ref is unresolved."
|
|
427
|
+
},
|
|
428
|
+
"locator": {
|
|
429
|
+
"type": ["string", "null"],
|
|
430
|
+
"description": "Pinpoint reference, e.g. `\"62\"`; `null` when the Citation names none."
|
|
431
|
+
},
|
|
432
|
+
"label": {
|
|
433
|
+
"type": ["string", "null"],
|
|
434
|
+
"description": "Raw CSL locator label, e.g. `\"page\"`."
|
|
435
|
+
},
|
|
436
|
+
"labelShort": {
|
|
437
|
+
"type": "string",
|
|
438
|
+
"description": "Pandoc-style abbreviation, e.g. `\"p.\"`; `\"page\"`/absent → `\"p.\"`."
|
|
439
|
+
},
|
|
440
|
+
"suppressAuthor": {
|
|
441
|
+
"type": "boolean",
|
|
442
|
+
"description": "The Citation suppresses the author's name; `false` by default."
|
|
443
|
+
},
|
|
444
|
+
"prefix": {
|
|
445
|
+
"type": ["string", "null"],
|
|
446
|
+
"description": "Text rendered before the Citation, e.g. `\"see\"`."
|
|
447
|
+
},
|
|
448
|
+
"suffix": {
|
|
449
|
+
"type": ["string", "null"],
|
|
450
|
+
"description": "Text rendered after the Citation, e.g. `\"for a review\"`."
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
"required": [
|
|
454
|
+
"item",
|
|
455
|
+
"locator",
|
|
456
|
+
"label",
|
|
457
|
+
"labelShort",
|
|
458
|
+
"suppressAuthor",
|
|
459
|
+
"prefix",
|
|
460
|
+
"suffix"
|
|
461
|
+
],
|
|
462
|
+
"additionalProperties": false
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|