挂件
清单文件
json
{
"$schema": "https://docs.siyuan-note.club/schemas/manifest/widget.schema.json",
"name": "widget-sample",
"author": "Vanessa",
"url": "https://github.com/siyuan-note/widget-sample",
"version": "0.0.3",
"minAppVersion": "2.8.8",
"displayName": {
"default": "Widget Sample",
"zh_CN": "挂件示例"
},
"description": {
"default": "This is a widget sample",
"zh_CN": "这是一个挂件示例"
},
"readme": {
"default": "README.md",
"zh_CN": "README_zh_CN.md"
},
"funding": {
"openCollective": "",
"patreon": "",
"github": "",
"custom": [
"https://ld246.com/sponsor"
]
}
}
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
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
ts
/**
* Widget resource manifest file definition
*/
export interface IWidget {
/**
* The name of the author
*/
readonly author: string;
/**
* The description of the resource
*/
readonly description?: ILocalizedText;
/**
* The display name of the resource
*/
readonly displayName?: ILocalizedText;
/**
* The funding of the resource
*/
readonly funding?: IFunding;
/**
* The keywords of the resource used for search
*/
readonly keywords?: string[];
/**
* The minimum version of SiYuan that the resource is compatible with
*/
readonly minAppVersion?: string;
/**
* The name of the resource
*/
readonly name: string;
/**
* The readme file name of the resource
*/
readonly readme?: ILocalizedText;
/**
* The GitHub repository URL of the resource
*/
readonly url: string;
/**
* The version of the resource
*/
readonly version: string;
[property: string]: any;
}
/**
* The description of the resource
*
* Localize text fields
*
* The display name of the resource
*
* The readme file name of the resource
*/
export interface ILocalizedText {
/**
* The default text
*/
readonly default: string;
/**
* The English text
*/
readonly en_US?: string;
/**
* The Traditional Chinese text
*/
readonly zh_CHT?: string;
/**
* The Simplified Chinese text
*/
readonly zh_CN?: string;
[property: string]: any;
}
/**
* The funding of the resource
*/
export interface IFunding {
/**
* The custom funding URLs
*/
readonly custom?: string[];
/**
* The GitHub sponsors username, such as https://github.com/sponsors/<username>
*/
readonly github?: string;
/**
* The Open Collective username, such as https://opencollective.com/<username>
*/
readonly openCollective?: string;
/**
* The Patreon username, such as https://www.patreon.com/<username>
*/
readonly patreon?: string;
}
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
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
json5
/**
* 挂件资源属性
*/
{
$schema: 'https://json-schema.org/draft/2020-12/schema',
$id: 'https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/manifest/widget.schema.json5',
$comment: 'v1.0.1',
$ref: '#/$defs/root',
$defs: {
root: {
// 挂件资源清单文件定义
title: 'IWidget',
description: 'Widget resource manifest file definition',
$ref: '#/$defs/base',
},
base: {
type: 'object',
additionalProperties: true,
required: [
'author',
'name',
'url',
'version',
],
properties: {
author: {
// 作者名
type: 'string',
description: 'The name of the author',
},
description: {
// 资源描述
description: 'The description of the resource',
$ref: '#/$defs/_localized_text_',
},
displayName: {
// 显示名称
description: 'The display name of the resource',
$ref: '#/$defs/_localized_text_',
},
funding: {
// 资助途径
type: 'object',
title: 'IFunding',
description: 'The funding of the resource',
additionalProperties: false,
required: [],
properties: {
custom: {
// 自定义捐助途径 URL
type: 'array',
description: 'The custom funding URLs',
items: {
type: 'string',
description: 'The custom funding URL',
format: 'uri',
examples: [
'https://afdian.net/a/<username>', // 爱发电
'https://ko-fi.com/<username>', // Ko-fi
'https://tidelift.com/subscription/<platform-name>/<package-name>', // Tidelift
'https://funding.communitybridge.org/projects/<project-name>', // Community Bridge
'https://liberapay.com/<username>', // Liberapay
'https://issuehunt.io/r/<username>', // IssueHunt
'https://crowdfunding.lfx.linuxfoundation.org/projects/<project-name>', // LFX Crowdfunding
],
},
},
github: {
// GitHub sponsors 用户名
type: 'string',
description: 'The GitHub sponsors username, such as https://github.com/sponsors/<username>',
examples: [
'88250',
],
},
openCollective: {
// Open Collective 用户名
type: 'string',
description: 'The Open Collective username, such as https://opencollective.com/<username>',
examples: [
'siyuan',
],
},
patreon: {
// Patreon 用户名
type: 'string',
description: 'The Patreon username, such as https://www.patreon.com/<username>',
},
},
},
keywords: {
// 用于搜索的关键词
type: 'array',
description: 'The keywords of the resource used for search',
items: {
type: 'string',
description: 'The keyword used for search',
},
},
minAppVersion: {
// 兼容的最低思源版本
type: 'string',
description: 'The minimum version of SiYuan that the resource is compatible with',
pattern: '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$',
},
name: {
// 资源名称
type: 'string',
description: 'The name of the resource',
pattern: '^[^\\\\/:*?"<>|. ][^\\\\/:*?"<>|]*[^\\\\/:*?"<>|. ]$',
},
readme: {
// 资源说明文档名称
description: 'The readme file name of the resource',
$ref: '#/$defs/_localized_text_',
},
url: {
// 资源仓库地址
type: 'string',
description: 'The GitHub repository URL of the resource',
format: 'uri',
examples: [
'https://github.com/siyuan-note/widget-sample',
],
},
version: {
// 资源版本号
type: 'string',
description: 'The version of the resource',
// REF: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
pattern: '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$',
},
},
},
_localized_text_: {
// 本地化文本
type: 'object',
title: 'ILocalizedText',
description: 'Localize text fields',
additionalProperties: true,
required: [
'default',
],
properties: {
default: {
// 默认文本
type: 'string',
description: 'The default text',
},
en_US: {
// 英文文本
type: 'string',
description: 'The English text',
},
zh_CHT: {
// 繁体中文文本
type: 'string',
description: 'The Traditional Chinese text',
},
zh_CN: {
// 简体中文文本
type: 'string',
description: 'The Simplified Chinese text',
},
},
},
},
}
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
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
json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/manifest/widget.schema.json",
"$comment": "v1.0.1",
"$ref": "#/$defs/root",
"$defs": {
"root": {
"title": "IWidget",
"description": "Widget resource manifest file definition",
"$ref": "#/$defs/base"
},
"base": {
"type": "object",
"additionalProperties": true,
"required": [
"author",
"name",
"url",
"version"
],
"properties": {
"author": {
"type": "string",
"description": "The name of the author"
},
"description": {
"description": "The description of the resource",
"$ref": "#/$defs/_localized_text_"
},
"displayName": {
"description": "The display name of the resource",
"$ref": "#/$defs/_localized_text_"
},
"funding": {
"type": "object",
"title": "IFunding",
"description": "The funding of the resource",
"additionalProperties": false,
"required": [],
"properties": {
"custom": {
"type": "array",
"description": "The custom funding URLs",
"items": {
"type": "string",
"description": "The custom funding URL",
"format": "uri",
"examples": [
"https://afdian.net/a/<username>",
"https://ko-fi.com/<username>",
"https://tidelift.com/subscription/<platform-name>/<package-name>",
"https://funding.communitybridge.org/projects/<project-name>",
"https://liberapay.com/<username>",
"https://issuehunt.io/r/<username>",
"https://crowdfunding.lfx.linuxfoundation.org/projects/<project-name>"
]
}
},
"github": {
"type": "string",
"description": "The GitHub sponsors username, such as https://github.com/sponsors/<username>",
"examples": [
"88250"
]
},
"openCollective": {
"type": "string",
"description": "The Open Collective username, such as https://opencollective.com/<username>",
"examples": [
"siyuan"
]
},
"patreon": {
"type": "string",
"description": "The Patreon username, such as https://www.patreon.com/<username>"
}
}
},
"keywords": {
"type": "array",
"description": "The keywords of the resource used for search",
"items": {
"type": "string",
"description": "The keyword used for search"
}
},
"minAppVersion": {
"type": "string",
"description": "The minimum version of SiYuan that the resource is compatible with",
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$"
},
"name": {
"type": "string",
"description": "The name of the resource",
"pattern": "^[^\\\\/:*?\"<>|. ][^\\\\/:*?\"<>|]*[^\\\\/:*?\"<>|. ]$"
},
"readme": {
"description": "The readme file name of the resource",
"$ref": "#/$defs/_localized_text_"
},
"url": {
"type": "string",
"description": "The GitHub repository URL of the resource",
"format": "uri",
"examples": [
"https://github.com/siyuan-note/widget-sample"
]
},
"version": {
"type": "string",
"description": "The version of the resource",
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
}
}
},
"_localized_text_": {
"type": "object",
"title": "ILocalizedText",
"description": "Localize text fields",
"additionalProperties": true,
"required": [
"default"
],
"properties": {
"default": {
"type": "string",
"description": "The default text"
},
"en_US": {
"type": "string",
"description": "The English text"
},
"zh_CHT": {
"type": "string",
"description": "The Traditional Chinese text"
},
"zh_CN": {
"type": "string",
"description": "The Simplified Chinese text"
}
}
}
}
}
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
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
- 基础字段
name
:挂件名称,必须全局唯一(集市中不能有同名挂件)author
:挂件作者名url
:挂件仓库地址version
:挂件版本号,建议遵循 semver 规范minAppVersion
:挂件支持的最低思源笔记版本号keywords
: 用于在集市中搜索的关键词列表displayName
:模板显示名称,主要用于模板集市列表中显示,支持多语言default
:默认语言,必须存在zh_CN
、en_US
等其他语言:可选,建议至少提供中文和英文
description
:挂件描述,主要用于挂件集市列表中显示,支持多语言default
:默认语言,必须存在zh_CN
、en_US
等其他语言:可选,建议至少提供中文和英文
readme
:自述文件名,主要用于挂件集市详情页中显示,支持多语言default
:默认语言,必须存在zh_CN
、en_US
等其他语言:可选,建议至少提供中文和英文
funding
:挂件赞助信息openCollective
:Open Collective 名称patreon
:Patreon 名称github
:GitHub 用户名custom
:自定义赞助链接列表