Skip to content

Commit 753f0aa

Browse files
committed
Merge remote-tracking branch 'origin/main'
# Conflicts: # plugin.json
2 parents 84f150a + 7ea94f0 commit 753f0aa

7 files changed

Lines changed: 1920 additions & 1493 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## v0.4.5 2026
4+
5+
## v0.4.4 2025-12-23
6+
7+
* [Delete plugin data when uninstalling the plugin](https://github.com/siyuan-note/plugin-sample/pull/37)
8+
9+
## v0.4.3 2025-12-02
10+
11+
* [Add onDataChanged method to handle data changes in the plugin](https://github.com/siyuan-note/siyuan/pull/16244)
12+
313
## v0.4.2 2025-08-26
414

515
* [Upgrade ESLint to 9.33.0](https://github.com/siyuan-note/plugin-sample/issues/30)

README.md

Lines changed: 46 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44

55
## Get started
66

7-
* Make a copy of this repo as a template with the <kbd>Use this template</kbd> button, please note that the repo name
8-
must be the same as the plugin name, the default branch must be `main`
9-
* Clone your repo to a local development folder. For convenience, you can place this folder in
10-
your `{workspace}/data/plugins/` folder
11-
* Install [NodeJS](https://nodejs.org/en/download) and [pnpm](https://pnpm.io/installation), then run `pnpm i` in the
12-
command line under your repo folder
7+
* Make a copy of this repo as a template with the <kbd>Use this template</kbd> button, please note that the repo name must be the same as the plugin name, the default branch must be `main`
8+
* Clone your repo to a local development folder. For convenience, you can place this folder in your `{workspace}/data/plugins/` folder
9+
* Install [NodeJS](https://nodejs.org/en/download) and [pnpm](https://pnpm.io/installation), then run `pnpm i` in the command line under your repo folder
1310
* Execute `pnpm run dev` for real-time compilation
1411
* Open SiYuan marketplace and enable plugin in downloaded tab
1512

@@ -31,59 +28,56 @@ In terms of internationalization, our main consideration is to support multiple
3128
complete the following tasks:
3229

3330
* Meta information about the plugin itself, such as plugin description and readme
34-
* `description` and `readme` fields in plugin.json, and the corresponding README*.md file
31+
* `displayName`, `description` and `readme` fields in plugin.json, and the corresponding README*.md file
3532
* Text used in the plugin, such as button text and tooltips
36-
* src/i18n/*.json language configuration files
37-
* Use `this.i18.key` to get the text in the code
38-
* Finally, declare the language supported by the plugin in the `i18n` field in plugin.json
33+
* src/i18n/*.json language configuration files
34+
* Use `this.i18.key` to get the text in the code
3935

40-
It is recommended that the plugin supports at least English and Simplified Chinese, so that more people can use it more
41-
conveniently.
36+
It is recommended that the plugin supports at least English and Simplified Chinese, so that more people can use it more conveniently. Unsupported languages do not need to be declared in the `displayName`, `description` and `readme` fields in plugin.json.
4237

4338
## plugin.json
4439

40+
A typical example is as follows:
41+
4542
```json
4643
{
4744
"name": "plugin-sample",
4845
"author": "Vanessa",
4946
"url": "https://github.com/siyuan-note/plugin-sample",
50-
"version": "0.1.3",
51-
"minAppVersion": "2.8.8",
52-
"backends": ["windows", "linux", "darwin"],
53-
"frontends": ["desktop"],
47+
"version": "0.4.2",
48+
"minAppVersion": "3.3.0",
49+
"backends": ["all"],
50+
"frontends": ["all"],
51+
"disabledInPublish": false,
5452
"displayName": {
5553
"default": "Plugin Sample",
5654
"zh_CN": "插件示例"
5755
},
5856
"description": {
59-
"default": "This is a plugin sample",
60-
"zh_CN": "这是一个插件示例"
57+
"default": "This is a plugin development sample",
58+
"zh_CN": "这是一个插件开发示例"
6159
},
6260
"readme": {
6361
"default": "README.md",
6462
"zh_CN": "README_zh_CN.md"
6563
},
6664
"funding": {
67-
"openCollective": "",
68-
"patreon": "",
69-
"github": "",
70-
"custom": [
71-
"https://ld246.com/sponsor"
72-
]
65+
"custom": ["https://ld246.com/sponsor"]
7366
},
7467
"keywords": [
75-
"sample", "示例"
68+
"开发者参考",
69+
"developer reference",
70+
"示例插件"
7671
]
7772
}
7873
```
7974

80-
* `name`: Plugin name, must be the same as the repo name, and must be unique globally (no duplicate plugin names in the
81-
marketplace)
75+
* `name`: Plugin package name, must be the same as the GitHub repository name, and cannot be duplicated with other plugins in the marketplace
8276
* `author`: Plugin author name
8377
* `url`: Plugin repo URL
84-
* `version`: Plugin version number, it is recommended to follow the [semver](https://semver.org/) specification
85-
* `minAppVersion`: Minimum version number of SiYuan required to use this plugin
86-
* `disabledInPublish`: Whether to diable the plugin in publish service
78+
* `version`: Plugin version number, needs to follow the [semver](https://semver.org/) specification
79+
* `minAppVersion`: Minimum SiYuan version required to use this plugin
80+
* `disabledInPublish`: Whether to disable the plugin when using the publish service, defaults to false, i.e., not disabled
8781
* `backends`: Backend environment required by the plugin, optional values are `windows`, `linux`, `darwin`, `docker`, `android`, `ios`, `harmony` and `all`
8882
* `windows`: Windows desktop
8983
* `linux`: Linux desktop
@@ -100,46 +94,44 @@ conveniently.
10094
* `browser-desktop`: Desktop browser
10195
* `browser-mobile`: Mobile browser
10296
* `all`: All environments
103-
* `displayName`: Template display name, mainly used for display in the marketplace list, supports multiple languages
104-
* `default`: Default language, must exist
105-
* `zh_CN`, `en_US` and other languages: optional, it is recommended to provide at least Chinese and English
106-
* `description`: Plugin description, mainly used for display in the marketplace list, supports multiple languages
107-
* `default`: Default language, must exist
108-
* `zh_CN`, `en_US` and other languages: optional, it is recommended to provide at least Chinese and English
109-
* `readme`: readme file name, mainly used to display in the marketplace details page, supports multiple languages
110-
* `default`: Default language, must exist
111-
* `zh_CN`, `en_US` and other languages: optional, it is recommended to provide at least Chinese and English
112-
* `funding`: Plugin sponsorship information
113-
* `openCollective`: Open Collective name
114-
* `patreon`: Patreon name
115-
* `github`: GitHub login name
116-
* `custom`: Custom sponsorship link list
117-
* `keywords`: Search keyword list, used for marketplace search function
97+
* `displayName`: Plugin name, displayed in the marketplace list
98+
* `default`: Default language, must exist. If the plugin supports English, English should be used here
99+
* `zh_CN`, `en_US` and other languages: optional
100+
* `description`: Plugin description, displayed in the marketplace list
101+
* `default`: Default language, must exist. If the plugin supports English, English should be used here
102+
* `zh_CN`, `en_US` and other languages: optional
103+
* `readme`: Readme file name, displayed in the marketplace details page
104+
* `default`: Default language, must exist. If the plugin supports English, English should be used here
105+
* `zh_CN`, `en_US` and other languages: optional
106+
* `funding`: Plugin sponsorship information, only one type will be displayed in the marketplace
107+
* `openCollective`: Open Collective name
108+
* `patreon`: Patreon name
109+
* `github`: GitHub login name
110+
* `custom`: Custom sponsorship link list
111+
* `keywords`: Search keyword list, used for marketplace search function, supplements search keywords beyond the values of `name`, `author`, `displayName`, and `description` fields
118112

119113
## Package
120114

121115
No matter which method is used to compile and package, we finally need to generate a package.zip, which contains at
122116
least the following files:
123117

124-
* i18n/*
125-
* icon.png (160*160)
118+
* i18n/* (If the plugin supports multiple languages, language files need to be packaged to this directory, otherwise this directory is not needed)
119+
* icon.png (recommended size: 160*160, file size should not exceed 20KB)
126120
* index.css
127121
* index.js
128122
* plugin.json
129-
* preview.png (1024*768)
123+
* preview.png (recommended size: 1024*768, file size should not exceed 200KB)
130124
* README*.md
131125

132126
## List on the marketplace
133127

134-
* `pnpm run build` to generate package.zip
128+
* Execute `pnpm run build` to generate package.zip
135129
* Create a new GitHub release using your new version number as the "Tag version". See here for an
136130
example: https://github.com/siyuan-note/plugin-sample/releases
137131
* Upload the file package.zip as binary attachments
138132
* Publish the release
139133

140-
If it is the first release, please create a pull request to
141-
the [Community Bazaar](https://github.com/siyuan-note/bazaar) repository and modify the plugins.json file in it. This
142-
file is the index of all community plugin repositories, the format is:
134+
If this is the first release, you also need to create a PR to the [Community Bazaar](https://github.com/siyuan-note/bazaar) repository and modify the plugins.json file in it. This file is the index of all community plugin repositories, the format is:
143135

144136
```json
145137
{
@@ -149,12 +141,9 @@ file is the index of all community plugin repositories, the format is:
149141
}
150142
```
151143

152-
After the PR is merged, the bazaar will automatically update the index and deploy through GitHub Actions. When releasing
153-
a new version of the plugin in the future, you only need to follow the above steps to create a new release, and you
154-
don't need to PR the community bazaar repo.
144+
After the PR is merged, the bazaar will automatically update the index and deploy through GitHub Actions. For subsequent plugin releases, you only need to follow the above steps to create a new release, and you don't need to PR the community bazaar repository.
155145

156-
Under normal circumstances, the community bazaar repo will automatically update the index and deploy every hour,
157-
and you can check the deployment status at https://github.com/siyuan-note/bazaar/actions.
146+
Under normal circumstances, the community bazaar repository will automatically update the index and deploy every hour, and you can check the deployment status at https://github.com/siyuan-note/bazaar/actions.
158147

159148
## Developer's Guide
160149

README_zh_CN.md

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -27,58 +27,57 @@
2727
国际化方面我们主要考虑的是支持多语言,具体需要完成以下工作:
2828

2929
* 插件自身的元信息,比如插件描述和自述文件
30-
* plugin.json 中的 `description``readme` 字段,以及对应的 README*.md 文件
30+
* plugin.json 中的 `displayName``description``readme` 字段,以及对应的 README*.md 文件
3131
* 插件中使用的文本,比如按钮文字和提示信息
3232
* src/i18n/*.json 语言配置文件
3333
* 代码中使用 `this.i18.key` 获取文本
34-
* 最后在 plugin.json 中的 `i18n` 字段中声明该插件支持的语言
3534

36-
建议插件至少支持英文和简体中文,这样可以方便更多人使用。
35+
建议插件至少支持英文和简体中文,这样可以方便更多人使用。不支持的语种不需要在 plugin.json 中的 `displayName``description``readme` 字段中声明。
3736

3837
## plugin.json
3938

39+
一个典型的示例如下:
40+
4041
```json
4142
{
4243
"name": "plugin-sample",
4344
"author": "Vanessa",
4445
"url": "https://github.com/siyuan-note/plugin-sample",
45-
"version": "0.1.3",
46-
"minAppVersion": "2.8.8",
47-
"backends": ["windows", "linux", "darwin"],
48-
"frontends": ["desktop"],
46+
"version": "0.4.2",
47+
"minAppVersion": "3.3.0",
48+
"backends": ["all"],
49+
"frontends": ["all"],
50+
"disabledInPublish": false,
4951
"displayName": {
5052
"default": "Plugin Sample",
5153
"zh_CN": "插件示例"
5254
},
5355
"description": {
54-
"default": "This is a plugin sample",
55-
"zh_CN": "这是一个插件示例"
56+
"default": "This is a plugin development sample",
57+
"zh_CN": "这是一个插件开发示例"
5658
},
5759
"readme": {
5860
"default": "README.md",
5961
"zh_CN": "README_zh_CN.md"
6062
},
6163
"funding": {
62-
"openCollective": "",
63-
"patreon": "",
64-
"github": "",
65-
"custom": [
66-
"https://ld246.com/sponsor"
67-
]
64+
"custom": ["https://ld246.com/sponsor"]
6865
},
6966
"keywords": [
70-
"sample", "示例"
67+
"开发者参考",
68+
"developer reference",
69+
"示例插件"
7170
]
7271
}
7372
```
7473

75-
* `name`插件名称,必须和库名一致,且全局唯一(集市中不能有重名插件)
74+
* `name`插件包名,必须和 GitHub 仓库名一致,且不能与集市中的其他插件重复
7675
* `author`:插件作者名
7776
* `url`:插件仓库地址
78-
* `version`:插件版本号,建议遵循 [semver](https://semver.org/lang/zh-CN/) 规范
77+
* `version`:插件版本号,需要遵循 [semver](https://semver.org/lang/zh-CN/) 规范
7978
* `minAppVersion`:插件支持的最低思源笔记版本号
80-
* `disabledInPublish`:使用发布服务时是否禁用该插件,默认为 false
81-
* `backends`:插件需要的后端环境,可选值为 `windows`, `linux`, `darwin`, `docker`, `android`, `ios`, `harmony` and `all`
79+
* `disabledInPublish`:使用发布服务时是否禁用该插件,默认为 false,即不禁用
80+
* `backends`:插件需要的后端环境,可选值为 `windows`, `linux`, `darwin`, `docker`, `android`, `ios`, `harmony` `all`
8281
* `windows`:Windows 桌面端
8382
* `linux`:Linux 桌面端
8483
* `darwin`:macOS 桌面端
@@ -87,39 +86,39 @@
8786
* `ios`:iOS 端
8887
* `harmony`:鸿蒙端
8988
* `all`:所有环境
90-
* `frontends`:插件需要的前端环境,可选值为 `desktop`, `desktop-window`, `mobile`, `browser-desktop`, `browser-mobile` and `all`
89+
* `frontends`:插件需要的前端环境,可选值为 `desktop`, `desktop-window`, `mobile`, `browser-desktop`, `browser-mobile` `all`
9190
* `desktop`:桌面端
9291
* `desktop-window`:桌面端页签转换的独立窗口
9392
* `mobile`:移动端
9493
* `browser-desktop`:桌面端浏览器
9594
* `browser-mobile`:移动端浏览器
9695
* `all`:所有环境
97-
* `displayName`模板显示名称,主要用于模板集市列表中显示,支持多语言
98-
* `default`:默认语言,必须存在
99-
* `zh_CN``en_US` 等其他语言:可选,建议至少提供中文和英文
100-
* `description`:插件描述,主要用于插件集市列表中显示,支持多语言
101-
* `default`:默认语言,必须存在
102-
* `zh_CN``en_US` 等其他语言:可选,建议至少提供中文和英文
103-
* `readme`:自述文件名,主要用于插件集市详情页中显示,支持多语言
104-
* `default`:默认语言,必须存在
105-
* `zh_CN``en_US` 等其他语言:可选,建议至少提供中文和英文
106-
* `funding`:插件赞助信息
96+
* `displayName`插件名称,在插件集市列表中显示
97+
* `default`:默认语言,必须存在。如果插件支持英文,此处应使用英文
98+
* `zh_CN``en_US` 等其他语言:可选
99+
* `description`:插件描述,在插件集市列表中显示
100+
* `default`:默认语言,必须存在。如果插件支持英文,此处应使用英文
101+
* `zh_CN``en_US` 等其他语言:可选
102+
* `readme`:自述文件名,在插件集市详情页中显示
103+
* `default`:默认语言,必须存在。如果插件支持英文,此处应使用英文
104+
* `zh_CN``en_US` 等其他语言:可选
105+
* `funding`:插件赞助信息,集市仅显示其中一种
107106
* `openCollective`:Open Collective 名称
108107
* `patreon`:Patreon 名称
109108
* `github`:GitHub 登录名
110109
* `custom`:自定义赞助链接列表
111-
* `keywords`:搜索关键字列表,用于集市搜索功能
110+
* `keywords`:搜索关键字列表,用于集市搜索功能,补充 `name``author``displayName``description` 字段值以外的搜索关键词
112111

113112
## 打包
114113

115114
无论使用何种方式编译打包,我们最终需要生成一个 package.zip,它至少包含如下文件:
116115

117-
* i18n/*
118-
* icon.png (160*160)
116+
* i18n/* (如果插件支持多语言,则需要将语言文件打包到该目录下,否则不需要该目录)
117+
* icon.png (建议尺寸为 160*160、文件大小不超过 20KB)
119118
* index.css
120119
* index.js
121120
* plugin.json
122-
* preview.png (1024*768)
121+
* preview.png (建议尺寸为 1024*768、文件大小不超过 200KB)
123122
* README*.md
124123

125124
## 上架集市
@@ -129,8 +128,7 @@
129128
* 上传 package.zip 作为二进制附件
130129
* 提交发布
131130

132-
如果是第一次发布版本,还需要创建一个 PR 到 [Community Bazaar](https://github.com/siyuan-note/bazaar) 社区集市仓库,修改该库的
133-
plugins.json。该文件是所有社区插件库的索引,格式为:
131+
如果是第一次发布版本,还需要创建一个 PR 到 [Community Bazaar](https://github.com/siyuan-note/bazaar) 社区集市仓库,修改该库的 plugins.json。该文件是所有社区插件库的索引,格式为:
134132

135133
```json
136134
{
@@ -140,8 +138,7 @@ plugins.json。该文件是所有社区插件库的索引,格式为:
140138
}
141139
```
142140

143-
PR 被合并以后集市会通过 GitHub Actions 自动更新索引并部署。后续发布新版本插件时只需要按照上述步骤创建新的发布即可,不需要再
144-
PR 社区集市仓库。
141+
PR 被合并以后集市会通过 GitHub Actions 自动更新索引并部署。后续发布新版本插件时只需要按照上述步骤创建新的发布即可,不需要再 PR 社区集市仓库。
145142

146143
正常情况下,社区集市仓库每隔 1 小时会自动更新索引并部署,可在 https://github.com/siyuan-note/bazaar/actions 查看部署状态。
147144

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "plugin-sample",
3-
"version": "0.4.2",
3+
"version": "0.4.4",
44
"description": "This is a sample plugin for Siyuan (https://b3log.org/siyuan)",
55
"main": ".src/index.js",
66
"scripts": {
@@ -12,6 +12,8 @@
1212
"author": "Vanessa",
1313
"license": "MIT",
1414
"devDependencies": {
15+
"@eslint/eslintrc": "^3.3.3",
16+
"@eslint/js": "^9.39.1",
1517
"@typescript-eslint/eslint-plugin": "8.40.0",
1618
"@typescript-eslint/parser": "8.40.0",
1719
"copy-webpack-plugin": "^11.0.0",
@@ -21,7 +23,7 @@
2123
"mini-css-extract-plugin": "2.3.0",
2224
"sass": "^1.62.1",
2325
"sass-loader": "^12.6.0",
24-
"siyuan": "1.1.3",
26+
"siyuan": "1.1.7",
2527
"tslib": "2.4.0",
2628
"typescript": "4.8.4",
2729
"webpack": "^5.76.0",

0 commit comments

Comments
 (0)