├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ └── publish.yml ├── .gitignore ├── .husky ├── commit-msg └── pre-commit ├── .prettierignore ├── .prettierrc.toml ├── .wakatime-project ├── CHANGELOG.md ├── LICENSE ├── README-zh-Hans.md ├── README.md ├── api └── cron.ts ├── commitlint.config.ts ├── cspell-words.txt ├── cspell.config.yaml ├── docs ├── .vitepress │ ├── components │ │ ├── Forward │ │ │ ├── DocData.ts │ │ │ ├── ForwardDoc.vue │ │ │ ├── ForwardDocWithParams.vue │ │ │ └── posts.data.ts │ │ ├── Link │ │ │ ├── BaseLink.vue │ │ │ ├── LinkContactUS.vue │ │ │ ├── LinkDiscord.vue │ │ │ └── LinkQQGroup.vue │ │ └── bazaar.vue │ ├── config.ts │ ├── configs │ │ ├── en.ts │ │ └── zh-Hans.ts │ └── theme │ │ ├── index.ts │ │ └── style.css ├── contents │ ├── [doc].md │ └── [doc].paths.ts ├── en │ ├── contents │ │ ├── [doc].md │ │ └── [doc].paths.ts │ ├── guide │ │ ├── icon │ │ │ └── index.md │ │ ├── index.md │ │ ├── plugin │ │ │ ├── development │ │ │ │ └── siyuan-plugin-cli.md │ │ │ ├── index.md │ │ │ └── sy-plugin-dev-quick-start.md │ │ ├── template │ │ │ └── index.md │ │ ├── theme │ │ │ └── index.md │ │ └── widget │ │ │ └── index.md │ ├── index.md │ └── reference │ │ ├── api │ │ ├── kernel │ │ │ └── index.md │ │ └── plugin │ │ │ └── index.md │ │ ├── index.md │ │ └── manifest │ │ ├── icon.md │ │ ├── index.md │ │ ├── plugin.md │ │ ├── template.md │ │ ├── theme.md │ │ └── widget.md ├── index.md ├── members │ ├── index-en.md │ ├── index.md │ └── wetoria │ │ ├── assets │ │ ├── image-20240809103732573.png │ │ ├── image-20240809104307435.png │ │ └── image-20240809104314347.png │ │ ├── contribute-en.md │ │ ├── contribute-zh.md │ │ └── test-plug-in-plug-in-z1gpive.md ├── public │ ├── frostime │ │ ├── 6317cf25a7642e03e6e142e1eaa8c434-20240801114854-7w3nmxe.png │ │ ├── image-20240731175413-cyqym0q.png │ │ ├── image-20240731195519-xgw9ya7.png │ │ ├── image-20240731201659-bli82ae.png │ │ ├── image-20240815182549-k81nkl3.png │ │ ├── image-20240815182918-mprnmn9.png │ │ ├── image-20240815183249-vol0uoa.png │ │ ├── image-20240815185213-pufh1pw.png │ │ ├── image-20240815191851-hi4lrbv.png │ │ ├── image-20240815192530-ziu4ke1.png │ │ ├── image-20240815194618-9qc8lbb.png │ │ ├── image-20240815194704-kppabzx.png │ │ ├── image-20240815195839-n430ijr.png │ │ ├── image-20240815200507-fxu576j.png │ │ ├── image-20240815201644-tlatb7s.png │ │ ├── image-20240815213424-c6nqqm4.png │ │ ├── image-20240815214009-h8jy59d.png │ │ ├── image-20240815225754-zkhd49o.png │ │ ├── image-20240815230000-kp6d11u.png │ │ ├── image-20240825114150-lih9rwa.png │ │ ├── image-20240825114418-7gwkj8u.png │ │ ├── image-20240825114433-rjgqchg.png │ │ ├── image-20240825114713-gkyqy1h.png │ │ ├── image-20240825114905-6t5y0w7.png │ │ ├── image-20240825115954-nbke1nt.png │ │ ├── image-20240825122938-duieqmr.png │ │ └── image-20241002191846-5prokwg.png │ └── static │ │ ├── asset-img.png │ │ ├── development │ │ └── storybook.png │ │ ├── favicon.ico │ │ ├── logo │ │ ├── siyuan-dark.svg │ │ ├── siyuan-fill.png │ │ ├── siyuan-fill.svg │ │ ├── siyuan-opaque.png │ │ ├── siyuan.png │ │ └── siyuan.svg │ │ ├── user-interface │ │ ├── layout.png │ │ ├── topbar-1.png │ │ └── topbar-2.png │ │ └── widget │ │ ├── .img │ │ ├── Pasted image 20231204153852.png │ │ ├── Pasted image 20231204161953.png │ │ ├── Pasted image 20231204162145.png │ │ ├── Pasted image 20231204162525.png │ │ ├── Pasted image 20231204162655.png │ │ ├── Pasted image 20231204163237.png │ │ └── Pasted image 20231204163314.png ├── snippets │ ├── .keep │ └── examples │ │ └── manifest │ │ ├── base.json │ │ ├── icon.json │ │ ├── plugin.json │ │ ├── template.json │ │ ├── theme.json │ │ └── widget.json └── zh-Hans │ ├── about │ ├── contribute.md │ └── index.md │ ├── bazaar │ └── index.md │ ├── contents │ ├── [doc].md │ └── [doc].paths.ts │ ├── guide │ ├── icon │ │ └── index.md │ ├── index.md │ ├── plugin │ │ ├── development │ │ │ ├── community.md │ │ │ ├── siyuan-plugin-cli.md │ │ │ └── svelte-kit.md │ │ ├── five-minutes-quick-start.md │ │ ├── index.md │ │ ├── startup.md │ │ ├── sy-plugin-dev-quick-start.md │ │ └── user-interface │ │ │ ├── index.md │ │ │ └── topbar.md │ ├── template │ │ └── index.md │ ├── theme │ │ └── index.md │ └── widget │ │ └── index.md │ ├── index.md │ └── reference │ ├── api │ ├── kernel │ │ └── index.md │ └── plugin │ │ ├── class │ │ ├── Dialog.md │ │ ├── EventBus.md │ │ ├── Lute.md │ │ ├── Menu.md │ │ ├── Plugin.md │ │ └── Setting.md │ │ ├── event-bus │ │ └── index.md │ │ ├── index.md │ │ ├── method.md │ │ └── types.md │ ├── bazaar │ ├── icon.md │ ├── index.md │ ├── plugin.md │ ├── template.md │ ├── theme.md │ └── widget.md │ ├── block │ ├── attribute.md │ └── type.md │ ├── community │ ├── index.md │ ├── siyuan-CE │ │ ├── feature.md │ │ └── index.md │ └── siyuan-sdk │ │ ├── file-system.md │ │ ├── index.md │ │ ├── kernel │ │ ├── api │ │ │ ├── asset.md │ │ │ ├── attr.md │ │ │ ├── block.md │ │ │ ├── broadcast.md │ │ │ ├── convert.md │ │ │ ├── export.md │ │ │ ├── file.md │ │ │ ├── filetree.md │ │ │ ├── history.md │ │ │ ├── inbox.md │ │ │ ├── network.md │ │ │ ├── notebook.md │ │ │ ├── notification.md │ │ │ ├── query.md │ │ │ ├── repo.md │ │ │ ├── search.md │ │ │ ├── snippet.md │ │ │ ├── sqlite.md │ │ │ ├── storage.md │ │ │ ├── system.md │ │ │ └── template.md │ │ ├── index.md │ │ └── ws.md │ │ └── start.md │ ├── database │ └── table.md │ ├── index.md │ └── template │ ├── index.md │ ├── siyuan.md │ └── sprig │ ├── conversion.md │ ├── crypto.md │ ├── date.md │ ├── defaults.md │ ├── dicts.md │ ├── encoding.md │ ├── flow-control.md │ ├── index.md │ ├── integer-slice.md │ ├── lists.md │ ├── math.md │ ├── mathf.md │ ├── network.md │ ├── os.md │ ├── paths.md │ ├── reflection.md │ ├── semver.md │ ├── string-slice.md │ ├── strings.md │ └── uuid.md ├── eslint.config.js ├── lint-staged.config.js ├── package.json ├── pnpm-lock.yaml ├── scripts └── siyuan-sdk.js └── vercel.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # REF: https://spec.editorconfig.org/#supported-pairs 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | end_of_line = lf 7 | charset = utf-8 8 | insert_final_newline = true 9 | 10 | [*.{md}] 11 | indent_size = 2 12 | trim_trailing_whitespace = false 13 | 14 | [*.{js,ts,vue,css,json}] 15 | indent_size = 4 16 | trim_trailing_whitespace = true 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # REF: https://docs.github.com/zh/get-started/getting-started-with-git/configuring-git-to-handle-line-endings 2 | * text eol=lf 3 | *.png binary 4 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | # github: 5 | 6 | # Replace with a single Patreon username 7 | # patreon: 8 | 9 | # Replace with a single Open Collective username 10 | # open_collective: 11 | 12 | # Replace with a single Ko-fi username 13 | ko_fi: zuoqiu 14 | 15 | # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 16 | # tidelift: 17 | 18 | # Replace with a single Community Bridge project-name e.g., cloud-foundry 19 | # community_bridge: 20 | 21 | # Replace with a single Liberapay username 22 | # liberapay: 23 | 24 | # Replace with a single IssueHunt username 25 | # issuehunt: 26 | 27 | # Replace with a single Otechie username 28 | # otechie: 29 | 30 | # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 31 | # lfx_crowdfunding: 32 | 33 | # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 34 | custom: 35 | - https://afdian.net/a/zuoqiu 36 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: publish 2 | on: 3 | workflow_dispatch: 4 | push: 5 | branches: 6 | - main 7 | paths: 8 | - docs/** 9 | 10 | jobs: 11 | # 任务ID 12 | build-and-publish: 13 | # 运行环境 14 | runs-on: ubuntu-latest 15 | # 步骤 16 | steps: 17 | # Checkout 18 | # REF https://github.com/marketplace/actions/checkout 19 | - name: Checkout 20 | uses: actions/checkout@v3 21 | 22 | # Install Node.js 23 | # REF https://github.com/marketplace/actions/setup-node-js-environment 24 | - name: Install Node.js 25 | uses: actions/setup-node@v3 26 | with: 27 | # Node.js 版本号 | Node.js version 28 | node-version: 20 29 | 30 | # Node.js 源 | Node.js registry 31 | registry-url: https://registry.npmjs.org 32 | 33 | # Install pnpm 34 | # REF https://github.com/marketplace/actions/setup-pnpm 35 | - name: Install pnpm 36 | uses: pnpm/action-setup@v2 37 | id: pnpm-install 38 | with: 39 | # # pnpm 版本号 | pnpm version 40 | version: 8 41 | 42 | # # 是否安装 npm 包 | if install npm package? 43 | run_install: false 44 | 45 | # Get pnpm store directory 46 | - name: Get pnpm store directory 47 | id: pnpm-cache 48 | shell: bash 49 | run: | 50 | echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT 51 | 52 | # Setup pnpm cache 53 | # REF https://github.com/marketplace/actions/cache 54 | - name: Setup pnpm cache 55 | uses: actions/cache@v3 56 | with: 57 | path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} 58 | key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} 59 | restore-keys: | 60 | ${{ runner.os }}-pnpm-store- 61 | 62 | # 构建 63 | - name: Build package 64 | run: | 65 | pnpm install 66 | pnpm run docs:build 67 | 68 | # 将构建产物提交到 publish 分支 69 | # REF https://github.com/marketplace/actions/github-pages 70 | - name: Deploy to Publish Branch 71 | if: success() 72 | uses: crazy-max/ghaction-github-pages@v3 73 | with: 74 | # 部署 dist 目录下的内容 75 | build_dir: ./docs/.vitepress/dist 76 | # 提交到 gh-pages 分支 77 | target_branch: gh-pages 78 | env: 79 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 80 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Custom 2 | temp 3 | docs/snippets/siyuan-sdk 4 | docs/public/schemas 5 | .vscode/tasks.json 6 | 7 | # VitePress 8 | docs/.vitepress/dist 9 | docs/.vitepress/cache 10 | 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | lerna-debug.log* 18 | .pnpm-debug.log* 19 | 20 | # Diagnostic reports (https://nodejs.org/api/report.html) 21 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 22 | 23 | # Runtime data 24 | pids 25 | *.pid 26 | *.seed 27 | *.pid.lock 28 | 29 | # Directory for instrumented libs generated by jscoverage/JSCover 30 | lib-cov 31 | 32 | # Coverage directory used by tools like istanbul 33 | coverage 34 | *.lcov 35 | 36 | # nyc test coverage 37 | .nyc_output 38 | 39 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 40 | .grunt 41 | 42 | # Bower dependency directory (https://bower.io/) 43 | bower_components 44 | 45 | # node-waf configuration 46 | .lock-wscript 47 | 48 | # Compiled binary addons (https://nodejs.org/api/addons.html) 49 | build/Release 50 | 51 | # Dependency directories 52 | node_modules/ 53 | jspm_packages/ 54 | 55 | # Snowpack dependency directory (https://snowpack.dev/) 56 | web_modules/ 57 | 58 | # TypeScript cache 59 | *.tsbuildinfo 60 | 61 | # Optional npm cache directory 62 | .npm 63 | 64 | # Optional eslint cache 65 | .eslintcache 66 | 67 | # Optional stylelint cache 68 | .stylelintcache 69 | 70 | # Microbundle cache 71 | .rpt2_cache/ 72 | .rts2_cache_cjs/ 73 | .rts2_cache_es/ 74 | .rts2_cache_umd/ 75 | 76 | # Optional REPL history 77 | .node_repl_history 78 | 79 | # Output of 'npm pack' 80 | *.tgz 81 | 82 | # Yarn Integrity file 83 | .yarn-integrity 84 | 85 | # dotenv environment variable files 86 | .env 87 | .env.development.local 88 | .env.test.local 89 | .env.production.local 90 | .env.local 91 | 92 | # parcel-bundler cache (https://parceljs.org/) 93 | .cache 94 | .parcel-cache 95 | 96 | # Next.js build output 97 | .next 98 | out 99 | 100 | # Nuxt.js build / generate output 101 | .nuxt 102 | dist 103 | 104 | # Gatsby files 105 | .cache/ 106 | # Comment in the public line in if your project uses Gatsby and not Next.js 107 | # https://nextjs.org/blog/next-9-1#public-directory-support 108 | # public 109 | 110 | # vuepress build output 111 | .vuepress/dist 112 | 113 | # vuepress v2.x temp and cache directory 114 | .temp 115 | .cache 116 | 117 | # Docusaurus cache and generated files 118 | .docusaurus 119 | 120 | # Serverless directories 121 | .serverless/ 122 | 123 | # FuseBox cache 124 | .fusebox/ 125 | 126 | # DynamoDB Local files 127 | .dynamodb/ 128 | 129 | # TernJS port file 130 | .tern-port 131 | 132 | # Stores VSCode versions used for testing VSCode extensions 133 | .vscode-test 134 | 135 | # yarn v2 136 | .yarn/cache 137 | .yarn/unplugged 138 | .yarn/build-state.yml 139 | .yarn/install-state.gz 140 | .pnp.* 141 | .vercel 142 | 143 | # MacOS 144 | .DS_Store 145 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | commitlint --edit $1 4 | 5 | exit 0 6 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | pnpm format:lint-staged 4 | 5 | pnpm docs:build 6 | 7 | exit 0 8 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | build 2 | cache 3 | dist 4 | node_modules 5 | public 6 | temp 7 | 8 | # Ignore files for PNPM, NPM and YARN 9 | pnpm-lock.yaml 10 | pnpm-workspace.yaml 11 | package-lock.json 12 | yarn.lock 13 | -------------------------------------------------------------------------------- /.prettierrc.toml: -------------------------------------------------------------------------------- 1 | "$schema" = "https://json.schemastore.org/prettierrc.json" 2 | 3 | # 换行宽度 4 | # printWidth: 5 | 6 | # printWidth = 80 7 | printWidth = 1024 8 | 9 | # 缩进宽度 10 | 11 | # tabWidth: 12 | # tabWidth = 2 13 | tabWidth = 2 14 | 15 | # 是否使用 \t 16 | 17 | # useTabs: 18 | # useTabs = false 19 | useTabs = false 20 | 21 | # 是否在语句末尾打印分号 22 | 23 | # semi: 24 | # semi = true 25 | semi = true 26 | 27 | # 是否优先使用单引号 28 | 29 | # singleQuote: 30 | # singleQuote = false 31 | singleQuote = false 32 | 33 | # 对象属性名是否使用引号 34 | # "as-needed" - 按需添加引号 35 | # "consistent" - 如果有一个需要, 则全部添加引号 36 | # "preserve" - 保持原样 37 | 38 | # quoteProps: "" 39 | # quoteProps = "as-needed" 40 | quoteProps = "as-needed" 41 | 42 | # 在 JSX 中使用单引号而不是双引号 43 | 44 | # jsxSingleQuote: 45 | # jsxSingleQuote = false 46 | jsxSingleQuote = false 47 | 48 | # 尾随逗号 49 | # "es5" - 在 ES5 (对象、数组等) 中有效的尾随逗号, TypeScript 的类型参数中没有尾随逗号 50 | # "none" - 没有尾随逗号 51 | # "all" - 尽可能以逗号结尾 (包括函数参数和调用) 52 | 53 | # trailingComma: "" 54 | # trailingComma = "es5" 55 | trailingComma = "all" 56 | 57 | # 对象大括号添加空格 58 | 59 | # bracketSpacing: 60 | # bracketSpacing = true 61 | bracketSpacing = true 62 | 63 | # 将多行 HTML(HTML、JSX、Vue、Angular)元素的 > 放在最后一行的末尾,而不是单独放在下一行(不适用于自闭合元素) 64 | 65 | # bracketSameLine: 66 | # bracketSameLine = true 67 | bracketSameLine = false 68 | 69 | # 为只有一个参数的箭头函数的参数添加括号 70 | # "always" - (x) => x 71 | # "avoid" - x => x 72 | 73 | # arrowParens: "" 74 | # arrowParens = "always" 75 | arrowParens = "always" 76 | 77 | # 仅格式化文件的一部分 78 | 79 | # rangeStart: 80 | # rangeStart = 0 81 | 82 | # rangeEnd: 83 | # rangeEnd = Infinity 84 | 85 | # 指定要使用的解析器 86 | # parser: require("./my-parser") 87 | 88 | # parser: "" 89 | # parser = none 90 | 91 | # 指定用于推断要使用哪个解析器的文件名 92 | 93 | # filepath: "" 94 | # filepath = none 95 | 96 | # 仅格式化在文件顶部包含特殊注释 @prettier 或 @format 的文件 97 | 98 | # requirePragma: 99 | # requirePragma = false 100 | requirePragma = false 101 | 102 | # 格式化时在文档首自动添加 @format 标记 103 | 104 | # insertPragma: 105 | # insertPragma = false 106 | insertPragma = false 107 | 108 | # 是否对超过长度的 markdown 进行换行 109 | # "always" - 如果超出打印宽度,则将其换行 110 | # "never" - 将每一段拆成一行 111 | # "preserve" - 什么都不做,保持原样 112 | 113 | # proseWrap: "" 114 | # proseWrap = "preserve" 115 | proseWrap = "preserve" 116 | 117 | # 指定 HTML、Vue、Angular 和 Handlebars 的全局空白敏感度 118 | # "css" - 遵守 CSS display 属性的默认值,对于 Handlebars,视为 "strict" 119 | # "strict" - 所有标签周围的空格(或缺少空格)被认为是重要的 120 | # "ignore" - 所有标签周围的空格(或缺少空格)被认为是无关紧要的 121 | 122 | # htmlWhitespaceSensitivity: "" 123 | # htmlWhitespaceSensitivity = "css" 124 | htmlWhitespaceSensitivity = "css" 125 | 126 | # Vue 文件中 20 | 21 | 28 | 29 | 32 | -------------------------------------------------------------------------------- /docs/.vitepress/components/Forward/ForwardDocWithParams.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 19 | -------------------------------------------------------------------------------- /docs/.vitepress/components/Forward/posts.data.ts: -------------------------------------------------------------------------------- 1 | import { createContentLoader } from "vitepress"; 2 | 3 | export default createContentLoader("members/**/*.md", { 4 | includeSrc: true, // 包含原始 markdown 源? 5 | render: true, // 包含渲染的整页 HTML? 6 | // excerpt: true, // 包含摘录? 7 | }); 8 | -------------------------------------------------------------------------------- /docs/.vitepress/components/Link/BaseLink.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 21 | 22 | 31 | 32 | 37 | -------------------------------------------------------------------------------- /docs/.vitepress/components/Link/LinkContactUS.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 27 | 28 | 35 | 36 | 39 | -------------------------------------------------------------------------------- /docs/.vitepress/components/Link/LinkDiscord.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 21 | 22 | 29 | 30 | 33 | -------------------------------------------------------------------------------- /docs/.vitepress/components/Link/LinkQQGroup.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 21 | 22 | 29 | 30 | 33 | -------------------------------------------------------------------------------- /docs/.vitepress/config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitepress"; 2 | 3 | import { postsSidebar } from "./components/Forward/DocData"; 4 | import en from "./configs/en"; 5 | import zh_Hans from "./configs/zh-Hans"; 6 | 7 | // https://vitepress.dev/reference/site-config 8 | export default defineConfig({ 9 | // base: '/siyuan-developer-docs/', 10 | 11 | title: "SiYuan Community Docs", 12 | description: "Unofficial documentation for SiYuan Community", 13 | 14 | lastUpdated: true, 15 | 16 | // REF https://vitepress.dev/reference/site-config#markdown 17 | markdown: { 18 | lineNumbers: true, 19 | math: true, 20 | }, 21 | 22 | head: [ 23 | [ 24 | "link", 25 | { rel: "icon", type: "image/x-icon", href: "/static/favicon.ico" }, 26 | ], 27 | [ 28 | "script", 29 | { async: "", src: "https://www.googletagmanager.com/gtag/js?id=G-BGQE7HFD6W" }, 30 | ], 31 | [ 32 | "script", 33 | {}, 34 | `window.dataLayer = window.dataLayer || []; 35 | function gtag(){dataLayer.push(arguments);} 36 | gtag('js', new Date()); 37 | 38 | gtag('config', 'G-BGQE7HFD6W');`, 39 | ], 40 | ], 41 | 42 | // REF https://vitepress.dev/reference/default-theme-config 43 | themeConfig: { 44 | // REF https://vitepress.dev/reference/default-theme-config#logo 45 | logo: { 46 | light: "/static/logo/siyuan.svg", 47 | dark: "/static/logo/siyuan-dark.svg", 48 | alt: "SiYuan logo", 49 | }, 50 | 51 | outline: { 52 | level: "deep", 53 | }, 54 | 55 | nav: [ 56 | { text: "简体中文", link: "/zh-Hans/" }, 57 | { text: "English", link: "/en/" }, 58 | { 59 | text: "SiYuan", 60 | items: [ 61 | { text: "Homepage", link: "https://b3log.org/siyuan/en" }, 62 | { text: "Community", link: "https://liuyun.com/" }, 63 | { text: "Project team", link: "https://github.com/siyuan-note" }, 64 | { text: "Source repository", link: "https://github.com/siyuan-note/siyuan" }, 65 | ], 66 | }, 67 | ], 68 | 69 | sidebar: { 70 | "/contents/": { 71 | base: "/contents", 72 | items: postsSidebar, 73 | }, 74 | }, 75 | 76 | // REF https://vitepress.dev/reference/default-theme-config#sociallinks 77 | socialLinks: [ 78 | { icon: "github", link: "https://github.com/siyuan-community/siyuan-developer-docs" }, 79 | ], 80 | 81 | footer: { 82 | message: "Released under the AGPL-3.0 License.", 83 | copyright: "Copyright © 2023-present SiYuan Community", 84 | }, 85 | 86 | // REF https://vitepress.dev/reference/default-theme-search 87 | search: { 88 | provider: "local", 89 | options: { 90 | locales: { 91 | "zh-Hans": { 92 | translations: { 93 | button: { 94 | buttonText: "搜索文档", 95 | buttonAriaLabel: "搜索文档", 96 | }, 97 | modal: { 98 | noResultsText: "无法找到相关结果", 99 | resetButtonTitle: "清除查询条件", 100 | displayDetails: "显示详情列表", 101 | backButtonTitle: "返回", 102 | footer: { 103 | selectText: "确认", 104 | navigateText: "切换", 105 | closeText: "关闭", 106 | }, 107 | }, 108 | }, 109 | }, 110 | }, 111 | }, 112 | }, 113 | }, 114 | 115 | // REF https://vitepress.dev/guide/i18n 116 | locales: { 117 | "en": en.localeConfig, 118 | "zh-Hans": zh_Hans.localeConfig, 119 | }, 120 | 121 | vite: { 122 | server: { 123 | proxy: { 124 | "^/siyuan-sync/.*": { 125 | target: "https://siyuan-sync.b3logfile.com", 126 | changeOrigin: true, 127 | rewrite: (path) => path.replace(/^\/siyuan-sync/, ""), 128 | }, 129 | "^/siyuan-data/.*": { 130 | target: "https://siyuan-data.b3logfile.com", 131 | changeOrigin: true, 132 | rewrite: (path) => path.replace(/^\/siyuan-data/, ""), 133 | }, 134 | "^/bazaar/.*": { 135 | target: "http://bazaar.b3logfile.com", 136 | changeOrigin: true, 137 | rewrite: (path) => path.replace(/^\/bazaar/, ""), 138 | }, 139 | "^/oss/.*": { 140 | target: "https://oss.b3logfile.com", 141 | changeOrigin: true, 142 | rewrite: (path) => path.replace(/^\/oss/, ""), 143 | }, 144 | "^/ld246/.*": { 145 | target: "https://ld246.com", 146 | changeOrigin: true, 147 | rewrite: (path) => path.replace(/^\/ld246/, ""), 148 | }, 149 | }, 150 | }, 151 | build: { 152 | rollupOptions: { 153 | output: { 154 | assetFileNames: (assetInfo) => { 155 | // 检查文件的扩展名,避免对图片文件生成哈希 156 | if (/\.(?:png|jpg|jpeg|gif|svg)$/.test(assetInfo.name as string)) { 157 | return "assets/[name][extname]"; // 图片文件不包含哈希 158 | } 159 | return "assets/[name]-[hash][extname]"; // 其他文件使用默认命名方式 160 | }, 161 | }, 162 | }, 163 | }, 164 | }, 165 | }); 166 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2024 SiYuan Community 2 | // 3 | // This program is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU Affero General Public License as 5 | // published by the Free Software Foundation, either version 3 of the 6 | // License, or (at your option) any later version. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU Affero General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU Affero General Public License 14 | // along with this program. If not, see . 15 | 16 | // https://vitepress.dev/guide/custom-theme 17 | import "./style.css"; 18 | 19 | import { injectSpeedInsights } from "@vercel/speed-insights"; 20 | import Theme from "vitepress/theme"; 21 | import { h } from "vue"; 22 | 23 | // @ts-expect-error 类型 “ImportMeta” 上不存在属性 “glob” 24 | const modules = import.meta.glob("./../components/**/*.vue", { eager: true }); 25 | 26 | export default { 27 | ...Theme, 28 | Layout: () => { 29 | return h(Theme.Layout); 30 | }, 31 | enhanceApp(ctx) { 32 | for (const path in modules) { 33 | const mod = modules[path]; 34 | const paths = path.split("/"); 35 | const moduleName = paths[paths.length - 1].replace(".vue", ""); 36 | ctx.app.component(moduleName, mod.default); 37 | } 38 | injectSpeedInsights(); 39 | Theme.enhanceApp(ctx); 40 | // ... 41 | }, 42 | }; 43 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/style.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Customize default theme styling by overriding CSS variables: 3 | * https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css 4 | */ 5 | 6 | /** 7 | * Colors 8 | * -------------------------------------------------------------------------- */ 9 | 10 | :root { 11 | --vp-c-brand: #646cff; 12 | --vp-c-brand-light: #747bff; 13 | --vp-c-brand-lighter: #9499ff; 14 | --vp-c-brand-lightest: #bcc0ff; 15 | --vp-c-brand-dark: #535bf2; 16 | --vp-c-brand-darker: #454ce1; 17 | --vp-c-brand-dimm: rgba(100, 108, 255, 0.08); 18 | } 19 | 20 | /** 21 | * Component: Button 22 | * -------------------------------------------------------------------------- */ 23 | 24 | :root { 25 | --vp-button-brand-border: var(--vp-c-brand-light); 26 | --vp-button-brand-text: var(--vp-c-white); 27 | --vp-button-brand-bg: var(--vp-c-brand); 28 | --vp-button-brand-hover-border: var(--vp-c-brand-light); 29 | --vp-button-brand-hover-text: var(--vp-c-white); 30 | --vp-button-brand-hover-bg: var(--vp-c-brand-light); 31 | --vp-button-brand-active-border: var(--vp-c-brand-light); 32 | --vp-button-brand-active-text: var(--vp-c-white); 33 | --vp-button-brand-active-bg: var(--vp-button-brand-bg); 34 | } 35 | 36 | /** 37 | * Component: Home 38 | * -------------------------------------------------------------------------- */ 39 | 40 | :root { 41 | --vp-home-hero-name-color: transparent; 42 | --vp-home-hero-name-background: -webkit-linear-gradient(120deg, #bd34fe 30%, #41d1ff); 43 | 44 | --vp-home-hero-image-background-image: linear-gradient(-45deg, #bd34fe 50%, #47caff 50%); 45 | --vp-home-hero-image-filter: blur(40px); 46 | } 47 | 48 | @media (min-width: 640px) { 49 | :root { 50 | --vp-home-hero-image-filter: blur(56px); 51 | } 52 | } 53 | 54 | @media (min-width: 960px) { 55 | :root { 56 | --vp-home-hero-image-filter: blur(72px); 57 | } 58 | } 59 | 60 | /** 61 | * Component: Custom Block 62 | * -------------------------------------------------------------------------- */ 63 | 64 | :root { 65 | --vp-custom-block-tip-border: var(--vp-c-brand); 66 | --vp-custom-block-tip-text: var(--vp-c-brand-darker); 67 | --vp-custom-block-tip-bg: var(--vp-c-brand-dimm); 68 | } 69 | 70 | .dark { 71 | --vp-custom-block-tip-border: var(--vp-c-brand); 72 | --vp-custom-block-tip-text: var(--vp-c-brand-lightest); 73 | --vp-custom-block-tip-bg: var(--vp-c-brand-dimm); 74 | } 75 | 76 | /** 77 | * Component: Algolia 78 | * -------------------------------------------------------------------------- */ 79 | 80 | .DocSearch { 81 | --docsearch-primary-color: var(--vp-c-brand) !important; 82 | } 83 | -------------------------------------------------------------------------------- /docs/contents/[doc].md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/contents/[doc].paths.ts: -------------------------------------------------------------------------------- 1 | import { posts } from "../.vitepress/components/Forward/DocData"; 2 | 3 | export default { 4 | paths() { 5 | const results = posts.map((item) => ({ 6 | params: { 7 | doc: item.filename, 8 | ...item, 9 | }, 10 | })); 11 | return results; 12 | }, 13 | }; 14 | -------------------------------------------------------------------------------- /docs/en/contents/[doc].md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/en/contents/[doc].paths.ts: -------------------------------------------------------------------------------- 1 | import { posts } from "../../.vitepress/components/Forward/DocData"; 2 | 3 | export default { 4 | paths() { 5 | const results = posts.filter((i) => i.locale === "en").map((item) => ({ 6 | params: { 7 | doc: item.filenameWithoutLocale, 8 | ...item, 9 | }, 10 | })); 11 | return results; 12 | }, 13 | }; 14 | -------------------------------------------------------------------------------- /docs/en/guide/icon/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/en/guide/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | - [Icon development](./icon/) 6 | - [Plugin development](./plugin/) 7 | - [Template development](./template/) 8 | - [Theme development](./theme/) 9 | - [Widget development](./widget/) 10 | -------------------------------------------------------------------------------- /docs/en/guide/plugin/development/siyuan-plugin-cli.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: siyuan-plugin-cli tool 3 | locale: zh 4 | document: 20241002194147-b3nhpsy 5 | notebook: Life 6 | hpath: /杂项关注/思源笔记/思源插件开发Tips/siyuan-plugin-cli/siyuan-plugin-cli EN 7 | export: '2024-10-02 19:46:56' 8 | --- 9 | 10 | [siyuan-plugin-cli](https://www.npmjs.com/package/siyuan-plugin-cli) is an npm cli program that provides some tools for SiYuan plugin development. 11 | 12 | Installation: 13 | 14 | ```bash 15 | npm install -g siyuan-plugin-cli 16 | ``` 17 | 18 | ## Basic Functions 19 | 20 | ### Create Plugin Project in Terminal 21 | 22 | Run `npx create-sy-plugin`​ or `npx create-plugin`​, to create a plugin from a template. 23 | 24 | This command provides an interactive command line: 25 | 26 | - Enter the basic information of the plugin 27 | - Select the plugin template 28 | - Create the plugin project from the template (essentially `git clone`​ to local) 29 | - Update the basic information of the local plugin project's package.json and plugin.json 30 | 31 | You can also choose whether to upload the plugin to GitHub directly. If you agree, the cli program will: 32 | 33 | - Automatically create a new repository 34 | 35 | - This may require you to enter the GitHub API key 36 | - You can cache it locally after entering it once (stored in the `~/.siyuan-plugin-cli`​ file), so you don't need to re-enter it next time 37 | 38 | - Apply to automatically enable the repository's workflow permissions to directly use the relevant ci scripts in the template 39 | - Push the local files to the remote repository 40 | 41 | ​![image](/frostime/image-20241002191846-5prokwg.png) 42 | 43 | ### make-link and make-install 44 | 45 | To facilitate the quick import of developed plugins into SiYuan for debugging and running, the cli program provides two commands. 46 | 47 | - ​`npx make-link`​ creates a symbolic link to the SiYuan plugin directory 48 | 49 | - Links the `dev`​ directory under plugin development to the `plugins`​ directory under the SiYuan plugin directory 50 | - Note: On Windows, it is recommended to run `npx make-link-win` 51 | 52 | - ​`npx make-install`​ installs the plugin to the SiYuan plugin directory 53 | 54 | - Copies the files in the `dist`​ directory under plugin development to the SiYuan plugin directory 55 | 56 | > ⚠️ Note: **On Windows, administrator privileges are required to create symbolic links**. You have two options: 57 | > 58 | > 1. Run `npx make-link`​ in administrator mode 59 | > 2. Use `npx make-link-win`​ to automatically request administrator privileges. 60 | 61 | When running these two commands, please ensure that SiYuan is running, so the program will first automatically obtain all workspaces, and then the user can select which workspace to bind to. 62 | 63 | ```bash 64 | ❯❯❯ npx make-link 65 | >>> Try to visit constant "targetDir" in make_dev_link.js... 66 | >>> Constant "targetDir" is empty, try to get SiYuan directory automatically.... 67 | >>> Got 2 SiYuan workspaces 68 | [0] C:\Users\EEG\Documents\思源笔记 69 | [1] H:\临时文件夹\SiYuanDevSpace 70 | Please select a workspace[0-1]: 71 | ``` 72 | 73 | ​`make-link`​ uses the `./dev`​ directory as the plugin development directory by default; `make-install`​ uses the `./dist`​ directory as the compiled plugin files by default. You can pass other directory paths after the command to change the default options, for example: 74 | 75 | ```bash 76 | npx make-install ./build 77 | ``` 78 | 79 | ### `update-version`​/`up-ver` 80 | 81 | Running `npx update-version`​ (`up-ver`​ is the short version of the command) will automatically update the `version`​ field in `package.json`​ and `plugin.json`​, avoiding manual changes. 82 | 83 | ```bash 84 | ❯❯❯ npx update-version 85 | 86 | 🌟 Current version: 0.1.0 87 | 88 | 🔄 How would you like to update the version? 89 | 90 | 1️⃣ Auto update patch version (new version: 0.1.1) 91 | 2️⃣ Auto update minor version (new version: 0.2.0) 92 | 3️⃣ Auto update major version (new version: 1.0.0) 93 | 4️⃣ Input version manually 94 | 0️⃣ Quit without updating 95 | 96 | 👉 Please choose (1/2/3/4): 97 | ``` 98 | 99 | You can also pass `patch`​, `minor`​, `major`​ parameters to directly specify the version level to change. 100 | -------------------------------------------------------------------------------- /docs/en/guide/plugin/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | - [SiYuan Plugin Development Quick Start](./sy-plugin-dev-quick-start.md) 6 | - Others 7 | - [siyuan-plugin-cli](./development/siyuan-plugin-cli.md) 8 | -------------------------------------------------------------------------------- /docs/en/guide/template/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/en/guide/theme/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/en/guide/widget/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/en/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | # https://vitepress.dev/reference/default-theme-home-page 3 | layout: home 4 | 5 | hero: 6 | name: "SiYuan Developer Documentation" 7 | text: "For all of SiYuan community developers" 8 | tagline: Make community developers happier! 9 | actions: 10 | - theme: brand 11 | text: Developer Guide 12 | link: ./guide/ 13 | - theme: brand 14 | text: Developer Reference 15 | link: ./reference/ 16 | 17 | - theme: alt 18 | text: SiYuan Homepage 19 | link: https://b3log.org/siyuan/en 20 | - theme: alt 21 | text: SiYuan Community 22 | link: https://liuyun.io/ 23 | - theme: alt 24 | text: SiYuan Project Team 25 | link: https://github.com/siyuan-note 26 | --- 27 | -------------------------------------------------------------------------------- /docs/en/reference/api/kernel/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/en/reference/api/plugin/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/en/reference/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/en/reference/manifest/icon.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/en/reference/manifest/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/en/reference/manifest/plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/en/reference/manifest/template.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/en/reference/manifest/theme.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/en/reference/manifest/widget.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | # REF https://vitepress.dev/reference/default-theme-home-page 3 | layout: home 4 | 5 | hero: 6 | name: "SiYuan Community Documentation" 7 | text: "High-quality content from Siyuan Community" 8 | actions: 9 | - theme: brand 10 | text: 简体中文 11 | link: /zh-Hans/ 12 | - theme: brand 13 | text: English 14 | link: /en/ 15 | --- 16 | -------------------------------------------------------------------------------- /docs/members/index-en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Introduce 3 | order: 999 4 | --- 5 | 6 | # Introduce 7 | -------------------------------------------------------------------------------- /docs/members/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 介绍 3 | order: 999 4 | --- 5 | 6 | # 介绍 7 | -------------------------------------------------------------------------------- /docs/members/wetoria/assets/image-20240809103732573.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/members/wetoria/assets/image-20240809103732573.png -------------------------------------------------------------------------------- /docs/members/wetoria/assets/image-20240809104307435.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/members/wetoria/assets/image-20240809104307435.png -------------------------------------------------------------------------------- /docs/members/wetoria/assets/image-20240809104314347.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/members/wetoria/assets/image-20240809104314347.png -------------------------------------------------------------------------------- /docs/members/wetoria/contribute-zh.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 如何为思源社区贡献内容 3 | order: 998 4 | --- 5 | 6 | # 如何贡献社区文档的内容 7 | 8 | 思源开发者社区离不开大家的共同维护,也欢迎新朋友参与到文档编辑工作中来。 9 | 10 | ## 我不会弄这么复杂的东西,该如何做?{#my-anchor} 11 | 12 | 如果你觉得这些东西很复杂的话,你可以直接在 [论坛](https://ld246.com/) 中发布你的内容。 13 | 14 | 社区成员关注到你的内容后,将会帮助你把文档放到对应的位置。 15 | 16 | ## Community 成员如何贡献 17 | 18 | 感谢 [@Wetoria](https://wetoria.me) 及 [@terwer](https://github.com/terwer) 的贡献。 19 | 20 | **现在,你可以通过思源,直接发布文章到此站 🎉。** 21 | 22 | ### 使用思源直接发布文章 23 | 24 | 在集市中,安装发布工具(siyuan-plugin-publisher),并配置好 `VitePress` 的授权,即可将文档快速发布到此站。 25 | 26 | 参考配置如下: 27 | 28 | image-20240809104307435 29 | 30 | image-20240809104314347 31 | 32 | ### 多语言 33 | 34 | 思源社区文档目前支持简中(zh-Hans)、英文(en),如果你愿意为英文用户提供贡献,你可以创建多语言版本的文档。 35 | 36 | 为了书写体验,在处理文章多语言时,使用的是如下 locale 列表: 37 | 38 | - zh 39 | - en 40 | 41 | 根据后续说明的规则增加上述 `locale` 配置,即可自动将文章归类到不同语言下。 42 | 43 | 你可以使用下面两种模式,来创建不同版本的文章: 44 | 45 | 1. 使用文件名 46 | 2. 使用 `frontmatter` 47 | 48 | --- 49 | 50 | #### 使用文件名 51 | 52 | 当你使用文件名时,将会按照 `-[locale]` 对文件名进行匹配。 53 | 54 | 比如这篇文档的文件名为 `contribute-zh.md`,将会归类到中文语言下。 55 | 56 | 同样的,本篇的英文版本 `contribute-en.md`,将会归类到英文语言下。 57 | 58 | ::: tip 59 | 60 | 如果后缀并非 `-[locale]` ,则默认归类到中文语言下。 61 | 62 | ::: 63 | 64 | #### 使用 `frontmatter` 65 | 66 | 在你的文章顶部,使用 YAML frontmatter 配置 `locale` 参数,即可将文章归类到对应语言下。 67 | 68 | 参考配置: 69 | 70 | ```markdown 71 | --- 72 | title: Title of a article 73 | local: 'en' // [!code focus] 74 | --- 75 | 76 | 77 | ``` 78 | 79 | 你的这篇 `Title of a article` 将会在英文环境下显示。 80 | 81 | ### 文章发布逻辑 82 | 83 | 当你在 `members/[yours]/` 下发布了文章以后,你可以在 [这里](/contents/) 查看所有的文章列表。 84 | 85 | 对应的 i18n 版本,将会全部列在多语言对应的 `/[locale]/contents` 目录下。 你可以在 [这里](/zh-Hans/contents/) 查看一个示例。 86 | 87 | #### 如何将文档归类到对应的页面下 88 | 89 | 在仓库 `/docs/.vitepress/components/Forward` 里,提供了 `ForwardDoc.vue` 组件。 90 | 91 | 你只需要按照下面的方式使用,就能在页面中嵌入你的文档内容。支持选择行范围,具体请参考 [包含 markdown 文件](https://vitepress.dev/zh/guide/markdown#markdown-file-inclusion)。 92 | 93 | ```vue 94 | 97 | // 为了防止死循环,尖括号加了空格 98 | < !--@include: ../../members/wetoria/contribute-zh.md-- > 99 | 100 | ``` 101 | 102 | 参数 `member` 为你的文件夹名称,目的是为了在嵌入时能正确地获取图片资源。 103 | 104 | :::warning 105 | 106 | 1. 目前没有处理使用相对路径的链接。如果你的文章中使用了相对路径,将有可能出现跳转 404 的问题。 107 | 108 | 在自动生成的 `contents` 目录下使用是没有问题的。 109 | 110 | 2. 如果并非 `members` 目录下的文件,请先不要使用该组件。 111 | 112 | 组件内部简单地对图片进行了处理,使用其他路径可能会出现问题。 113 | 114 | ::: 115 | 116 | ### 注意事项 & 公约 117 | 118 | #### 1. 配置发布工具的注意事项 119 | 120 | 请将发布工具的 121 | 122 | 1. `存储目录` 设置为 `docs/members/[yourname]`。 123 | 2. `图片存储目录` 设置为上述 `存储目录` 下的 `assets`,即 `docs/members/[yourname]/assets`。 124 | 125 | #### 2. 发布文章前,调整发布工具的 YAML 配置 126 | 127 | 为了更好的展示内容,请在发布文章前,在 `发布工具` 的设置中选择 `源码模式`,去掉如下部分: 128 | 129 | ```yaml 130 | --- 131 | title: 如何贡献 132 | date: '2024-08-09 04:25:29' 133 | head: [] 134 | outline: deep 135 | sidebar: false // [!code --] 136 | prev: false // [!code --] 137 | next: false // [!code --] 138 | --- 139 | ``` 140 | 141 | #### 3. 手动编写的 MD 文件 142 | 143 | 如果你是手动创建的 MD 文件,为了更好的在侧边栏中显示你的内容,请在顶部的 frontmatter 配置中设置好 `title`。 144 | 145 | 比如 [测试发布插件](./test-plug-in-plug-in-z1gpive),的文件名为 `test-plug-in-plug-in-z1gpive.md`,但在左侧 `Sidebar` 中展示的为 `测试发布插件`。 146 | 147 | #### 4. 关于文章顺序 148 | 149 | 为了让各位 Community 成员更方便地发布内容,并且不需要专门配置目录。本仓库采用按人划分目录的方式。这样你可以直接通过发布插件一键发布内容。 150 | 151 | :::info 152 | 153 | VitePress 采用按目录划分的方式规划页面。 154 | 155 | ::: 156 | 157 | 为了让所有人的内容能够集中展示,在发布站点时,会自动根据成员内容生成左侧 `SideBar` 中的内容,就像你在本页 👈 左侧看到的那样。 158 | 159 | --- 160 | 161 | 考虑到文章展示的顺序,将会按照最后更新时间进行排序。 162 | 163 | 因此,除非正常更新,请不要恶意通过调整更新时间的方式恶意影响排序。 164 | 165 | 否则,社区人员有权删除你的文档,情节严重者将取消组织成员身份。 166 | 167 | #### 5. 关于图片 168 | 169 | 在编写时,请将图片放置在你的 `个人目录/assets` 下,并确保文章中的图片地址采用的是 `相对路径` 的方式。 170 | 171 | 就像本篇前面两张图片一样,插入的内容为: 172 | 173 | ``` 174 | ![image-20240809103113857](./assets/image-20240809103113857.png) 175 | 176 | ![image-20240809103130681](./assets/image-20240809103130681.png) 177 | ``` 178 | 179 | 如果直接编写 MD 文档,可以使用 Typora 直接粘贴。相关配置如下: 180 | 181 | ![image-20240809103732573](./assets/image-20240809103732573.png) 182 | 183 | ## 非 Community 成员如何贡献 184 | 185 | 鉴于之前思源社区发生过恶意删库事件,因此并非所有人都能立马加入组织使用上述方式参与共建。 186 | 187 | 但是不加入组织并非就不能参与贡献,你依旧可以使用下面两种方式参与共建: 188 | 189 | ### 论坛发帖 190 | 191 | 你可以按照 [前面说的方式](#my-anchor),在论坛中发布你的内容参与贡献。 192 | 193 | ### 提交 PR 194 | 195 | 你也可以通过 fork [siyuan-developer-docs](https://github.com/siyuan-community/siyuan-developer-docs) 这个仓库,按照上面同样的方式创建你的内容,以 PR 的方式参与贡献。 196 | 197 | ## 获取支持 198 | 199 | 如果你需要帮助 联系我们。 200 | -------------------------------------------------------------------------------- /docs/members/wetoria/test-plug-in-plug-in-z1gpive.md: -------------------------------------------------------------------------------- 1 | 测试发布插件 2 | 3 | 这是新增内容 4 | 5 | 123 6 | -------------------------------------------------------------------------------- /docs/public/frostime/6317cf25a7642e03e6e142e1eaa8c434-20240801114854-7w3nmxe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/6317cf25a7642e03e6e142e1eaa8c434-20240801114854-7w3nmxe.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240731175413-cyqym0q.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240731175413-cyqym0q.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240731195519-xgw9ya7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240731195519-xgw9ya7.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240731201659-bli82ae.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240731201659-bli82ae.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815182549-k81nkl3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815182549-k81nkl3.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815182918-mprnmn9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815182918-mprnmn9.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815183249-vol0uoa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815183249-vol0uoa.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815185213-pufh1pw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815185213-pufh1pw.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815191851-hi4lrbv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815191851-hi4lrbv.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815192530-ziu4ke1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815192530-ziu4ke1.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815194618-9qc8lbb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815194618-9qc8lbb.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815194704-kppabzx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815194704-kppabzx.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815195839-n430ijr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815195839-n430ijr.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815200507-fxu576j.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815200507-fxu576j.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815201644-tlatb7s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815201644-tlatb7s.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815213424-c6nqqm4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815213424-c6nqqm4.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815214009-h8jy59d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815214009-h8jy59d.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815225754-zkhd49o.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815225754-zkhd49o.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240815230000-kp6d11u.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240815230000-kp6d11u.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240825114150-lih9rwa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240825114150-lih9rwa.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240825114418-7gwkj8u.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240825114418-7gwkj8u.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240825114433-rjgqchg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240825114433-rjgqchg.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240825114713-gkyqy1h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240825114713-gkyqy1h.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240825114905-6t5y0w7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240825114905-6t5y0w7.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240825115954-nbke1nt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240825115954-nbke1nt.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20240825122938-duieqmr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20240825122938-duieqmr.png -------------------------------------------------------------------------------- /docs/public/frostime/image-20241002191846-5prokwg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/frostime/image-20241002191846-5prokwg.png -------------------------------------------------------------------------------- /docs/public/static/asset-img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/asset-img.png -------------------------------------------------------------------------------- /docs/public/static/development/storybook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/development/storybook.png -------------------------------------------------------------------------------- /docs/public/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/favicon.ico -------------------------------------------------------------------------------- /docs/public/static/logo/siyuan-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | SiYuan 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/public/static/logo/siyuan-fill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/logo/siyuan-fill.png -------------------------------------------------------------------------------- /docs/public/static/logo/siyuan-fill.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | SiYuan 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/public/static/logo/siyuan-opaque.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/logo/siyuan-opaque.png -------------------------------------------------------------------------------- /docs/public/static/logo/siyuan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/logo/siyuan.png -------------------------------------------------------------------------------- /docs/public/static/logo/siyuan.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | SiYuan 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/public/static/user-interface/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/user-interface/layout.png -------------------------------------------------------------------------------- /docs/public/static/user-interface/topbar-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/user-interface/topbar-1.png -------------------------------------------------------------------------------- /docs/public/static/user-interface/topbar-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/user-interface/topbar-2.png -------------------------------------------------------------------------------- /docs/public/static/widget/.img: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/public/static/widget/Pasted image 20231204153852.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/widget/Pasted image 20231204153852.png -------------------------------------------------------------------------------- /docs/public/static/widget/Pasted image 20231204161953.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/widget/Pasted image 20231204161953.png -------------------------------------------------------------------------------- /docs/public/static/widget/Pasted image 20231204162145.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/widget/Pasted image 20231204162145.png -------------------------------------------------------------------------------- /docs/public/static/widget/Pasted image 20231204162525.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/widget/Pasted image 20231204162525.png -------------------------------------------------------------------------------- /docs/public/static/widget/Pasted image 20231204162655.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/widget/Pasted image 20231204162655.png -------------------------------------------------------------------------------- /docs/public/static/widget/Pasted image 20231204163237.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/widget/Pasted image 20231204163237.png -------------------------------------------------------------------------------- /docs/public/static/widget/Pasted image 20231204163314.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/public/static/widget/Pasted image 20231204163314.png -------------------------------------------------------------------------------- /docs/snippets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siyuan-community/siyuan-developer-docs/0e080265deb46bde685b5adab57bdf455dff5ad7/docs/snippets/.keep -------------------------------------------------------------------------------- /docs/snippets/examples/manifest/base.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.siyuan-note.club/schemas/manifest/base.schema.json", 3 | "name": "example-name", 4 | "author": "Author Name Example", 5 | "url": "https://github.com/example-username/example-repository-name", 6 | "version": "0.1.0", 7 | "minAppVersion": "2.8.8", 8 | "keywords": [ 9 | "example", 10 | "示例" 11 | ], 12 | "displayName": { 13 | "default": "Example Name", 14 | "zh_CHT": "示例名稱", 15 | "zh_CN": "示例名称" 16 | }, 17 | "description": { 18 | "default": "Descriptive information about this example", 19 | "zh_CHT": "關於本示例的描述信息", 20 | "zh_CN": "关于本示例的描述信息" 21 | }, 22 | "readme": { 23 | "default": "README.md", 24 | "en_US": "README_en_US.md", 25 | "zh_CN": "README_zh_CN.md" 26 | }, 27 | "funding": { 28 | "openCollective": "siyuan", 29 | "patreon": "", 30 | "github": "88250", 31 | "custom": [ 32 | "https://ld246.com/sponsor" 33 | ] 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /docs/snippets/examples/manifest/icon.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.siyuan-note.club/schemas/manifest/icon.schema.json", 3 | "name": "icon-sample", 4 | "author": "Vanessa", 5 | "url": "https://github.com/siyuan-note/icon-sample", 6 | "version": "0.0.3", 7 | "minAppVersion": "2.8.8", 8 | "displayName": { 9 | "default": "Icon Sample", 10 | "zh_CN": "图标示例" 11 | }, 12 | "description": { 13 | "default": "This is a icon sample", 14 | "zh_CN": "这是一个图标示例" 15 | }, 16 | "readme": { 17 | "default": "README.md", 18 | "zh_CN": "README_zh_CN.md" 19 | }, 20 | "funding": { 21 | "openCollective": "", 22 | "patreon": "", 23 | "github": "", 24 | "custom": [ 25 | "https://ld246.com/sponsor" 26 | ] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /docs/snippets/examples/manifest/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.siyuan-note.club/schemas/manifest/plugin.schema.json", 3 | "name": "plugin-sample", 4 | "author": "Vanessa", 5 | "url": "https://github.com/siyuan-note/plugin-sample", 6 | "version": "0.2.7", 7 | "minAppVersion": "2.10.13", 8 | "keywords": [ 9 | "sample", 10 | "示例" 11 | ], 12 | "backends": [ 13 | "windows", 14 | "linux", 15 | "darwin" 16 | ], 17 | "frontends": [ 18 | "desktop", 19 | "desktop-window" 20 | ], 21 | "displayName": { 22 | "default": "Plugin Sample", 23 | "zh_CN": "插件示例" 24 | }, 25 | "description": { 26 | "default": "This is a plugin sample", 27 | "zh_CN": "这是一个插件示例" 28 | }, 29 | "readme": { 30 | "default": "README.md", 31 | "zh_CN": "README_zh_CN.md" 32 | }, 33 | "funding": { 34 | "openCollective": "", 35 | "patreon": "", 36 | "github": "", 37 | "custom": [ 38 | "https://ld246.com/sponsor" 39 | ] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /docs/snippets/examples/manifest/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.siyuan-note.club/schemas/manifest/template.schema.json", 3 | "name": "template-sample", 4 | "author": "Vanessa", 5 | "url": "https://github.com/siyuan-note/template-sample", 6 | "version": "0.0.3", 7 | "minAppVersion": "2.9.0", 8 | "displayName": { 9 | "default": "Template Sample", 10 | "zh_CN": "模板示例" 11 | }, 12 | "description": { 13 | "default": "This is a template sample", 14 | "zh_CN": "这是一个模板示例" 15 | }, 16 | "readme": { 17 | "default": "README.md", 18 | "zh_CN": "README_zh_CN.md" 19 | }, 20 | "funding": { 21 | "openCollective": "", 22 | "patreon": "", 23 | "github": "", 24 | "custom": [ 25 | "https://ld246.com/sponsor" 26 | ] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /docs/snippets/examples/manifest/theme.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.siyuan-note.club/schemas/manifest/theme.schema.json", 3 | "name": "theme-sample", 4 | "author": "Vanessa", 5 | "url": "https://github.com/siyuan-note/theme-sample", 6 | "version": "0.0.3", 7 | "minAppVersion": "2.8.8", 8 | "displayName": { 9 | "default": "Theme Sample", 10 | "zh_CN": "主题示例" 11 | }, 12 | "description": { 13 | "default": "This is a theme sample", 14 | "zh_CN": "这是一个主题示例" 15 | }, 16 | "readme": { 17 | "default": "README.md", 18 | "zh_CN": "README_zh_CN.md" 19 | }, 20 | "funding": { 21 | "openCollective": "", 22 | "patreon": "", 23 | "github": "", 24 | "custom": [ 25 | "https://ld246.com/sponsor" 26 | ] 27 | }, 28 | "modes": [ 29 | "light" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /docs/snippets/examples/manifest/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.siyuan-note.club/schemas/manifest/widget.schema.json", 3 | "name": "widget-sample", 4 | "author": "Vanessa", 5 | "url": "https://github.com/siyuan-note/widget-sample", 6 | "version": "0.0.3", 7 | "minAppVersion": "2.8.8", 8 | "displayName": { 9 | "default": "Widget Sample", 10 | "zh_CN": "挂件示例" 11 | }, 12 | "description": { 13 | "default": "This is a widget sample", 14 | "zh_CN": "这是一个挂件示例" 15 | }, 16 | "readme": { 17 | "default": "README.md", 18 | "zh_CN": "README_zh_CN.md" 19 | }, 20 | "funding": { 21 | "openCollective": "", 22 | "patreon": "", 23 | "github": "", 24 | "custom": [ 25 | "https://ld246.com/sponsor" 26 | ] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /docs/zh-Hans/about/contribute.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 贡献内容 6 | 7 | 思源开发者社区离不开大家的共同维护,也欢迎新朋友参与到文档编辑工作中来。 8 | 9 | ## 我不会弄这么复杂的东西,该如何做? 10 | 11 | 如果这些东西很复杂的话,你可以直接在论坛中发贴你的内容,标题上写上[siyuan-developer-docs],我们可以帮助你把文档放到对应的位置。 12 | 13 | ## 如何深度贡献你的文档 14 | 15 | 如果你想深度参与到本站的建设中,需要你稍微了解一些计算机相关的知识: 16 | 17 | 1. git / github 18 | 2. node / npm / pnpm 19 | 3. vuepress 20 | 4. 编辑器的使用,例如vscode 21 | 22 | ### Fork代码及clone 23 | 24 | 首先,你需要在github上fork[本工程](https://github.com/siyuan-community/siyuan-developer-docs), 例如https://github.com/zuoez02/siyuan-developer-docs,然后再clone到本地。 25 | 关于git如何使用,推荐这篇文章 [还不会使用 GitHub ? GitHub 教程来了!万字图文详解](https://zhuanlan.zhihu.com/p/369486197) 26 | 27 | ```bash 28 | git clone https://github.com/YOUR-NAME/siyuan-developer-docs 29 | ``` 30 | 31 | ### 安装依赖 32 | 33 | 在编辑器中打开工程,然后需要你本地已安装好node,并以安装好pnpm 34 | 关于如何安装node、pnpm,推荐这两篇文章: [如何安装Nodejs](https://www.runoob.com/nodejs/nodejs-install-setup.html), [如何安装Pnpm](https://juejin.cn/post/7207094325897297957) 35 | 36 | ```bash 37 | pnpm install 38 | ``` 39 | 40 | ### 开始编辑 41 | 42 | 如果你已经掌握了这些知识,可以开始本地调试模式并编写文章啦 43 | 44 | ```bash 45 | pnpm run docs:dev 46 | ``` 47 | 48 | ### 发布你的代码及Pull Request 49 | 50 | 使用git命令推送你的代码 51 | 52 | ```bash 53 | git add . 54 | git commit -m "your commit message" 55 | git push 56 | ``` 57 | 58 | 然后在Github上提交PR申请,交由社区文档维护者审核即可,可以参考这篇文章: [如何在 GitHub 提交第一个 pull request - freeCodeCamp.org](https://www.freecodecamp.org/chinese/news/how-to-make-your-first-pull-request-on-github/) 59 | -------------------------------------------------------------------------------- /docs/zh-Hans/about/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | --- 4 | 5 | 53 | 54 | 55 | 56 | 57 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /docs/zh-Hans/bazaar/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | --- 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/zh-Hans/contents/[doc].md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/zh-Hans/contents/[doc].paths.ts: -------------------------------------------------------------------------------- 1 | import { posts } from "../../.vitepress/components/Forward/DocData"; 2 | 3 | export default { 4 | paths() { 5 | const results = posts.filter((i) => i.locale === "zh").map((item) => ({ 6 | params: { 7 | doc: item.filenameWithoutLocale, 8 | ...item, 9 | }, 10 | })); 11 | return results; 12 | }, 13 | }; 14 | -------------------------------------------------------------------------------- /docs/zh-Hans/guide/icon/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/zh-Hans/guide/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | - [图标开发](./icon/) 6 | - [插件开发](./plugin/) 7 | - [模板开发](./template/) 8 | - [主题开发](./theme/) 9 | - [挂件开发](./widget/) 10 | -------------------------------------------------------------------------------- /docs/zh-Hans/guide/plugin/development/community.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 社区资源 6 | 7 | 思源社区在发展的过程中,有热心的开发者为插件开发编写了一些工具包。这里做一些简单介绍 8 | 9 | ## `siyuan-package-custom-block` 10 | 11 | | 作者 | github | npm | 语言环境 | 12 | | ------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -------- | 13 | | zuoez02 | [siyuan-package-custom-block](https://github.com/zuoez02/siyuan-package-custom-block) | [siyuan-package-custom-block](https://www.npmjs.com/package/siyuan-package-custom-block) | | 14 | 15 | 用于协助开发者控制基于HTML块的自定义块工具。 16 | 17 | ### 代码示例 18 | 19 | ```javascript 20 | const siyuan = require("siyuan"); 21 | const { CustomBlock, CustomBlockManager } = require("siyuan-package-custom-block"); 22 | 23 | class CarouselBlock extends CustomBlock { 24 | static type = "CarouselBlock"; 25 | static css = ".hello { color: red; }"; 26 | 27 | onMount(el, data) { 28 | console.log("hello world"); 29 | el.insertAdjacentHTML("afterbegin", `
hello ${data.name}
`); 30 | } 31 | } 32 | 33 | module.exports = class P extends siyuan.Plugin { 34 | onload() { 35 | CustomBlockManager.init(this); 36 | CustomBlockManager.load(CarouselBlock); 37 | const content = CustomBlockManager.buildBlock("CarouselBlock", { 38 | name: "123", 39 | }); 40 | // use content for paste in editor. 41 | console.log(content); 42 | } 43 | }; 44 | ``` 45 | 46 | ## `sy-plugin-changelog` 47 | 48 | | 作者 | github | npm | 语言环境 | 49 | | -------- | ---------------------------------------------------------------------- | ------------------------------------------------------------------------ | ---------- | 50 | | frostime | [sy-plugin-changelog](https://github.com/frostime/sy-plugin-changelog) | [sy-plugin-changelog](https://www.npmjs.com/package/sy-plugin-changelog) | typescript | 51 | 52 | 这个包可以可以帮开发者在插件更新的时候展示更新日志。主要用法如下: 53 | 54 | 1. 安装依赖 55 | 56 | > pnpm add -D sy-plugin-changelog 57 | 58 | 2. 在自己的代码中导入, 并将 `this` 作为参数传入 `changelog` 当中 59 | 60 | ```ts 61 | import { changelog } from "sy-plugin-changelog"; 62 | 63 | export default class PluginSample extends Plugin { 64 | async onload() { 65 | // ... everything done 66 | changelog(this); 67 | } 68 | } 69 | ``` 70 | 71 | 3. 请在 i18n 目录下新建文件 `CHANGELOG--.md` 文件, 并保证被加入打包当中 72 | 73 | - 例如: i18n/CHANGELOG-zh_CN-0.0.2.md 74 | - `` 应当和思源 `window.siyuan.config.lang` 一致, 例如: zh_CN 75 | - `` 应当和 plugin.json 中 version 字段一致, 且格式为 `/\d+\.\d+\.\d+/`, 如 `1.1.2` 76 | 77 | 更多详细的用法, 请阅读文档。 78 | 79 | ## `zhi-siyuan-api` 80 | 81 | | 作者 | github | npm | 语言环境 | 82 | | ------ | ----------------------------------------------- | -------------------------------------------------------------- | -------- | 83 | | terwer | [zhi-siyuan-api](https://github.com/terwer/zhi) | [zhi-siyuan-api](https://www.npmjs.com/package/zhi-siyuan-api) | ? | 84 | 85 | #TODO 86 | 87 | ## `siyuan-sdk` 88 | 89 | | 作者 | GitHub 仓库 | npm | 语言环境 | 90 | | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | 91 | | Zuoqiu-Yingyi | [siyuan-community/siyuan-sdk](https://github.com/siyuan-community/siyuan-sdk)
[![GitHub 最新发行版本 (最新一次发行/预发行)](https://img.shields.io/github/v/release/siyuan-community/siyuan-sdk?include_prereleases&style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-custom-fonts/releases/latest) | [@siyuan-community/siyuan-sdk](https://www.npmjs.com/package/@siyuan-community/siyuan-sdk)
[![NPM 版本](https://img.shields.io/npm/v/%40siyuan-community/siyuan-sdk?style=flat-square)](https://www.npmjs.com/package/@siyuan-community/siyuan-sdk?activeTab=versions) | JavaScript / TypeScript | 92 | 93 | 思源内核 API 的封装,提供了一些常用的方法,可以帮助开发者更快的开发插件。 94 | 95 | 其他详细信息请参阅 [siyuan-sdk 文档](/zh-Hans/reference/community/siyuan-sdk/) 96 | -------------------------------------------------------------------------------- /docs/zh-Hans/guide/plugin/development/siyuan-plugin-cli.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: siyuan-plugin-cli 工具 3 | locale: zh 4 | document: 20241002185122-o3kp77k 5 | notebook: Life 6 | hpath: /杂项关注/思源笔记/思源插件开发Tips/siyuan-plugin-cli 7 | export: '2024-10-02 19:44:38' 8 | --- 9 | 10 | [siyuan-plugin-cli](https://www.npmjs.com/package/siyuan-plugin-cli) 是一个 npm cli 程序,提供了一些 SiYuan 插件开发的工具。 11 | 12 | 安装: 13 | 14 | ```bash 15 | npm install -g siyuan-plugin-cli 16 | ``` 17 | 18 | ## 基本功能 19 | 20 | ### 在终端创建插件项目 21 | 22 | 运行`npx create-sy-plugin`​ 或 `npx create-plugin`​ ,可以从模板中创建一个插件。 23 | 24 | 该命令会提供一个的交互式命令行: 25 | 26 | - 输入插件的基本信息 27 | - 选择插件模板 28 | - 从模板中创建插件项目(本质是 `git clone`​ 到本地) 29 | - 更新本地插件项目 package.json 和 plugin.json 的基本信息 30 | 31 | 你还可以选择是否直接将插件上传 github,如果同意,则 cli 程序将: 32 | 33 | - 自动创建一个新的仓库 34 | 35 | - 这可能需要你输入 github 的 api key 36 | - 你可以在输入一次后就将它缓存在本地 (存放在 `~/.siyuan-plugin-cli`​ 文件中),这样下次使用的时候就不用重复输入了 37 | 38 | - 申请自动开启仓库的 workflow 权限,以便于直接使用模板中相关 ci 脚本 39 | - 将本地文件 push 到远端仓库 40 | 41 | ​![image](/frostime/image-20241002191846-5prokwg.png) 42 | 43 | ### 44 | 45 | ### make-link 与 make-install 46 | 47 | 为了方便开发的插件能快速导入到思源中调试、运行,cli 程序提供了两种命令。 48 | 49 | - ​`npx make-link`​ 创建软链接到 SiYuan 插件目录 50 | 51 | - 将插件开发下的 `dev`​ 目录链接到 SiYuan 插件目录下的 `plugins`​ 目录下 52 | - 注意:在 Windows 下推荐运行 `npx make-link-win` 53 | 54 | - ​`npx make-install`​ 安装插件到 SiYuan 插件目录下 55 | 56 | - 将插件开发下的 `dist`​ 目录中的文件复制到 SiYuan 的插件目录中 57 | 58 | > ⚠️ 注意: **在 Windows 下,需要管理员权限来创建软链接**,你可以有两种选择: 59 | > 60 | > 1. 管理员模式下运行 `npx make-link` 61 | > 2. 使用 `npx make-link-win`​ 来自动请求管理员权限。 62 | 63 | 运行这两条命令的时候,请保证思源处于运行中,这样程序会首先自动获取所有的工作空间,然后由用户自行选择想要绑定到哪个工作空间下。 64 | 65 | ```bash 66 | ❯❯❯ npx make-link 67 | >>> Try to visit constant "targetDir" in make_dev_link.js... 68 | >>> Constant "targetDir" is empty, try to get SiYuan directory automatically.... 69 | >>> Got 2 SiYuan workspaces 70 | [0] C:\Users\EEG\Documents\思源笔记 71 | [1] H:\临时文件夹\SiYuanDevSpace 72 | Please select a workspace[0-1]: 73 | ``` 74 | 75 | ​`make-link`​ 默认使用 `./dev`​ 目录作为插件开发目录;`make-install`​ 默认使用 `./dist`​ 目录作为编译后的插件文件。你可以在命令后面传入其他目录的路径来更换默认的选项,例如: 76 | 77 | ```bash 78 | npx make-install ./build 79 | ``` 80 | 81 | ### `update-version`​/`up-ver` 82 | 83 | 运行 `npx update-version`​ (`up-ver`​ 是简写版的命令)会自动更新 `package.json`​ 和 `plugin.json`​ 中的 `version`​ 字段,避免手动更改。 84 | 85 | ```bash 86 | ❯❯❯ npx update-version 87 | 88 | 🌟 Current version: 0.1.0 89 | 90 | 🔄 How would you like to update the version? 91 | 92 | 1️⃣ Auto update patch version (new version: 0.1.1) 93 | 2️⃣ Auto update minor version (new version: 0.2.0) 94 | 3️⃣ Auto update major version (new version: 1.0.0) 95 | 4️⃣ Input version manually 96 | 0️⃣ Quit without updating 97 | 98 | 👉 Please choose (1/2/3/4): 99 | ``` 100 | 101 | 你也可以传入 `patch`​, `minor`​, `major`​ 参数来直接指定更改的版本级别。 102 | -------------------------------------------------------------------------------- /docs/zh-Hans/guide/plugin/development/svelte-kit.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # Svelte组件库 6 | 7 | 思源插件开发往往会涉及到UI,为了确保整体风格的一致,我们建议使用思源内置的元素及样式。 8 | 同时,思源开发社区也倡导使用Svelte,并推出了基于svelte的插件模板。 9 | 10 | 因此,我们也实现了基于思源的svelte组件库,点击前往: [Svelte-kit](https://svelte-kit.siyuan-note.club/)。此链接为组件库的Storybook站,即在线查看组件库及使用方法的网站。 11 | 12 | ![Storybook](/static/development/storybook.png) 13 | 14 | ## 安装使用 15 | 16 | 在你的工程中安装svelte-kit 17 | 18 | ```bash 19 | pnpm install siyuan-kit-svelte 20 | ``` 21 | 22 | 并在你的代码中应用他 23 | 24 | ```svelte 25 | 30 | 31 |
32 | ``` 33 | 34 | ## 组件库内容 35 | 36 | 组件库包括了基本的表单元素以及其他常用的高级组件,更多的组件正在实现中 37 | 38 | ### 原子组件 39 | 40 | - [按钮Button](https://svelte-kit.siyuan-note.club/?path=/docs/BaseComponent-button--docs) 41 | - [开关Switch](https://svelte-kit.siyuan-note.club/?path=/docs/BaseComponent-switch--docs) 42 | - [输入Input(文字、数字)](https://svelte-kit.siyuan-note.club/?path=/docs/BaseComponent-input--docs) 43 | - [文本域Textarea](https://svelte-kit.siyuan-note.club/?path=/docs/BaseComponent-textarea--docs) 44 | - [滑块Slider](https://svelte-kit.siyuan-note.club/?path=/docs/BaseComponent-slider--docs) 45 | - [选择Select](https://svelte-kit.siyuan-note.club/?path=/docs/BaseComponent-select--docs) 46 | - [图标Icon](https://svelte-kit.siyuan-note.club/?path=/docs/BaseComponent-icon--docs) 47 | 48 | ## 高级组件 49 | 50 | - [树型结构Tree](https://svelte-kit.siyuan-note.club/?path=/docs/HighLevel-tree--docs) 51 | - [侧边Dock](https://svelte-kit.siyuan-note.club/?path=/docs/HighLevel-dock--docs)(插槽:标题、按钮组、内容) 52 | - [Dialog](https://svelte-kit.siyuan-note.club/?path=/story/highlevel-dialog--docs) 53 | 54 | ### 业务组件 55 | 56 | - Setting 57 | - Protyle 58 | 59 | ### 布局组件 60 | 61 | - flex容器 62 | -------------------------------------------------------------------------------- /docs/zh-Hans/guide/plugin/five-minutes-quick-start.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 5分钟快速开启插件开发 6 | 7 | ## 适宜阅读人群 8 | 9 | 前端开发已入门。如果没有的话建议查看 [入门指南](./startup.md) 进行仔细学习 10 | 11 | ## 步骤 12 | 13 | 1. 找到你本地的思源的工作空间目录(WORKSPACE) 14 | 2. 使用你习惯的工具,在 `WORKSPACE/data/plugins/` 下创建你的插件,例如名称 `siyuan-plugin-example` 15 | 3. 在 `WORKSPACE/data/plugins/siyuan-plugin-example` 中创建五个文件: `plugin.json`, `icon.png`,`preview.png`, `index.js`, `README.MD`,并在下面的内容填写到对应的文件里。 16 | 17 | ```json 18 | // plugin.json 19 | { 20 | "name": "siyuan-plugin-example", 21 | "version": "v0.1.0", 22 | "author": "example", 23 | "url": "https://github.com/example/siyuan-plugin/example", 24 | "displayName": { 25 | "default": "example", 26 | "zh_CN": "example" 27 | }, 28 | "description": { 29 | "default": "example", 30 | "zh_CN": "example" 31 | }, 32 | "readme": { 33 | "default": "README.md" 34 | } 35 | } 36 | ``` 37 | 38 | ```javascript 39 | // index.js 40 | const siyuan = require("siyuan"); 41 | 42 | module.exports = class ExamplePlugin extends siyuan.Plugin { 43 | onload() { 44 | console.log("Hello World"); 45 | } 46 | }; 47 | ``` 48 | 49 | ```markdown 50 | 51 | 52 | # Siyuan Plugin Example 53 | 54 | Hello world 55 | ``` 56 | 57 | 4. 上述文件创建并编辑完成后,在你思源里打开你的工作空间,或者刷新(打开控制台后使用快捷键 F5, Ctrl + F5Ctrl + R)即可刷新页面。 58 | 5. 在 `设置 -> 集市 -> 已下载 -> 插件` 中,即可看到你自己的插件`example`。打开后面的开关。 59 | 6. 使用思源菜单中的 `开发者工具` 或者快捷键 Ctrl + Shift + I 打开控制台,即可看到输出的 `Hello World` 了 60 | -------------------------------------------------------------------------------- /docs/zh-Hans/guide/plugin/index.md: -------------------------------------------------------------------------------- 1 | - [入门](./startup.md) 2 | - [插件开发快速指南](./sy-plugin-dev-quick-start.md) 3 | - 开发 4 | - 开发环境 5 | - 用户界面 6 | - [事件总线](/zh-Hans/reference/api/plugin/event-bus/) 7 | - [Svelte组件库](./development/svelte-kit.md) 8 | - [社区资源](./development/community.md) 9 | - 其他 10 | - [5 分钟快速开启插件开发](./five-minutes-quick-start.md) 11 | - [siyuan-plugin-cli](./development/siyuan-plugin-cli.md) 12 | 13 | 更多文档说明请参考 [插件 API](/zh-Hans/reference/api/plugin/) 14 | 15 | ## 5分钟快速开启插件开发 16 | 17 | 如果你拥有web前端开发经验,可以直接查看 [5 分钟快速开启插件开发](./five-minutes-quick-start.md) 18 | -------------------------------------------------------------------------------- /docs/zh-Hans/guide/plugin/user-interface/index.md: -------------------------------------------------------------------------------- 1 | # 用户界面 2 | 3 | 本部分介绍思源的用户界面设计,并引导开发者如何增加一些常见的功能。 4 | 5 | ![布局](/static/user-interface/layout.png) 6 | 7 | - 顶部标题栏 TopBar 8 | - 侧边栏 Sidebar 9 | - 编辑器 Editor 10 | - 底部状态栏 StatusBar 11 | -------------------------------------------------------------------------------- /docs/zh-Hans/guide/plugin/user-interface/topbar.md: -------------------------------------------------------------------------------- 1 | # 顶栏 Topbar 2 | 3 | 顶栏作为一个常驻的内容展示部分,包含了窗口控制、思源菜单、撤退还原、同步、插件菜单等功能。 4 | 5 | 思源提供了addTopBar接口,用于在顶栏添加内容。 6 | 7 | ## 代码示例 8 | 9 | 将下面的代码粘贴到你的插件的 `index.js` 中,即可查看这部分效果。 10 | 11 | ```javascript 12 | const { Plugin, Menu, getFrontend } = require("siyuan"); 13 | 14 | module.exports = class ExamplePlugin extends Plugin { 15 | onload() { 16 | const frontEnd = getFrontend(); 17 | this.isMobile = frontEnd === "mobile" || frontEnd === "browser-mobile"; 18 | 19 | const topBarElement = this.addTopBar({ 20 | icon: "iconHelp", // 使用图标库中的图标,可以在工作空间/conf/appearance/icons/index.html中查看内置图标 21 | title: "Siyuan Example", 22 | position: "right", 23 | callback: () => { 24 | if (this.isMobile) { 25 | this.addMenu(); 26 | } 27 | else { 28 | let rect = topBarElement.getBoundingClientRect(); 29 | // 如果被隐藏,则使用更多按钮 30 | if (rect.width === 0) { 31 | rect = document.querySelector("#barMore").getBoundingClientRect(); 32 | } 33 | if (rect.width === 0) { 34 | rect = document.querySelector("#barPlugins").getBoundingClientRect(); 35 | } 36 | this.addMenu(rect); 37 | } 38 | }, 39 | }); 40 | } 41 | 42 | addMenu(rect) { 43 | const menu = new Menu("topBarSample"); 44 | menu.addItem({ 45 | icon: "iconInfo", 46 | label: "Console Help", 47 | click: () => { 48 | console.log("Help"); 49 | }, 50 | }); 51 | if (this.isMobile) { 52 | menu.fullscreen(); 53 | } 54 | else { 55 | menu.open({ 56 | x: rect.right, 57 | y: rect.bottom, 58 | isLeft: true, 59 | }); 60 | } 61 | } 62 | }; 63 | ``` 64 | 65 | ## 效果 66 | 67 | ![图标](/static/user-interface/topbar-1.png) 68 | 69 | ![图标](/static/user-interface/topbar-2.png) 70 | -------------------------------------------------------------------------------- /docs/zh-Hans/guide/template/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/zh-Hans/guide/theme/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/zh-Hans/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | # https://vitepress.dev/reference/default-theme-home-page 3 | layout: home 4 | 5 | hero: 6 | name: "思源开发者文档" 7 | text: "为所有思源社区开发者服务" 8 | tagline: 让社区开发者更快乐! 9 | actions: 10 | - theme: brand 11 | text: 开发者指南 12 | link: ./guide/ 13 | - theme: brand 14 | text: 开发者参考 15 | link: ./reference/ 16 | 17 | - theme: alt 18 | text: 思源笔记官网 19 | link: https://b3log.org/siyuan 20 | - theme: alt 21 | text: 思源笔记社区 22 | link: https://ld246.com/tags/siyuan 23 | - theme: alt 24 | text: 思源笔记项目组 25 | link: https://github.com/siyuan-note 26 | --- 27 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/api/plugin/class/Dialog.md: -------------------------------------------------------------------------------- 1 | # `Dialog` 2 | 3 | ## 属性 4 | 5 | | Property | Type | Description | 6 | | :-------- | :------------ | :---------- | 7 | | `element` | `HTMLElement` | #TODO | 8 | 9 | ## 构造函数 10 | 11 | - 函数签名 12 | 13 | ```ts 14 | constructor(options: { 15 | title?: string, 16 | transparent?: boolean, 17 | content: string, 18 | width?: string, 19 | height?: string, 20 | destroyCallback?: (options?: IObject) => void, 21 | disableClose?: boolean, 22 | disableAnimation?: boolean, 23 | }); 24 | ``` 25 | 26 | - 描述 27 | 28 | #TODO 29 | 30 | ## 方法: `destroy` 31 | 32 | - 函数签名 33 | 34 | ```ts 35 | destroy(options?: IObject): void; 36 | ``` 37 | 38 | - 描述 39 | 40 | #TODO 41 | 42 | ## 方法: `bindInput` 43 | 44 | - 函数签名 45 | 46 | ```ts 47 | bindInput(inputElement: HTMLInputElement | HTMLTextAreaElement, enterEvent?: () => void): void; 48 | ``` 49 | 50 | - 描述 51 | 52 | #TODO 53 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/api/plugin/class/EventBus.md: -------------------------------------------------------------------------------- 1 | # `EventBus` 2 | 3 | ## 方法: `on` 4 | 5 | - 函数签名 6 | 7 | ```ts 8 | on(type: TEventBus, listener: (event: CustomEvent) => void): void; 9 | ``` 10 | 11 | - 描述 12 | 13 | #TODO 14 | 15 | ## 方法: `once` 16 | 17 | - 函数签名 18 | 19 | ```ts 20 | once(type: TEventBus, listener: (event: CustomEvent) => void): void; 21 | ``` 22 | 23 | - 描述 24 | 25 | #TODO 26 | 27 | ## 方法: `off` 28 | 29 | - 函数签名 30 | 31 | ```ts 32 | off(type: TEventBus, listener: (event: CustomEvent) => void): void; 33 | ``` 34 | 35 | - 描述 36 | 37 | #TODO 38 | 39 | ## 方法: `emit` 40 | 41 | - 函数签名 42 | 43 | ```ts 44 | emit(type: TEventBus, detail?: any): boolean; 45 | ``` 46 | 47 | - 描述 48 | 49 | #TODO 50 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/api/plugin/class/Menu.md: -------------------------------------------------------------------------------- 1 | # `Menu` 2 | 3 | ## 构造函数 4 | 5 | - 函数签名 6 | 7 | ```ts 8 | constructor(id?: string, closeCallback?: () => void); 9 | ``` 10 | 11 | - 描述 12 | 13 | #TODO 14 | 15 | ## 方法: `showSubMenu` 16 | 17 | - 函数签名 18 | 19 | ```ts 20 | showSubMenu(subMenuElement: HTMLElement): void; 21 | ``` 22 | 23 | - 描述 24 | 25 | #TODO 26 | 27 | ## 方法: `addItem` 28 | 29 | - 函数签名 30 | 31 | ```ts 32 | addItem(options: IMenuItemOption): HTMLElement; 33 | ``` 34 | 35 | - 描述 36 | 37 | #TODO 38 | 39 | ## 方法: `addSeparator` 40 | 41 | - 函数签名 42 | 43 | ```ts 44 | addSeparator(index?: number): void; 45 | ``` 46 | 47 | - 描述 48 | 49 | #TODO 50 | 51 | ## 方法: `open` 52 | 53 | - 函数签名 54 | 55 | ```ts 56 | open(options: { x: number, y: number, h?: number, w?: number, isLeft?: boolean }): void; 57 | ``` 58 | 59 | - 描述 60 | 61 | #TODO 62 | 63 | ## 方法: `fullscreen` 64 | 65 | - 函数签名 66 | 67 | ```ts 68 | fullscreen(position?: "bottom" | "all"): void; 69 | ``` 70 | 71 | - 描述 72 | 73 | #TODO 74 | 75 | ## 方法: `close` 76 | 77 | - 函数签名 78 | 79 | ```ts 80 | close(): void; 81 | ``` 82 | 83 | - 描述 84 | 85 | #TODO 86 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/api/plugin/class/Plugin.md: -------------------------------------------------------------------------------- 1 | # `class Plugin` 2 | 3 | ## 属性 4 | 5 | | Property | Type | Description | 6 | | :--------- | :----------------- | :------------------------------------------------------------------------------------------------ | 7 | | `eventBus` | `EventBus` | EventBus 对象,可以通过调用它的 `on` 方法来接受思源的事件 | 8 | | `i18n` | `IObject` | Object 对象,结构同在 `i18n` 目录下的 json 文件。 | 9 | | `data` | `any` | | 10 | | `name` | `string` | | 11 | | `app` | `App` | 包含 plugins 和 appId 两个属性,plugins是当前所有已运行插件的实例,appId 为部分函数需要传入的参数 | 12 | | `commands` | `ICommandOption[]` | | 13 | | `setting` | `Setting` | | 14 | 15 | ## `onload` 16 | 17 | - 函数签名 18 | 19 | ```ts 20 | onload(): void; 21 | ``` 22 | 23 | - 说明 24 | 25 | 插件初始化函数,思源在初始化的时候会调用该方法。 26 | 27 | ```ts 28 | // https://github.com/siyuan-note/siyuan/blob/master/app/src/plugin/loader.ts 29 | try { 30 | await plugin.onload(); 31 | } 32 | catch (e) { 33 | console.error(`plugin ${item.name} onload error:`, e); 34 | } 35 | ``` 36 | 37 | ## `onunload` 38 | 39 | - 函数签名 40 | 41 | ```ts 42 | onunload(): void; 43 | ``` 44 | 45 | - 说明 46 | 47 | 插件的“析构函数”,当插件被禁用的时候,会调用此方法。 48 | 49 | ## `onLayoutReady` 50 | 51 | - 函数签名 52 | 53 | ```ts 54 | onLayoutReady(): void; 55 | ``` 56 | 57 | - 描述 58 | 59 | TODO 60 | 61 | ## `addTopBar` 62 | 63 | - 函数签名 64 | 65 | ```ts 66 | addTopBar(options: { 67 | icon: string, 68 | title: string, 69 | callback: (event: MouseEvent) => void, 70 | position?: "right" | "left" 71 | }): HTMLElement; 72 | ``` 73 | 74 | - 描述 75 | 76 | 为插件在顶栏添加一个图标 77 | 78 | - 参数 79 | 80 | - `icon`:图标,可以是一个定义好的 Symbol 标识符,也可以是一个 svg html 81 | - `title`:图标文本,当鼠标悬浮到图标上的时候会显示对应 title 的 tooltip 82 | - `callback`: 鼠标点击的回调函数 83 | - `position`: 图标显示在顶栏的左侧还是右侧 84 | 85 | ## `addStatusBar` 86 | 87 | - 函数签名 88 | 89 | ```ts 90 | addStatusBar(options: { 91 | element: HTMLElement, 92 | position?: "right" | "left" 93 | }): HTMLElement; 94 | ``` 95 | 96 | - 描述 97 | 98 | TODO 99 | 100 | ## `openSetting` 101 | 102 | - 函数签名 103 | 104 | ```ts 105 | openSetting(): void; 106 | ``` 107 | 108 | - 描述 109 | 110 | TODO 111 | 112 | ## `loadData` 113 | 114 | - 函数签名 115 | 116 | ```ts 117 | loadData(storageName: string): Promise; 118 | ``` 119 | 120 | - 描述 121 | 122 | TODO 123 | 124 | ## `saveData` 125 | 126 | - 函数签名 127 | 128 | ```ts 129 | saveData(storageName: string, content: any): Promise; 130 | ``` 131 | 132 | - 描述 133 | 134 | TODO 135 | 136 | ## `removeData` 137 | 138 | - 函数签名 139 | 140 | ```ts 141 | removeData(storageName: string): Promise; 142 | ``` 143 | 144 | - 描述 145 | 146 | TODO 147 | 148 | ## `addIcons` 149 | 150 | - 函数签名 151 | 152 | ```ts 153 | addIcons(svg: string): void; 154 | ``` 155 | 156 | - 描述 157 | 158 | TODO 159 | 160 | ## `addTab` 161 | 162 | - 函数签名 163 | 164 | ```ts 165 | addTab(options: { 166 | type: string, 167 | destroy?: () => void, 168 | resize?: () => void, 169 | update?: () => void, 170 | init: () => void 171 | }): () => IModel; 172 | ``` 173 | 174 | - 描述 175 | 176 | TODO 177 | 178 | ## `addDock` 179 | 180 | - 函数签名 181 | 182 | ```ts 183 | addDock(options: { 184 | config: IPluginDockTab, 185 | data: any, 186 | type: string, 187 | destroy?: () => void, 188 | resize?: () => void, 189 | update?: () => void, 190 | init: () => void 191 | }): { config: IPluginDockTab, model: IModel }; 192 | ``` 193 | 194 | - 描述 195 | 196 | TODO 197 | 198 | ## `addCommand` 199 | 200 | - 函数签名 201 | 202 | ```ts 203 | addCommand(options: ICommandOption): void; 204 | ``` 205 | 206 | - 描述 207 | 208 | TODO 209 | 210 | ## `addFloatLayer` 211 | 212 | - 函数签名 213 | 214 | ```ts 215 | addFloatLayer(options: { 216 | ids: string[], 217 | defIds?: string[], 218 | x?: number, 219 | y?: number, 220 | targetElement?: HTMLElement 221 | }): void; 222 | ``` 223 | 224 | - 描述 225 | 226 | TODO 227 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/api/plugin/class/Setting.md: -------------------------------------------------------------------------------- 1 | # `Setting` 2 | 3 | ## 构造函数 4 | 5 | - 函数签名 6 | 7 | ```ts 8 | constructor(options: { 9 | height?: string, 10 | width?: string, 11 | destroyCallback?: () => void, 12 | confirmCallback?: () => void, 13 | }); 14 | ``` 15 | 16 | - 描述 17 | 18 | #TODO 19 | 20 | ## 方法: `addItem` 21 | 22 | - 函数签名 23 | 24 | ```ts 25 | addItem(options: { 26 | title: string, 27 | description?: string, 28 | actionElement?: HTMLElement, 29 | createActionElement?(): HTMLElement, 30 | }): void; 31 | ``` 32 | 33 | - 描述 34 | 35 | #TODO 36 | 37 | ## 方法: `open` 38 | 39 | - 函数签名 40 | 41 | ```ts 42 | open(name: string): void; 43 | ``` 44 | 45 | - 描述 46 | 47 | #TODO 48 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/api/plugin/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | - [类型与接口](./types.md) 6 | - [事件总线](./event-bus/) 7 | - 类 8 | - [Plugin](./class/Plugin.md) 9 | - [Dialog](./class/Dialog.md) 10 | - [Menu](./class/Menu.md) 11 | - [EventBus](./class/EventBus.md) 12 | - [Lute](./class/Lute.md) 13 | - [方法](./method.md) 14 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/api/plugin/method.md: -------------------------------------------------------------------------------- 1 | # 插件方法 2 | 3 | ## `fetchPost` 4 | 5 | - 函数签名 6 | 7 | ```ts 8 | export function fetchPost(url: string, data?: any, callback?: (response: IWebSocketData) => void, headers?: IObject): void; 9 | ``` 10 | 11 | - 描述 12 | 13 | #TODO 14 | 15 | - 参数 16 | 17 | - `url`: `string` 18 | - `data`: `any` (可选) 19 | - `callback`: `(response: IWebSocketData) => void` (可选) 20 | - `headers`: `IObject` (可选) 21 | 22 | - 返回值 23 | 24 | `void` 25 | 26 | ## `fetchSyncPost` 27 | 28 | - 函数签名 29 | 30 | ```ts 31 | export function fetchSyncPost(url: string, data?: any): Promise; 32 | ``` 33 | 34 | - 描述 35 | 36 | #TODO 37 | 38 | - 参数 39 | 40 | - `url`: `string` 41 | - `data`: `any` (可选) 42 | 43 | - 返回值 44 | 45 | `Promise` 46 | 47 | ## `fetchGet` 48 | 49 | - 函数签名 50 | 51 | ```ts 52 | export function fetchGet(url: string, callback: (response: IWebSocketData) => void): void; 53 | ``` 54 | 55 | - 描述 56 | 57 | #TODO 58 | 59 | - 参数 60 | 61 | - `url`: `string` 62 | - `callback`: `(response: IWebSocketData) => void` 63 | 64 | - 返回值 65 | 66 | `void` 67 | 68 | ## `openTab` 69 | 70 | - 函数签名 71 | 72 | ```ts 73 | export function openTab(options: { 74 | app: App; 75 | doc?: { 76 | id: string; // 块 id 77 | action?: string[]; // cb-get-all:获取所有内容;cb-get-focus:打开后光标定位在 id 所在的块;cb-get-hl: 打开后 id 块高亮 78 | zoomIn?: boolean; // 是否缩放 79 | }; 80 | pdf?: { 81 | path: string; 82 | page?: number; // pdf 页码 83 | id?: string; // File Annotation id 84 | }; 85 | asset?: { 86 | path: string; 87 | }; 88 | search?: ISearchOption; 89 | card?: { 90 | type: TCardType; 91 | id?: string; // cardType 为 all 时不传,否则传文档或笔记本 id 92 | title?: string; // cardType 为 all 时不传,否则传文档或笔记本名称 93 | }; 94 | custom?: { 95 | title: string; 96 | icon: string; 97 | data?: any; 98 | fn?: () => IModel; 99 | }; 100 | position?: "bottom" | "right"; 101 | keepCursor?: boolean; // 是否跳转到新 tab 上 102 | removeCurrentTab?: boolean; // 在当前页签打开时需移除原有页签 103 | afterOpen?: () => void; // 打开后回调 104 | }): ITab; 105 | ``` 106 | 107 | - 描述 108 | 109 | #TODO 110 | 111 | - 参数 112 | 113 | - `options`: 114 | - `app`: `App` 115 | - `doc`: `{ id: string, action?: string[], zoomIn?: boolean }` (可选) 116 | - `pdf`: `{ path: string, page?: number, id?: string }` (可选) 117 | - `asset`: `{ path: string }` (可选) 118 | - `search`: `ISearchOption` (可选) 119 | - `card`: `{ type: TCardType, id?: string, title?: string }` (可选) 120 | - `custom`: `{ title: string, icon: string, data?: any, fn?: () => IModel }` (可选) 121 | - `position`: `"right" | "bottom"` 122 | - `keepCursor`: `boolean` (可选) 123 | - `removeCurrentTab`: `boolean` (可选) 124 | - `afterOpen`: `() => void` (可选) 125 | 126 | - 返回值 127 | 128 | `ITab` 129 | 130 | ## `getFrontend` 131 | 132 | - 函数签名 133 | 134 | ```ts 135 | export function getFrontend(): "browser-desktop" | "browser-mobile" | "desktop-window" | "desktop" | "mobile"; 136 | ``` 137 | 138 | - 描述 139 | 140 | #TODO 141 | 142 | - 返回值 143 | 144 | `"desktop" | "desktop-window" | "mobile" | "browser-desktop" | "browser-mobile"` 145 | 146 | ## `getBackend` 147 | 148 | - 函数签名 149 | 150 | ```ts 151 | export function getBackend(): "android" | "darwin" | "docker" | "ios" | "linux" | "windows"; 152 | ``` 153 | 154 | - 描述 155 | 156 | #TODO 157 | 158 | - 返回值 159 | 160 | `"windows" | "linux" | "darwin" | "docker" | "android" | "ios"` 161 | 162 | ## `adaptHotkey` 163 | 164 | - 函数签名 165 | 166 | ```ts 167 | export function adaptHotkey(hotkey: string): string; 168 | ``` 169 | 170 | - 描述 171 | 172 | #TODO 173 | 174 | - 参数 175 | 176 | - `hotkey`: `string` 177 | 178 | - 返回值 179 | 180 | `string` 181 | 182 | ## `confirm` 183 | 184 | - 函数签名 185 | 186 | ```ts 187 | export function confirm(title: string, text: string, confirmCallback?: () => void, cancelCallback?: () => void): void; 188 | ``` 189 | 190 | - 描述 191 | 192 | #TODO 193 | 194 | - 参数 195 | 196 | - `title`: `string` 197 | - `text`: `string` 198 | - `confirmCallback`: `() => void` (可选) 199 | - `cancelCallback`: `() => void` (可选) 200 | 201 | - 返回值 202 | 203 | `void` 204 | 205 | ## `showMessage` 206 | 207 | - 函数签名 208 | 209 | ```ts 210 | export function showMessage(text: string, timeout?: number, type?: "error" | "info", id?: string): void; 211 | ``` 212 | 213 | - 描述 214 | 215 | #TODO 216 | 217 | - 参数 218 | 219 | - `text`: `string` 220 | - `timeout`: `number` (可选) - ms. 0: manual close;-1: always show; 6000: default 221 | - `type`: `"info" | "error"` (可选) 222 | - `id`: `string` (可选) 223 | 224 | - 返回值 225 | 226 | `void` 227 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/bazaar/icon.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 图标 6 | 7 | ## 清单文件 {#manifest} 8 | 9 | ::: code-group 10 | <<< @/snippets/examples/manifest/icon.json [Example] 11 | <<< @/snippets/siyuan-sdk/types/manifest/icon.d.ts#content [Types] 12 | <<< @/snippets/siyuan-sdk/schemas/manifest/icon.schema.json5 [JSON Schema (json5)] 13 | <<< @/snippets/siyuan-sdk/schemas/manifest/icon.schema.json [JSON Schema (json)] 14 | ::: 15 | 16 | - 基础字段 17 | - `name`:图标名称,必须全局唯一(集市中不能有同名图标) 18 | - `author`:图标作者名 19 | - `url`:图标仓库地址 20 | - `version`:图标版本号,建议遵循 [semver](https://semver.org/lang/zh-CN/) 规范 21 | - `minAppVersion`:图标支持的最低思源笔记版本号 22 | - `keywords`: 用于在集市中搜索的关键词列表 23 | - `displayName`:图标显示名称,主要用于图标集市列表中显示,支持多语言 24 | - `default`:默认语言,必须存在 25 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 26 | - `description`:图标描述,主要用于图标集市列表中显示,支持多语言 27 | - `default`:默认语言,必须存在 28 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 29 | - `readme`:自述文件名,主要用于图标集市详情页中显示,支持多语言 30 | - `default`:默认语言,必须存在 31 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 32 | - `funding`:图标赞助信息 33 | - `openCollective`:Open Collective 名称 34 | - `patreon`:Patreon 名称 35 | - `github`:GitHub 用户名 36 | - `custom`:自定义赞助链接列表 37 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/bazaar/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 社区集市 6 | 7 | 在思源中, 开发者希望把自己开发的作品上架到集市 (bazaar),除了核心的代码文件之外, 还必须提交如下内容 8 | 9 | - 清单文件 (不同类型资源的清单文件文件名不同) 10 | - `icon.json` 11 | - `plugin.json` 12 | - `template.json` 13 | - `theme.json` 14 | - `widget.json` 15 | - 说明文件 16 | - `README.md` 17 | - 图标图片 18 | - `icon.png` 19 | - 预览图片 20 | - `preview.png` 21 | 22 | ## 清单文件 {#manifest} 23 | 24 | bazaar 读取特定 json 文件来获悉社区资源的具体配置。 25 | 26 | - 图标资源: `icon.json` 27 | - 插件资源: `plugin.json` 28 | - 模板资源: `template.json` 29 | - 主题资源: `theme.json` 30 | - 挂件资源: `widget.json` 31 | 32 | ### 基本字段 {#manifest-base} 33 | 34 | 不同类型的社区资源有不同的清单文件,但是他们有一些共同的字段。 35 | 36 | ::: code-group 37 | <<< @/snippets/examples/manifest/base.json [Example] 38 | <<< @/snippets/siyuan-sdk/types/manifest/base.d.ts#content [Types] 39 | <<< @/snippets/siyuan-sdk/schemas/manifest/base.schema.json5 [JSON Schema (json5)] 40 | <<< @/snippets/siyuan-sdk/schemas/manifest/base.schema.json [JSON Schema (json)] 41 | ::: 42 | 43 | - 基础字段 44 | - `name`: 资源名称,必须全局唯一(集市中不能有同名图标) 45 | - `author`: 资源作者名 46 | - `url`: 资源 GitHub 仓库 URL 47 | - `version`: 资源版本号,建议遵循 [semver](https://semver.org/lang/zh-CN/) 规范 48 | - `minAppVersion`: 资源兼容的最低思源笔记版本号 49 | - `keywords`: 用于在集市中搜索的关键词列表 50 | - `displayName`: 资源显示名称,主要用于集市列表中显示,支持多语言 51 | - `default`: 默认语言,必须存在 52 | - `zh_CN`、`en_US` 等其他语言: 可选,建议至少提供中文和英文 53 | - `description`: 资源描述,主要用于资源集市列表中显示,支持多语言 54 | - `default`: 默认语言,必须存在 55 | - `zh_CN`、`en_US` 等其他语言: 可选,建议至少提供中文和英文 56 | - `readme`: 自述文件名,主要用于资源集市详情页中显示,支持多语言 57 | - `default`: 默认语言,必须存在 58 | - `zh_CN`、`en_US` 等其他语言: 可选,建议至少提供中文和英文 59 | - `funding`: 项目赞助渠道 60 | - `openCollective`: Open Collective 名称 61 | - `patreon`: Patreon 名称 62 | - `github`: GitHub 用户名 63 | - `custom`: 自定义赞助链接列表 64 | 65 | ### 附加字段 {#manifest-added} 66 | 67 | 以下是各清单文件详细定义说明,不同类型的社区资源的清单文件可能存在一些额外的字段。 68 | 69 | - 图标: [icon.json](./icon.md#manifest) 70 | - 插件: [plugin.json](./plugin.md#manifest) 71 | - `backends`: 插件支持的后端环境列表 72 | - `frontends`: 插件支持的前端环境列表 73 | - 模板: [template.json](./template.md#manifest) 74 | - 主题: [theme.json](./theme.md#manifest) 75 | - `modes`: 主题支持的模式 76 | - 挂件: [widget.json](./widget.md#manifest) 77 | 78 | ## 说明文件 {#readme} 79 | 80 | README 说明文件会被解析为集市中项目的介绍文档。思源支持 i18n 国际化,所以一个项目中可能不止有一个 README 文件,需要配置 `json` 文件中 `readme` 字段。 81 | 82 | ```json 83 | "readme": { 84 | "default": "README.md", 85 | "zh_CN": "README_zh_CN.md" 86 | }, 87 | ``` 88 | 89 | ### README 文件中的图片 {#readme-images} 90 | 91 | 思源在解析 README 的时候遇到相对链接的图片,不会在本地查找,而是会通过网络访问远程仓库中的图片资源。 92 | 93 | 由于众所周知的原因, 中国大陆内访问 github 仓库会出现波动情况。所以思源会根据 json 文件 `url` 配置把本地图片资源解析成 [cdn](https://cdn.jsdelivr.net/) 链接。`xx.png` 会被处理为 `https://cdn.jsdelivr.net/gh///xx.png` 94 | 95 | 所以大部分情况下,我们只需要在 README 里使用相对路径引用图片即可。 96 | 97 | 不过 jsdeliver cdn 本身也存在波动,你也可以选择在 zh_CN 的文档中使用自建图床的链接地址,来提供更加文档的访问。 98 | 99 | 需要注意的是,思源的集市里的介绍文档是访问 cdn 托管的网络资源。但是「已下载」当中的介绍文档则是访问本地下载下来的 README.md 文件,所以如果你不是很在乎在集市里的显示的话,还有一种方案, 是把所有的 asset 图片打包到发布包当中,然后指定思源内部网络访问的 uri,这样用户下载了集市中的产品后可以在本地看到完整的介绍文档。 100 | 101 | 例如以下的 url: 102 | 103 | ``` 104 | /appearance/themes//preview-light.png` 105 | ``` 106 | 107 | 会访问思源工作空间目录下, 主题 `ThemeX` 的安装路径 `/appearance/themes//` 下属的图片 `preview-light.png`。 108 | 109 | ## 图标图片 {#icon} 110 | 111 | 图标图片用于在社区资源集市列表与详情页中展示你的项目。 112 | 113 | 图标图片需要满足如下要求: 114 | 115 | - 文件名称: `icon.png` 116 | - 图片格式: `image/png` 117 | - 图片尺寸: 160×160 (推荐) 118 | 119 | ## 预览图片 {#preview} 120 | 121 | 预览图片用于在社区资源集市详情页面中展示你的项目。 122 | 123 | 预览图片需要满足如下定要求: 124 | 125 | - 文件名称: `preview.png` 126 | - 图片格式: `image/png` 127 | - 图片尺寸: 1024×768 (推荐) 128 | 129 | ![集市详情页](/public/static/asset-img.png) 130 | 131 | > Tips: 一次性制作符合要求尺寸的图片可能比较麻烦,你可以试着分别制作两个 1:1 和 4:3 的图片,然后使用图片编辑软件 (比如 windows 自带的画图) 缩放到指定尺寸。 132 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/bazaar/plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 插件 6 | 7 | ## 清单文件 {#manifest} 8 | 9 | ::: code-group 10 | <<< @/snippets/examples/manifest/plugin.json [Example] 11 | <<< @/snippets/siyuan-sdk/types/manifest/plugin.d.ts#content [Types] 12 | <<< @/snippets/siyuan-sdk/schemas/manifest/plugin.schema.json5 [JSON Schema (json5)] 13 | <<< @/snippets/siyuan-sdk/schemas/manifest/plugin.schema.json [JSON Schema (json)] 14 | ::: 15 | 16 | - 基础字段 17 | - `name`:插件名称,必须全局唯一(集市中不能有同名插件) 18 | - `author`:插件作者名 19 | - `url`:插件仓库地址 20 | - `version`:插件版本号,建议遵循 [semver](https://semver.org/lang/zh-CN/) 规范 21 | - `minAppVersion`:插件支持的最低思源笔记版本号 22 | - `keywords`: 用于在集市中搜索的关键词列表 23 | - `displayName`:模板显示名称,主要用于模板集市列表中显示,支持多语言 24 | - `default`:默认语言,必须存在 25 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 26 | - `description`:插件描述,主要用于插件集市列表中显示,支持多语言 27 | - `default`:默认语言,必须存在 28 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 29 | - `readme`:自述文件名,主要用于插件集市详情页中显示,支持多语言 30 | - `default`:默认语言,必须存在 31 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 32 | - `funding`:插件赞助信息 33 | - `openCollective`:Open Collective 名称 34 | - `patreon`:Patreon 名称 35 | - `github`:GitHub 用户名 36 | - `custom`:自定义赞助链接列表 37 | - 附加字段 38 | - `backends`:插件兼容的后端环境列表,可选值为 `windows`, `linux`, `darwin`, `docker`, `android`, `ios` 与 `all` 39 | - `windows`:Windows 桌面端 40 | - `linux`:Linux 桌面端 41 | - `darwin`:macOS 桌面端 42 | - `docker`:Docker 端 43 | - `android`:Android 端 44 | - `ios`:iOS 端 45 | - `all`:所有环境 46 | - `frontends`:插件兼容的前端环境列表,可选值为 `desktop`, `desktop-window`, `mobile`, `browser-desktop`, `browser-mobile` 与 `all` 47 | - `desktop`:桌面端 48 | - `desktop-window`:桌面端页签转换的独立窗口 49 | - `mobile`:移动端 50 | - `browser-desktop`:桌面端浏览器 51 | - `browser-mobile`:移动端浏览器 52 | - `all`:所有环境 53 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/bazaar/template.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 模板 6 | 7 | ## 清单文件 {#manifest} 8 | 9 | ::: code-group 10 | <<< @/snippets/examples/manifest/template.json [Example] 11 | <<< @/snippets/siyuan-sdk/types/manifest/template.d.ts#content [Types] 12 | <<< @/snippets/siyuan-sdk/schemas/manifest/template.schema.json5 [JSON Schema (json5)] 13 | <<< @/snippets/siyuan-sdk/schemas/manifest/template.schema.json [JSON Schema (json)] 14 | ::: 15 | 16 | - 基础字段 17 | - `name`:模板名称,必须全局唯一(集市中不能有同名模板) 18 | - `author`:模板作者名 19 | - `url`:模板仓库地址 20 | - `version`:模板版本号,建议遵循 [semver](https://semver.org/lang/zh-CN/) 规范 21 | - `minAppVersion`:模板支持的最低思源笔记版本号 22 | - `keywords`: 用于在集市中搜索的关键词列表 23 | - `displayName`:模板显示名称,主要用于模板集市列表中显示,支持多语言 24 | - `default`:默认语言,必须存在 25 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 26 | - `description`:模板描述,主要用于模板集市列表中显示,支持多语言 27 | - `default`:默认语言,必须存在 28 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 29 | - `readme`:自述文件名,主要用于模板集市详情页中显示,支持多语言 30 | - `default`:默认语言,必须存在 31 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 32 | - `funding`:模板赞助信息 33 | - `openCollective`:Open Collective 名称 34 | - `patreon`:Patreon 名称 35 | - `github`:GitHub 用户名 36 | - `custom`:自定义赞助链接列表 37 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/bazaar/theme.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 主题 6 | 7 | ## 清单文件 {#manifest} 8 | 9 | ::: code-group 10 | <<< @/snippets/examples/manifest/theme.json [Example] 11 | <<< @/snippets/siyuan-sdk/types/manifest/theme.d.ts#content [Types] 12 | <<< @/snippets/siyuan-sdk/schemas/manifest/theme.schema.json5 [JSON Schema (json5)] 13 | <<< @/snippets/siyuan-sdk/schemas/manifest/theme.schema.json [JSON Schema (json)] 14 | ::: 15 | 16 | - 基础字段 17 | - `name`:主题名称,必须全局唯一(集市中不能有同名主题) 18 | - `author`:主题作者名 19 | - `url`:主题仓库地址 20 | - `version`:主题版本号,建议遵循 [semver](https://semver.org/lang/zh-CN/) 规范 21 | - `minAppVersion`:主题支持的最低思源笔记版本号 22 | - `keywords`: 用于在集市中搜索的关键词列表 23 | - `displayName`:模板显示名称,主要用于模板集市列表中显示,支持多语言 24 | - `default`:默认语言,必须存在 25 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 26 | - `description`:主题描述,主要用于主题集市列表中显示,支持多语言 27 | - `default`:默认语言,必须存在 28 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 29 | - `readme`:自述文件名,主要用于主题集市详情页中显示,支持多语言 30 | - `default`:默认语言,必须存在 31 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 32 | - `funding`:主题赞助信息 33 | - `openCollective`:Open Collective 名称 34 | - `patreon`:Patreon 名称 35 | - `github`:GitHub 用户名 36 | - `custom`:自定义赞助链接列表 37 | - 附加字段 38 | - `modes`:主题支持的模式列表,可选值为 `light` 和 `dark` 39 | - `light`: 明亮模式 40 | - `dark`: 暗黑模式 41 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/bazaar/widget.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 挂件 6 | 7 | ## 清单文件 {#manifest} 8 | 9 | ::: code-group 10 | <<< @/snippets/examples/manifest/widget.json [Example] 11 | <<< @/snippets/siyuan-sdk/types/manifest/widget.d.ts#content [Types] 12 | <<< @/snippets/siyuan-sdk/schemas/manifest/widget.schema.json5 [JSON Schema (json5)] 13 | <<< @/snippets/siyuan-sdk/schemas/manifest/widget.schema.json [JSON Schema (json)] 14 | ::: 15 | 16 | - 基础字段 17 | - `name`:挂件名称,必须全局唯一(集市中不能有同名挂件) 18 | - `author`:挂件作者名 19 | - `url`:挂件仓库地址 20 | - `version`:挂件版本号,建议遵循 [semver](https://semver.org/lang/zh-CN/) 规范 21 | - `minAppVersion`:挂件支持的最低思源笔记版本号 22 | - `keywords`: 用于在集市中搜索的关键词列表 23 | - `displayName`:模板显示名称,主要用于模板集市列表中显示,支持多语言 24 | - `default`:默认语言,必须存在 25 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 26 | - `description`:挂件描述,主要用于挂件集市列表中显示,支持多语言 27 | - `default`:默认语言,必须存在 28 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 29 | - `readme`:自述文件名,主要用于挂件集市详情页中显示,支持多语言 30 | - `default`:默认语言,必须存在 31 | - `zh_CN`、`en_US` 等其他语言:可选,建议至少提供中文和英文 32 | - `funding`:挂件赞助信息 33 | - `openCollective`:Open Collective 名称 34 | - `patreon`:Patreon 名称 35 | - `github`:GitHub 用户名 36 | - `custom`:自定义赞助链接列表 37 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/block/attribute.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 块属性 6 | 7 | | 块属性名 | 适用块类型 | 8 | | :------------------------------------------------------------ | ---------- | 9 | | [`custom-avs`](#custom-avs) | 所有块 | 10 | | [`custom-data-assets`](#custom-data-assets) | 挂件块 | 11 | | [`custom-heading-mode`](#custom-heading-mode) | 嵌入块 | 12 | | [`custom-hidden`](#custom-hidden) | 文档块 | 13 | | [`custom-liandi-articleId`](#custom-liandi-articleId) | 文档块 | 14 | | [`custom-reminder-wechat`](#custom-reminder-wechat) | 所有块 | 15 | | [`custom-riff-decks`](#custom-riff-decks) | 所有块 | 16 | | [`custom-sy-fullwidth`](#custom-sy-fullwidth) | 文档块 | 17 | | [`custom-sy-readonly`](#custom-sy-readonly) | 文档块 | 18 | | [`custom-dailynote-{yyyymmdd}`](#custom-dailynote-{yyyymmdd}) | 文档块 | 19 | | [`data-assets`](#data-assets) | 挂件块 | 20 | | [`data-export-html`](#data-export-html) | 挂件块 | 21 | | [`data-export-md`](#data-export-md) | 挂件块 | 22 | 23 | ## `custom-avs` 24 | 25 | - 所有块 26 | - 所有关联到该块的属性视图的 ID 列表 27 | - 属性值示例 28 | - `20230927002636-rksmxa0` 29 | - ID 为 `20230927002636-rksmxa0` 的属性视图 30 | - `20230927002636-rksmxa0,20231007002428-w7z858y` 31 | - ID 为 `20230927002636-rksmxa0` 的属性视图 32 | - ID 为 `20231007002428-w7z858y` 的属性视图 33 | 34 | ## `custom-data-assets` 35 | 36 | - 挂件块 37 | - 等效于 [`data-assets`](#data-assets) 38 | 39 | ## `custom-heading-mode` 40 | 41 | - 嵌入块 42 | - 是否在嵌入块中显示标题下方的内容 43 | - 属性值 44 | - `0`: 显示标题下方的内容 45 | - `1`: 隐藏标题下方的内容 46 | 47 | ## `custom-hidden` 48 | 49 | - 文档块 50 | - 属性值 51 | - `true`: 在文档树中隐藏文档及其下级文档 52 | 53 | ## `custom-liandi-articleId` 54 | 55 | - 文档块 56 | - 属性值 57 | - 分享到链滴的帖子 ID 58 | 59 | ## `custom-reminder-wechat` 60 | 61 | - 所有块 62 | - 属性值 63 | - 预定的微信推送提醒时间 64 | 65 | ## `custom-riff-decks` 66 | 67 | - 所有块 68 | - 属性值 69 | - 闪卡卡包 ID 列表 70 | 71 | ## `custom-sy-fullwidth` 72 | 73 | - 文档块 74 | - 属性值 75 | - `true`: 开启文档自适应宽度 76 | - `false`: 关闭文档自适应宽度 77 | 78 | ## `custom-sy-readonly` 79 | 80 | - 文档块 81 | - 属性值 82 | - `true`: 启用文档只读 83 | - `false`: 禁用文档只读 84 | 85 | ## `custom-dailynote-{yymmdd}` 86 | 87 | - 文档块 88 | - daily note 文档 89 | - 属性名 90 | - `custom-dailynote-{yyyymmdd}` 91 | - `{yyyymmdd}` 为日期,格式为 `YYYYMMDD`,例如 `20211001` 代表 2021 年 10 月 1 日 92 | - 属性值 93 | - `yyyymmdd`: 日期,格式为 `YYYYMMDD` 94 | - 详细细节请见: [Github Issue #9807](https://github.com/siyuan-note/siyuan/issues/9807) 95 | 96 | ## `data-assets` 97 | 98 | - 挂件块 99 | - 设置该挂件引用的资源文件 100 | 101 | ## `data-export-html` 102 | 103 | - 挂件块 104 | - 设置导出时替换的 HTML 内容 105 | 106 | ## `data-export-md` 107 | 108 | - 挂件块 109 | - 设置导出时替换的 Markdown 内容 110 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 社区资源 6 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-CE/feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 社区版新特性 6 | 7 | ## `WebDAV` 服务 8 | 9 | - 该功能默认开启 10 | - 内核提供 `WebDAV` 服务,可通过 `WebDAV` 客户端访问工作空间目录 11 | - 服务路径: `http(s)://hostname:port/webdav/` 12 | - 文件目录: 当前工作空间目录 13 | - 鉴权方案: [HTTP Basic 验证方案](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Authentication#basic_验证方案) 14 | - 用户: `<任意值>` 15 | - 密码: `<访问鉴权码>` 16 | 17 | ## 访问远程思源笔记服务 18 | 19 | - 该功能默认关闭 20 | - 桌面端命令行参数 21 | - `--remote` 22 | - 指定远程的思源笔记服务的源地址 23 | - 设置该参数后,桌面端将不再启动本地的思源笔记服务, 而是通过指定的远程地址访问思源笔记服务 24 | - 示例: `--remote=https://your.domain.name:12345` 25 | - 无默认值 26 | 27 | ## 单独配置 Electron 网络代理 28 | 29 | - 该功能默认关闭 30 | - 桌面端命令行参数 31 | - `--proxy` 32 | - 指定所使用的网络代理服务地址 33 | - 设置该参数后,桌面端将不再使用用户所指定的网络代理服务地址,而是使用该参数指定的网络代理服务地址 34 | - 配合 `--remote` 参数使用 35 | - 以避免本地 Electron 的网络代理服务地址被远程思源笔记内核服务的网络代理服务地址覆盖 36 | - 示例: `--proxy=socks5://username:password@localhost:1080` 37 | - 在设置了 `--remote` 时默认使用系统代理 38 | 39 | ## 内核 `SSL/TLS` 安全服务 40 | 41 | - 该功能默认关闭 42 | - 内核支持启用 [SSL](https://developer.mozilla.org/zh-CN/docs/Glossary/SSL)/[TLS](https://developer.mozilla.org/zh-CN/docs/Glossary/TLS) 安全服务,可通过 `https` 与 `wss` 协议访问思源笔记服务 43 | - 桌面端命令行参数 44 | - `--tls-kernel` 45 | - 启用内核 SSL/TLS 安全服务 46 | - 示例: `--tls-kernel` 47 | - 无默认值 48 | - `--tls-cert-file` 49 | - 指定 SSL/TLS 全链证书文件路径 50 | - 文件编码格式: `PEM` 51 | - 示例: `--tls-cert-file=/path/to/fullchain.pem` 52 | - 默认值: `<思源工作空间>/conf/tls/siyuan.pem.cer` 53 | - `--tls-key-file` 54 | - 指定 SSL/TLS 私钥文件路径 55 | - 文件编码格式: `PEM` 56 | - 示例: `--tls-key-file=/path/to/privkey.pem` 57 | - 默认值: `<思源工作空间>/conf/tls/siyuan.pem.key` 58 | - `--hostname` 59 | - 指定 SSL/TLS 证书的主机名, 桌面端使用该主机名访问本地的思源笔记服务 60 | - 示例: `--hostname=siyuan.localhost` 61 | - 默认值: `127.0.0.1` 62 | - `--ignore-certificate-errors` 63 | - 忽略 SSL/TLS 证书错误 64 | - 如果使用系统不信任的自签名可能需要设置该参数以绕过证书校验 65 | - 详情请参考: [支持的命令行开关 --ignore-certificate-errors | Electron](https://www.electronjs.org/zh/docs/latest/api/command-line-switches#--ignore-certificate-errors) 66 | - 示例: `--ignore-certificate-errors` 67 | - 无默认值 68 | - 内核命令行参数 69 | - `--tls-kernel` 70 | - 启用内核 SSL/TLS 安全服务 71 | - 示例: `--tls-kernel true` 72 | - 默认值: `false` 73 | - `--tls-cert-file` 74 | - 指定 SSL/TLS 全链证书文件路径 75 | - 文件编码格式: `PEM` 76 | - 示例: `--tls-cert-file /path/to/fullchain.pem` 77 | - 默认值: `<思源工作空间>/conf/tls/siyuan.pem.cer` 78 | - `--tls-key-file` 79 | - 指定 SSL/TLS 私钥文件路径 80 | - 文件编码格式: `PEM` 81 | - 示例: `--tls-key-file /path/to/privkey.pem` 82 | - 默认值: `<思源工作空间>/conf/tls/siyuan.pem.key` 83 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-CE/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 思源笔记社区版 6 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/file-system.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # SiYuan SDK 6 | 7 | [![NPM](https://nodei.co/npm/@siyuan-community/siyuan-sdk.png?stars=true&downloads=true&downloadRank=true)](https://www.npmjs.com/package/@siyuan-community/siyuan-sdk) 8 | 9 | | 作者 | GitHub 仓库 | npm | 语言环境 | 10 | | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | 11 | | [Zuoqiu-Yingyi](https://github.com/Zuoqiu-Yingyi) | [siyuan-community/siyuan-sdk](https://github.com/siyuan-community/siyuan-sdk)
[![GitHub 最新发行版本 (最新一次发行/预发行)](https://img.shields.io/github/v/release/siyuan-community/siyuan-sdk?include_prereleases&style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-custom-fonts/releases/latest) | [@siyuan-community/siyuan-sdk](https://www.npmjs.com/package/@siyuan-community/siyuan-sdk)
[![NPM 版本](https://img.shields.io/npm/v/%40siyuan-community/siyuan-sdk?style=flat-square)](https://www.npmjs.com/package/@siyuan-community/siyuan-sdk?activeTab=versions) | `JavaScript`
`TypeScript` | 12 | 13 | ## 介绍 14 | 15 | 这是一个简单易用的 [思源笔记](https://github.com/siyuan-note/siyuan) 开发工具包 (SDK),可以帮助开发者更快的开发插件与挂件。 16 | 17 | - **100%** 的测试覆盖率 18 | - 封装了思源内核**全部**公开的 API 19 | - 封装了思源内核部分未公开的 API 20 | - 提供对应 API 的完整 [JSON Schema](https://json-schema.org/) 定义 21 | - 同时支持 [XHR](https://developer.mozilla.org/zh-CN/docs/Glossary/XMLHttpRequest) 与 [Fetch](https://developer.mozilla.org/zh-CN/docs/Web/API/Fetch_API) 22 | - 使用 [Axios](https://github.com/axios/axios) 发起 XHR 请求 23 | - 使用 [ofetch](https://github.com/unjs/ofetch) 发起 Fetch 请求 24 | 25 | ## 导航 26 | 27 | - [开始](./start.md) 28 | - [思源内核 API](./kernel/) 29 | - [思源文件系统](./file-system.md) 30 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/asset.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/asset` 6 | 7 | ## `upload` {#upload} 8 | 9 | - 🔥 上传资源文件 10 | - `/api/asset/upload` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/asset/upload/payload.d.ts#content [Types] 18 | ::: 19 | 20 | --- 21 | 22 | **响应** 23 | 24 | ::: code-group 25 | <<< @/snippets/siyuan-sdk/types/kernel/api/asset/upload/response.d.ts#content [Types] 26 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/asset/upload/response.schema.json5 [JSON Schema (json5)] 27 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/asset/upload/response.schema.json [JSON Schema (json)] 28 | ::: 29 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/attr.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/attr` 6 | 7 | ## `getBlockAttrs` {#getBlockAttrs} 8 | 9 | - 🔥 获取块属性 10 | - `/api/attr/getBlockAttrs` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/attr/getBlockAttrs/payload.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/attr/getBlockAttrs/payload.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/attr/getBlockAttrs/payload.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | --- 23 | 24 | **响应** 25 | 26 | ::: code-group 27 | <<< @/snippets/siyuan-sdk/types/kernel/api/attr/getBlockAttrs/response.d.ts#content [Types] 28 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/attr/getBlockAttrs/response.schema.json5 [JSON Schema (json5)] 29 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/attr/getBlockAttrs/response.schema.json [JSON Schema (json)] 30 | ::: 31 | 32 | ## `getBookmarkLabels` {#getBookmarkLabels} 33 | 34 | - 🛠 获取所有书签 35 | - `/api/attr/getBookmarkLabels` 36 | 37 | --- 38 | 39 | **响应** 40 | 41 | ::: code-group 42 | <<< @/snippets/siyuan-sdk/types/kernel/api/attr/getBookmarkLabels/response.d.ts#content [Types] 43 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/attr/getBookmarkLabels/response.schema.json5 [JSON Schema (json5)] 44 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/attr/getBookmarkLabels/response.schema.json [JSON Schema (json)] 45 | ::: 46 | 47 | ## `setBlockAttrs` {#setBlockAttrs} 48 | 49 | - 🔥 设置块属性 50 | - `/api/attr/setBlockAttrs` 51 | 52 | --- 53 | 54 | **请求** 55 | 56 | ::: code-group 57 | <<< @/snippets/siyuan-sdk/types/kernel/api/attr/setBlockAttrs/payload.d.ts#content [Types] 58 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/attr/setBlockAttrs/payload.schema.json5 [JSON Schema (json5)] 59 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/attr/setBlockAttrs/payload.schema.json [JSON Schema (json)] 60 | ::: 61 | 62 | --- 63 | 64 | **响应** 65 | 66 | ::: code-group 67 | <<< @/snippets/siyuan-sdk/types/kernel/api/attr/setBlockAttrs/response.d.ts#content [Types] 68 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/attr/setBlockAttrs/response.schema.json5 [JSON Schema (json5)] 69 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/attr/setBlockAttrs/response.schema.json [JSON Schema (json)] 70 | ::: 71 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/broadcast.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/broadcast` 6 | 7 | ## `getChannelInfo` {#getChannelInfo} 8 | 9 | - 🛠 获取指定消息通道的信息 10 | - `/api/broadcast/getChannelInfo` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/broadcast/getChannelInfo/payload.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/broadcast/getChannelInfo/payload.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/broadcast/getChannelInfo/payload.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | --- 23 | 24 | **响应** 25 | 26 | ::: code-group 27 | <<< @/snippets/siyuan-sdk/types/kernel/api/broadcast/getChannelInfo/response.d.ts#content [Types] 28 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/broadcast/getChannelInfo/response.schema.json5 [JSON Schema (json5)] 29 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/broadcast/getChannelInfo/response.schema.json [JSON Schema (json)] 30 | ::: 31 | 32 | ## `getChannels` {#getChannels} 33 | 34 | - 🛠 获取当前所有消息通道的信息 35 | - `/api/broadcast/getChannels` 36 | 37 | --- 38 | 39 | **响应** 40 | 41 | ::: code-group 42 | <<< @/snippets/siyuan-sdk/types/kernel/api/broadcast/getChannels/response.d.ts#content [Types] 43 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/broadcast/getChannels/response.schema.json5 [JSON Schema (json5)] 44 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/broadcast/getChannels/response.schema.json [JSON Schema (json)] 45 | ::: 46 | 47 | ## `postMessage` {#postMessage} 48 | 49 | - 🛠 向指定消息通道推送消息 50 | - `/api/broadcast/postMessage` 51 | 52 | --- 53 | 54 | **请求** 55 | 56 | ::: code-group 57 | <<< @/snippets/siyuan-sdk/types/kernel/api/broadcast/postMessage/payload.d.ts#content [Types] 58 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/broadcast/postMessage/payload.schema.json5 [JSON Schema (json5)] 59 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/broadcast/postMessage/payload.schema.json [JSON Schema (json)] 60 | ::: 61 | 62 | --- 63 | 64 | **响应** 65 | 66 | ::: code-group 67 | <<< @/snippets/siyuan-sdk/types/kernel/api/broadcast/postMessage/response.d.ts#content [Types] 68 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/broadcast/postMessage/response.schema.json5 [JSON Schema (json5)] 69 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/broadcast/postMessage/response.schema.json [JSON Schema (json)] 70 | ::: 71 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/convert.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/convert` 6 | 7 | ## `pandoc` {#pandoc} 8 | 9 | - 🔥 使用 [Pandoc](https://www.pandoc.org/) 进行文件转换 10 | - `/api/convert/pandoc` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/convert/pandoc/payload.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/convert/pandoc/payload.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/convert/pandoc/payload.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | --- 23 | 24 | **响应** 25 | 26 | ::: code-group 27 | <<< @/snippets/siyuan-sdk/types/kernel/api/convert/pandoc/response.d.ts#content [Types] 28 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/convert/pandoc/response.schema.json5 [JSON Schema (json5)] 29 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/convert/pandoc/response.schema.json [JSON Schema (json)] 30 | ::: 31 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/export.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/export` 6 | 7 | ## `exportHTML` {#exportHTML} 8 | 9 | - 🛠 获取文档块 HTML 导出文本 10 | - `/api/export/exportHTML` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/export/exportHTML/payload.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/export/exportHTML/payload.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/export/exportHTML/payload.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | --- 23 | 24 | **响应** 25 | 26 | ::: code-group 27 | <<< @/snippets/siyuan-sdk/types/kernel/api/export/exportHTML/response.d.ts#content [Types] 28 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/export/exportHTML/response.schema.json5 [JSON Schema (json5)] 29 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/export/exportHTML/response.schema.json [JSON Schema (json)] 30 | ::: 31 | 32 | ## `exportMdContent` {#exportMdContent} 33 | 34 | - 🔥 获取文档块 Markdown 导出文本 35 | - `/api/export/exportMdContent` 36 | 37 | --- 38 | 39 | **请求** 40 | 41 | ::: code-group 42 | <<< @/snippets/siyuan-sdk/types/kernel/api/export/exportMdContent/payload.d.ts#content [Types] 43 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/export/exportMdContent/payload.schema.json5 [JSON Schema (json5)] 44 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/export/exportMdContent/payload.schema.json [JSON Schema (json)] 45 | ::: 46 | 47 | --- 48 | 49 | **响应** 50 | 51 | ::: code-group 52 | <<< @/snippets/siyuan-sdk/types/kernel/api/export/exportMdContent/response.d.ts#content [Types] 53 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/export/exportMdContent/response.schema.json5 [JSON Schema (json5)] 54 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/export/exportMdContent/response.schema.json [JSON Schema (json)] 55 | ::: 56 | 57 | ## `exportResources` {#exportResources} 58 | 59 | - 🔥 导出资源文件 60 | - `/api/export/exportResources` 61 | 62 | --- 63 | 64 | **请求** 65 | 66 | ::: code-group 67 | <<< @/snippets/siyuan-sdk/types/kernel/api/export/exportResources/payload.d.ts#content [Types] 68 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/export/exportResources/payload.schema.json5 [JSON Schema (json5)] 69 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/export/exportResources/payload.schema.json [JSON Schema (json)] 70 | ::: 71 | 72 | --- 73 | 74 | **响应** 75 | 76 | ::: code-group 77 | <<< @/snippets/siyuan-sdk/types/kernel/api/export/exportResources/response.d.ts#content [Types] 78 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/export/exportResources/response.schema.json5 [JSON Schema (json5)] 79 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/export/exportResources/response.schema.json [JSON Schema (json)] 80 | ::: 81 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/file.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/file` 6 | 7 | ## `getFile` {#getFile} 8 | 9 | - 🔥 获取文件 10 | - `/api/file/getFile` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/file/getFile/payload.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/getFile/payload.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/getFile/payload.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | ## `putFile` {#putFile} 23 | 24 | - 🔥 写入文件 25 | - `/api/file/putFile` 26 | 27 | --- 28 | 29 | **请求** 30 | 31 | ::: code-group 32 | <<< @/snippets/siyuan-sdk/types/kernel/api/file/putFile/payload.d.ts#content [Types] 33 | ::: 34 | 35 | --- 36 | 37 | **响应** 38 | 39 | ::: code-group 40 | <<< @/snippets/siyuan-sdk/types/kernel/api/file/putFile/response.d.ts#content [Types] 41 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/putFile/response.schema.json5 [JSON Schema (json5)] 42 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/putFile/response.schema.json [JSON Schema (json)] 43 | ::: 44 | 45 | ## `readDir` {#readDir} 46 | 47 | - 🔥 获取文件目录下级内容 48 | - `/api/file/readDir` 49 | 50 | --- 51 | 52 | **请求** 53 | 54 | ::: code-group 55 | <<< @/snippets/siyuan-sdk/types/kernel/api/file/readDir/payload.d.ts#content [Types] 56 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/readDir/payload.schema.json5 [JSON Schema (json5)] 57 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/readDir/payload.schema.json [JSON Schema (json)] 58 | ::: 59 | 60 | --- 61 | 62 | **响应** 63 | 64 | ::: code-group 65 | <<< @/snippets/siyuan-sdk/types/kernel/api/file/readDir/response.d.ts#content [Types] 66 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/readDir/response.schema.json5 [JSON Schema (json5)] 67 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/readDir/response.schema.json [JSON Schema (json)] 68 | ::: 69 | 70 | ## `removeFile` {#removeFile} 71 | 72 | - 🔥 删除 文件/目录 73 | - `/api/file/removeFile` 74 | 75 | --- 76 | 77 | **请求** 78 | 79 | ::: code-group 80 | <<< @/snippets/siyuan-sdk/types/kernel/api/file/removeFile/payload.d.ts#content [Types] 81 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/removeFile/payload.schema.json5 [JSON Schema (json5)] 82 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/removeFile/payload.schema.json [JSON Schema (json)] 83 | ::: 84 | 85 | --- 86 | 87 | **响应** 88 | 89 | ::: code-group 90 | <<< @/snippets/siyuan-sdk/types/kernel/api/file/removeFile/response.d.ts#content [Types] 91 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/removeFile/response.schema.json5 [JSON Schema (json5)] 92 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/removeFile/response.schema.json [JSON Schema (json)] 93 | ::: 94 | 95 | ## `renameFile` {#renameFile} 96 | 97 | - 🔥 重命名/移动 文件/目录 98 | - `/api/file/renameFile` 99 | 100 | --- 101 | 102 | **请求** 103 | 104 | ::: code-group 105 | <<< @/snippets/siyuan-sdk/types/kernel/api/file/renameFile/payload.d.ts#content [Types] 106 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/renameFile/payload.schema.json5 [JSON Schema (json5)] 107 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/renameFile/payload.schema.json [JSON Schema (json)] 108 | ::: 109 | 110 | --- 111 | 112 | **响应** 113 | 114 | ::: code-group 115 | <<< @/snippets/siyuan-sdk/types/kernel/api/file/renameFile/response.d.ts#content [Types] 116 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/renameFile/response.schema.json5 [JSON Schema (json5)] 117 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/file/renameFile/response.schema.json [JSON Schema (json)] 118 | ::: 119 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/history.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/history` 6 | 7 | ## `getDocHistoryContent` {#getDocHistoryContent} 8 | 9 | - 🛠 获取历史文档内容 10 | - `/api/history/getDocHistoryContent` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/history/getDocHistoryContent/payload.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/history/getDocHistoryContent/payload.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/history/getDocHistoryContent/payload.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | --- 23 | 24 | **响应** 25 | 26 | ::: code-group 27 | <<< @/snippets/siyuan-sdk/types/kernel/api/history/getDocHistoryContent/response.d.ts#content [Types] 28 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/history/getDocHistoryContent/response.schema.json5 [JSON Schema (json5)] 29 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/history/getDocHistoryContent/response.schema.json [JSON Schema (json)] 30 | ::: 31 | 32 | ## `getHistoryItems` {#getHistoryItems} 33 | 34 | - 🛠 查询历史项 35 | - `/api/history/getHistoryItems` 36 | 37 | --- 38 | 39 | **请求** 40 | 41 | ::: code-group 42 | <<< @/snippets/siyuan-sdk/types/kernel/api/history/getHistoryItems/payload.d.ts#content [Types] 43 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/history/getHistoryItems/payload.schema.json5 [JSON Schema (json5)] 44 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/history/getHistoryItems/payload.schema.json [JSON Schema (json)] 45 | ::: 46 | 47 | --- 48 | 49 | **响应** 50 | 51 | ::: code-group 52 | <<< @/snippets/siyuan-sdk/types/kernel/api/history/getHistoryItems/response.d.ts#content [Types] 53 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/history/getHistoryItems/response.schema.json5 [JSON Schema (json5)] 54 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/history/getHistoryItems/response.schema.json [JSON Schema (json)] 55 | ::: 56 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/inbox.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/inbox` 6 | 7 | ## `getShorthand` {#getShorthand} 8 | 9 | - 🛠 获取收集箱速记内容 10 | - `/api/inbox/getShorthand` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/inbox/getShorthand/payload.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/inbox/getShorthand/payload.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/inbox/getShorthand/payload.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | --- 23 | 24 | **响应** 25 | 26 | ::: code-group 27 | <<< @/snippets/siyuan-sdk/types/kernel/api/inbox/getShorthand/response.d.ts#content [Types] 28 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/inbox/getShorthand/response.schema.json5 [JSON Schema (json5)] 29 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/inbox/getShorthand/response.schema.json [JSON Schema (json)] 30 | ::: 31 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/network.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/network` 6 | 7 | ## `echo` {#echo} 8 | 9 | - 🛠 回显请求内容 10 | - `/api/network/echo` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/network/echo/payload.d.ts#content [Types] 18 | ::: 19 | 20 | --- 21 | 22 | **响应** 23 | 24 | ::: code-group 25 | <<< @/snippets/siyuan-sdk/types/kernel/api/network/echo/response.d.ts#content [Types] 26 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/network/echo/response.schema.json5 [JSON Schema (json5)] 27 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/network/echo/response.schema.json [JSON Schema (json)] 28 | ::: 29 | 30 | ## `forwardProxy` {#forwardProxy} 31 | 32 | - 🔥 前置代理 33 | - `/api/network/forwardProxy` 34 | 35 | --- 36 | 37 | **请求** 38 | 39 | ::: code-group 40 | <<< @/snippets/siyuan-sdk/types/kernel/api/network/forwardProxy/payload.d.ts#content [Types] 41 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/network/forwardProxy/payload.schema.json5 [JSON Schema (json5)] 42 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/network/forwardProxy/payload.schema.json [JSON Schema (json)] 43 | ::: 44 | 45 | --- 46 | 47 | **响应** 48 | 49 | ::: code-group 50 | <<< @/snippets/siyuan-sdk/types/kernel/api/network/forwardProxy/response.d.ts#content [Types] 51 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/network/forwardProxy/response.schema.json5 [JSON Schema (json5)] 52 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/network/forwardProxy/response.schema.json [JSON Schema (json)] 53 | ::: 54 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/notification.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/notification` 6 | 7 | ## `pushErrMsg` {#pushErrMsg} 8 | 9 | - 🔥 推送错误消息 10 | - `/api/notification/pushErrMsg` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/notification/pushErrMsg/payload.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/notification/pushErrMsg/payload.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/notification/pushErrMsg/payload.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | --- 23 | 24 | **响应** 25 | 26 | ::: code-group 27 | <<< @/snippets/siyuan-sdk/types/kernel/api/notification/pushErrMsg/response.d.ts#content [Types] 28 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/notification/pushErrMsg/response.schema.json5 [JSON Schema (json5)] 29 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/notification/pushErrMsg/response.schema.json [JSON Schema (json)] 30 | ::: 31 | 32 | ## `pushMsg` {#pushMsg} 33 | 34 | - 🔥 推送消息 35 | - `/api/notification/pushMsg` 36 | 37 | --- 38 | 39 | **请求** 40 | 41 | ::: code-group 42 | <<< @/snippets/siyuan-sdk/types/kernel/api/notification/pushMsg/payload.d.ts#content [Types] 43 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/notification/pushMsg/payload.schema.json5 [JSON Schema (json5)] 44 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/notification/pushMsg/payload.schema.json [JSON Schema (json)] 45 | ::: 46 | 47 | --- 48 | 49 | **响应** 50 | 51 | ::: code-group 52 | <<< @/snippets/siyuan-sdk/types/kernel/api/notification/pushMsg/response.d.ts#content [Types] 53 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/notification/pushMsg/response.schema.json5 [JSON Schema (json5)] 54 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/notification/pushMsg/response.schema.json [JSON Schema (json)] 55 | ::: 56 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/query.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/query` 6 | 7 | ## `sql` {#sql} 8 | 9 | - 🔥 SQL 查询 10 | - `/api/query/sql` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/query/sql/payload.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/query/sql/payload.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/query/sql/payload.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | --- 23 | 24 | **响应** 25 | 26 | ::: code-group 27 | <<< @/snippets/siyuan-sdk/types/kernel/api/query/sql/response.d.ts#content [Types] 28 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/query/sql/response.schema.json5 [JSON Schema (json5)] 29 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/query/sql/response.schema.json [JSON Schema (json)] 30 | ::: 31 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/repo.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/repo` 6 | 7 | ## `openRepoSnapshotDoc` {#openRepoSnapshotDoc} 8 | 9 | - 🛠 读取快照文件内容 10 | - `/api/repo/openRepoSnapshotDoc` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/repo/openRepoSnapshotDoc/payload.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/repo/openRepoSnapshotDoc/payload.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/repo/openRepoSnapshotDoc/payload.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | --- 23 | 24 | **响应** 25 | 26 | ::: code-group 27 | <<< @/snippets/siyuan-sdk/types/kernel/api/repo/openRepoSnapshotDoc/response.d.ts#content [Types] 28 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/repo/openRepoSnapshotDoc/response.schema.json5 [JSON Schema (json5)] 29 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/repo/openRepoSnapshotDoc/response.schema.json [JSON Schema (json)] 30 | ::: 31 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/search.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/search` 6 | 7 | ## `fullTextSearchBlock` {#fullTextSearchBlock} 8 | 9 | - 🛠 全文搜索 10 | - `/api/search/fullTextSearchBlock` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/search/fullTextSearchBlock/payload.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/search/fullTextSearchBlock/payload.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/search/fullTextSearchBlock/payload.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | --- 23 | 24 | **响应** 25 | 26 | ::: code-group 27 | <<< @/snippets/siyuan-sdk/types/kernel/api/search/fullTextSearchBlock/response.d.ts#content [Types] 28 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/search/fullTextSearchBlock/response.schema.json5 [JSON Schema (json5)] 29 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/search/fullTextSearchBlock/response.schema.json [JSON Schema (json)] 30 | ::: 31 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/snippet.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/snippet` 6 | 7 | ## `getSnippet` {#getSnippet} 8 | 9 | - 🛠 获取代码片段 10 | - `/api/snippet/getSnippet` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/snippet/getSnippet/payload.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/snippet/getSnippet/payload.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/snippet/getSnippet/payload.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | --- 23 | 24 | **响应** 25 | 26 | ::: code-group 27 | <<< @/snippets/siyuan-sdk/types/kernel/api/snippet/getSnippet/response.d.ts#content [Types] 28 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/snippet/getSnippet/response.schema.json5 [JSON Schema (json5)] 29 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/snippet/getSnippet/response.schema.json [JSON Schema (json)] 30 | ::: 31 | 32 | ## `setSnippet` {#setSnippet} 33 | 34 | - 🛠 设置代码片段 35 | - `/api/snippet/setSnippet` 36 | 37 | --- 38 | 39 | **请求** 40 | 41 | ::: code-group 42 | <<< @/snippets/siyuan-sdk/types/kernel/api/snippet/setSnippet/payload.d.ts#content [Types] 43 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/snippet/setSnippet/payload.schema.json5 [JSON Schema (json5)] 44 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/snippet/setSnippet/payload.schema.json [JSON Schema (json)] 45 | ::: 46 | 47 | --- 48 | 49 | **响应** 50 | 51 | ::: code-group 52 | <<< @/snippets/siyuan-sdk/types/kernel/api/snippet/setSnippet/response.d.ts#content [Types] 53 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/snippet/setSnippet/response.schema.json5 [JSON Schema (json5)] 54 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/snippet/setSnippet/response.schema.json [JSON Schema (json)] 55 | ::: 56 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/sqlite.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/sqlite` 6 | 7 | ## `flushTransaction` {#flushTransaction} 8 | 9 | - 🛠 等待业务数据持久化完成 10 | - `/api/sqlite/flushTransaction` 11 | 12 | --- 13 | 14 | **响应** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/sqlite/flushTransaction/response.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/sqlite/flushTransaction/response.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/sqlite/flushTransaction/response.schema.json [JSON Schema (json)] 20 | ::: 21 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/storage.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/storage` 6 | 7 | ## `getLocalStorage` {#getLocalStorage} 8 | 9 | - 🛠 获取持久化的本地存储数据 10 | - `/api/storage/getLocalStorage` 11 | 12 | --- 13 | 14 | **响应** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/storage/getLocalStorage/response.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/storage/getLocalStorage/response.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/storage/getLocalStorage/response.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | ## `getRecentDocs` {#getRecentDocs} 23 | 24 | - 🛠 获取最近打开的文档 25 | - `/api/storage/getRecentDocs` 26 | 27 | --- 28 | 29 | **响应** 30 | 31 | ::: code-group 32 | <<< @/snippets/siyuan-sdk/types/kernel/api/storage/getRecentDocs/response.d.ts#content [Types] 33 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/storage/getRecentDocs/response.schema.json5 [JSON Schema (json5)] 34 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/storage/getRecentDocs/response.schema.json [JSON Schema (json)] 35 | ::: 36 | 37 | ## `setLocalStorage` {#setLocalStorage} 38 | 39 | - 🛠 持久化本地存储数据 40 | - `/api/storage/setLocalStorage` 41 | 42 | --- 43 | 44 | **请求** 45 | 46 | ::: code-group 47 | <<< @/snippets/siyuan-sdk/types/kernel/api/storage/setLocalStorage/payload.d.ts#content [Types] 48 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/storage/setLocalStorage/payload.schema.json5 [JSON Schema (json5)] 49 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/storage/setLocalStorage/payload.schema.json [JSON Schema (json)] 50 | ::: 51 | 52 | --- 53 | 54 | **响应** 55 | 56 | ::: code-group 57 | <<< @/snippets/siyuan-sdk/types/kernel/api/storage/setLocalStorage/response.d.ts#content [Types] 58 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/storage/setLocalStorage/response.schema.json5 [JSON Schema (json5)] 59 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/storage/setLocalStorage/response.schema.json [JSON Schema (json)] 60 | ::: 61 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/system.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/system` 6 | 7 | ## `bootProgress` {#bootProgress} 8 | 9 | - 🔥 获取内核启动进度 10 | - `/api/system/bootProgress` 11 | 12 | --- 13 | 14 | **响应** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/system/bootProgress/response.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/bootProgress/response.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/bootProgress/response.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | ## `currentTime` {#currentTime} 23 | 24 | - 🔥 获取当前时间 25 | - `/api/system/currentTime` 26 | 27 | --- 28 | 29 | **响应** 30 | 31 | ::: code-group 32 | <<< @/snippets/siyuan-sdk/types/kernel/api/system/currentTime/response.d.ts#content [Types] 33 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/currentTime/response.schema.json5 [JSON Schema (json5)] 34 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/currentTime/response.schema.json [JSON Schema (json)] 35 | ::: 36 | 37 | ## `exit` {#exit} 38 | 39 | - 🛠 退出内核 40 | - `/api/system/exit` 41 | 42 | --- 43 | 44 | **请求** 45 | 46 | ::: code-group 47 | <<< @/snippets/siyuan-sdk/types/kernel/api/system/exit/payload.d.ts#content [Types] 48 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/exit/payload.schema.json5 [JSON Schema (json5)] 49 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/exit/payload.schema.json [JSON Schema (json)] 50 | ::: 51 | 52 | --- 53 | 54 | **响应** 55 | 56 | ::: code-group 57 | <<< @/snippets/siyuan-sdk/types/kernel/api/system/exit/response.d.ts#content [Types] 58 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/exit/response.schema.json5 [JSON Schema (json5)] 59 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/exit/response.schema.json [JSON Schema (json)] 60 | ::: 61 | 62 | ## `getConf` {#getConf} 63 | 64 | - 🛠 获取工作空间完整配置 65 | - `/api/system/getConf` 66 | 67 | --- 68 | 69 | **响应** 70 | 71 | ::: code-group 72 | <<< @/snippets/siyuan-sdk/types/kernel/api/system/getConf/response.d.ts#content [Types] 73 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/getConf/response.schema.json5 [JSON Schema (json5)] 74 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/getConf/response.schema.json [JSON Schema (json)] 75 | ::: 76 | 77 | ## `logoutAuth` {#logoutAuth} 78 | 79 | - 🛠 注销登录状态 80 | - `/api/system/logoutAuth` 81 | 82 | --- 83 | 84 | **响应** 85 | 86 | ::: code-group 87 | <<< @/snippets/siyuan-sdk/types/kernel/api/system/logoutAuth/response.d.ts#content [Types] 88 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/logoutAuth/response.schema.json5 [JSON Schema (json5)] 89 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/logoutAuth/response.schema.json [JSON Schema (json)] 90 | ::: 91 | 92 | ## `version` {#version} 93 | 94 | - 🔥 获取内核版本 95 | - `/api/system/version` 96 | 97 | --- 98 | 99 | **响应** 100 | 101 | ::: code-group 102 | <<< @/snippets/siyuan-sdk/types/kernel/api/system/version/response.d.ts#content [Types] 103 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/version/response.schema.json5 [JSON Schema (json5)] 104 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/system/version/response.schema.json [JSON Schema (json)] 105 | ::: 106 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/api/template.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/api/template` 6 | 7 | ## `render` {#render} 8 | 9 | - 🔥 渲染模板 10 | - `/api/template/render` 11 | 12 | --- 13 | 14 | **请求** 15 | 16 | ::: code-group 17 | <<< @/snippets/siyuan-sdk/types/kernel/api/template/render/payload.d.ts#content [Types] 18 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/template/render/payload.schema.json5 [JSON Schema (json5)] 19 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/template/render/payload.schema.json [JSON Schema (json)] 20 | ::: 21 | 22 | --- 23 | 24 | **响应** 25 | 26 | ::: code-group 27 | <<< @/snippets/siyuan-sdk/types/kernel/api/template/render/response.d.ts#content [Types] 28 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/template/render/response.schema.json5 [JSON Schema (json5)] 29 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/template/render/response.schema.json [JSON Schema (json)] 30 | ::: 31 | 32 | ## `renderSprig` {#renderSprig} 33 | 34 | - 🔥 渲染 [Sprig](https://masterminds.github.io/sprig/) 模板字符串 35 | - `/api/template/renderSprig` 36 | 37 | --- 38 | 39 | **请求** 40 | 41 | ::: code-group 42 | <<< @/snippets/siyuan-sdk/types/kernel/api/template/renderSprig/payload.d.ts#content [Types] 43 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/template/renderSprig/payload.schema.json5 [JSON Schema (json5)] 44 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/template/renderSprig/payload.schema.json [JSON Schema (json)] 45 | ::: 46 | 47 | --- 48 | 49 | **响应** 50 | 51 | ::: code-group 52 | <<< @/snippets/siyuan-sdk/types/kernel/api/template/renderSprig/response.d.ts#content [Types] 53 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/template/renderSprig/response.schema.json5 [JSON Schema (json5)] 54 | <<< @/snippets/siyuan-sdk/schemas/kernel/api/template/renderSprig/response.schema.json [JSON Schema (json)] 55 | ::: 56 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/kernel/ws.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `/ws` 6 | 7 | --- 8 | 9 | ## `broadcast` {#broadcast} 10 | 11 | --- 12 | 13 | - 🛠 消息广播订阅 14 | - `/ws/broadcast` 15 | 16 | --- 17 | 18 | **请求** 19 | 20 | ::: code-group 21 | <<< @/snippets/siyuan-sdk/types/kernel/ws/broadcast.d.ts#content [Types] 22 | ::: 23 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/community/siyuan-sdk/start.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 开始 6 | 7 | ## 安装 8 | 9 | ```bash 10 | # 使用 npm 11 | $ npm install @siyuan-community/siyuan-sdk 12 | 13 | # 使用 pnpm 14 | $ pnpm i @siyuan-community/siyuan-sdk 15 | 16 | # 使用 yarn 17 | $ yarn add @siyuan-community/siyuan-sdk 18 | ``` 19 | 20 | ## 初始化客户端 21 | 22 | ### 默认配置 23 | 24 | ```typescript 25 | import { Client } from "@siyuan-community/siyuan-sdk"; 26 | 27 | /* 初始化客户端 (默认使用 Axios 发起 XHR 请求) */ 28 | const client = new Client({ 29 | /** 30 | * (可选) 思源内核服务地址 31 | * @default: document.baseURI 32 | */ 33 | baseURL: "http://localhost:6806/", 34 | 35 | /** 36 | * (可选) 思源内核服务 token 37 | * @default: <空> 38 | */ 39 | token: "0123456789abcdef", // , 默认为空 40 | 41 | /** 42 | * (可选) Axios 其他请求配置 43 | * REF: https://axios-http.com/zh/docs/req_config 44 | * REF: https://www.axios-http.cn/docs/req_config 45 | */ 46 | }); 47 | ``` 48 | 49 | - [Axios](https://axios-http.com/zh/) 请求配置文档 50 | - [请求配置 | Axios Docs](https://axios-http.com/zh/docs/req_config) 51 | - [请求配置 | Axios 中文文档 | Axios 中文网](https://www.axios-http.cn/docs/req_config) 52 | 53 | ### 配置为 `XHR` 客户端 54 | 55 | ```typescript 56 | import { Client } from "@siyuan-community/siyuan-sdk"; 57 | 58 | /* 初始化为 XHR 客户端 (使用 Axios 发起 XHR 请求) */ 59 | const client = new Client( 60 | { 61 | /** 62 | * (可选) 思源内核服务地址 63 | * @default: document.baseURI 64 | */ 65 | baseURL: "http://localhost:6806/", 66 | 67 | /** 68 | * (可选) 思源内核服务 token 69 | * @default: <空> 70 | */ 71 | token: "0123456789abcdef", // , 默认为空 72 | 73 | /** 74 | * (可选) Axios 其他请求配置 75 | * REF: https://axios-http.com/zh/docs/req_config 76 | * REF: https://www.axios-http.cn/docs/req_config 77 | */ 78 | }, 79 | "xhr", 80 | ); 81 | ``` 82 | 83 | - [Axios](https://axios-http.com/zh/) 请求配置文档 84 | - [请求配置 | Axios Docs](https://axios-http.com/zh/docs/req_config) 85 | - [请求配置 | Axios 中文文档 | Axios 中文网](https://www.axios-http.cn/docs/req_config) 86 | 87 | ### 配置为 `Fetch` 客户端 88 | 89 | ```typescript 90 | import { Client } from "@siyuan-community/siyuan-sdk"; 91 | 92 | /* 初始化为 Fetch 客户端 (使用 ofetch 发起 Fetch 请求) */ 93 | const client = new Client( 94 | { 95 | /** 96 | * (可选) 思源内核服务地址 97 | * @default: document.baseURI 98 | */ 99 | baseURL: "http://localhost:6806/", 100 | 101 | /** 102 | * (可选) 思源内核服务 token 103 | * @default: <空> 104 | */ 105 | token: "0123456789abcdef", // , 默认为空 106 | 107 | /** 108 | * (可选) ofetch 其他请求配置 109 | * REF: https://www.npmjs.com/package/ofetch 110 | * REF: https://www.jsdocs.io/package/ofetch 111 | */ 112 | }, 113 | "fetch", 114 | ); 115 | ``` 116 | 117 | - [ofetch](https://github.com/unjs/ofetch) 请求配置文档 118 | - [ofetch - npm](https://www.npmjs.com/package/ofetch) 119 | - [ofetch - jsDocs.io](https://www.jsdocs.io/package/ofetch) 120 | 121 | ## 更改配置 122 | 123 | ### 更改 HTTP 客户端模式 124 | 125 | ```typescript 126 | client._setClientType("fetch"); // 将客户端模式更改为 Fetch 127 | client._setClientType("xhr"); // 将客户端模式更改为 XHR 128 | ``` 129 | 130 | ### 更新客户端全局配置 131 | 132 | ```typescript 133 | /* 默认更新当前模式的全局配置 */ 134 | client._updateOptions({ 135 | token: "abcdef0123456789", // 将思源 API token 更改为 abcdef0123456789 136 | }); 137 | 138 | /* 更新 XHR 客户端 Axios 的全局配置 */ 139 | client._updateOptions( 140 | { 141 | timeout: 10_000, // 请求超时时间为 10s 142 | /* 其他 Axios 请求配置 */ 143 | }, 144 | "xhr", 145 | ); 146 | 147 | /* 更新 Fetch 客户端 ofetch 的全局配置 */ 148 | client._updateOptions( 149 | { 150 | retry: 3, // 请求重试次数为 3 次 151 | /* 其他 ofetch 请求配置 */ 152 | }, 153 | "fetch", 154 | ); 155 | ``` 156 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 模板 6 | 7 | ## 模板函数 8 | 9 | - [思源内置模板函数](./siyuan.md) 10 | - [`Sprig` 模板函数](./sprig/index.md) 11 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/conversion.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 类型转换函数 6 | 7 | Sprig 提供了以下类型转换函数: 8 | 9 | - `atoi`:将字符串转换为整数。 10 | - `float64`:转换为 `float64` 类型。 11 | - `int`:按系统的宽度将值转换为 `int` 类型。 12 | - `int64`:转换为 `int64` 类型。 13 | - `toDecimal`:将 unix 八进制转换为 `int64` 类型。 14 | - `toString`:转换为字符串。 15 | - `toStrings`:将列表、切片或数组转换为字符串列表。 16 | 17 | 只有 `atoi` 需要输入是特定类型的。其他函数会尝试将任何类型的值转换为目标类型。例如,`int64` 可以将浮点数转换为整数,也可以将字符串转换为整数。 18 | 19 | ## `toStrings` 20 | 21 | 给定一个类似列表的集合,生成一个字符串切片。 22 | 23 | ``` 24 | list 1 2 3 | toStrings 25 | ``` 26 | 27 | 以上将 `1` 转换为 `"1"`,`2` 转换为 `"2"`,依此类推,然后将它们作为列表返回。 28 | 29 | ## `toDecimal` 30 | 31 | 给定一个 unix 八进制权限标志字符串,生成一个十进制数。 32 | 33 | ``` 34 | "0777" | toDecimal 35 | ``` 36 | 37 | 以上将 `0777` 转换为 `511`,并将该值作为 `int64` 返回。 38 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/crypto.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 密码学与安全函数 6 | 7 | Sprig 提供了一些高级密码学功能。 8 | 9 | ## `sha1sum` 10 | 11 | `sha1sum` 函数接收一个字符串,并计算其 SHA1 摘要。 12 | 13 | ``` 14 | sha1sum "Hello world!" 15 | ``` 16 | 17 | ## `sha256sum` 18 | 19 | `sha256sum` 函数接收一个字符串,并计算其 SHA256 摘要。 20 | 21 | ``` 22 | sha256sum "Hello world!" 23 | ``` 24 | 25 | 以上内容将以 “ASCII Armored” 格式计算 SHA256 摘要,可安全打印。 26 | 27 | ## `adler32sum` 28 | 29 | `adler32sum` 函数接收一个字符串,并计算其 Adler-32 校验和。 30 | 31 | ``` 32 | adler32sum "Hello world!" 33 | ``` 34 | 35 | ## `bcrypt` 36 | 37 | `bcrypt` 函数接收一个字符串,并生成其 `bcrypt` 哈希值。 38 | 39 | ``` 40 | bcrypt "myPassword" 41 | ``` 42 | 43 | ## `htpasswd` 44 | 45 | `htpasswd` 函数接受 `username` 和 `password`,并生成密码的 `bcrypt` 哈希值。结果可用于 [Apache HTTP Server](https://httpd.apache.org/docs/2.4/misc/password_encryptions.html#basic) 上的基本认证。 46 | 47 | ``` 48 | htpasswd "myUser" "myPassword" 49 | ``` 50 | 51 | 注意,在模板中直接存储密码是不安全的。 52 | 53 | ## `randBytes` 54 | 55 | `randBytes` 函数接受一个计数 `N` 并生成一个密码学安全(使用 `crypto/rand`)的长度为 `N` 的随机字节序列。该序列以 base64 编码的字符串形式返回。 56 | 57 | ``` 58 | randBytes 24 59 | ``` 60 | 61 | ## `derivePassword` 62 | 63 | `derivePassword` 函数可用于根据某些共享的“主密码”约束派生特定密码。此算法已[明确定义](https://masterpassword.app/masterpassword-algorithm.pdf)。 64 | 65 | ``` 66 | derivePassword 1 "long" "password" "user" "example.com" 67 | ``` 68 | 69 | 注意,将部分直接存储在模板中被视为不安全。 70 | 71 | ## `genPrivateKey` 72 | 73 | `genPrivateKey` 函数生成一个以 PEM 块形式编码的新私钥。 74 | 75 | 它使用以下值之一作为第一个参数: 76 | 77 | - `ecdsa`:生成椭圆曲线 DSA 密钥(P256) 78 | - `dsa`:生成 DSA 密钥(L2048N256) 79 | - `rsa`:生成 RSA 4096 密钥 80 | - `ed25519`:生成 Ed25519 密钥 81 | 82 | ## `buildCustomCert` 83 | 84 | `buildCustomCert` 函数允许自定义证书。 85 | 86 | 它接受以下字符串参数: 87 | 88 | - base64 编码的 PEM 格式证书 89 | - base64 编码的 PEM 格式私钥 90 | 91 | 它返回具有以下属性的证书对象: 92 | 93 | - `Cert`:PEM 编码的证书 94 | - `Key`:PEM 编码的私钥 95 | 96 | 示例: 97 | 98 | ``` 99 | $ca := buildCustomCert "base64-encoded-ca-crt" "base64-encoded-ca-key" 100 | ``` 101 | 102 | 请注意,返回的对象可以传递给 `genSignedCert` 函数,以使用此 CA 签署证书。 103 | 104 | ## `genCA` 105 | 106 | `genCA` 函数使用 2048 位 RSA 私钥生成一个新的自签名 x509 证书颁发机构。 107 | 108 | 它接受以下参数: 109 | 110 | - 主体的通用名称(cn) 111 | - 证书有效期(以天为单位) 112 | 113 | 它返回具有以下属性的对象: 114 | 115 | - `Cert`:PEM 编码的证书 116 | - `Key`:PEM 编码的私钥 117 | 118 | 示例: 119 | 120 | ``` 121 | $ca := genCA "foo-ca" 365 122 | ``` 123 | 124 | 请注意,返回的对象可以传递给 `genSignedCert` 函数,以使用此 CA 签署证书。 125 | 126 | ## `genCAWithKey` 127 | 128 | `genCAWithKey` 函数使用给定的私钥生成一个新的自签名 x509 证书颁发机构。 129 | 130 | 它接受以下参数: 131 | 132 | - 主体的通用名称(cn) 133 | - 证书有效期(以天为单位) 134 | - 私钥(PEM 编码);不支持 DSA 密钥 135 | 136 | 它返回具有以下属性的对象: 137 | 138 | - `Cert`:PEM 编码的证书 139 | - `Key`:PEM 编码的私钥 140 | 141 | 示例: 142 | 143 | ``` 144 | $ca := genCAWithKey "foo-ca" 365 (genPrivateKey "rsa") 145 | ``` 146 | 147 | 请注意,返回的对象可以传递给 `genSignedCert` 函数,以使用此 CA 签署证书。 148 | 149 | ## `genSelfSignedCert` 150 | 151 | `genSelfSignedCert` 函数使用 2048 位 RSA 私钥生成一个新的自签名 x509 证书。 152 | 153 | 它接受以下参数: 154 | 155 | - 主体的通用名称(cn) 156 | - 可选的 IP 列表;可以为 nil 157 | - 可选的替代 DNS 名称列表;可以为 nil 158 | - 证书有效期(以天为单位) 159 | 160 | 它返回具有以下属性的对象: 161 | 162 | - `Cert`:PEM 编码的证书 163 | - `Key`:PEM 编码的私钥 164 | 165 | 示例: 166 | 167 | ``` 168 | $cert := genSelfSignedCert "foo.com" (list "10.0.0.1" "10.0.0.2") (list "bar.com" "bat.com") 365 169 | ``` 170 | 171 | ## `genSelfSignedCertWithKey` 172 | 173 | `genSelfSignedCertWithKey` 函数使用给定的私钥生成一个新的自签名 x509 证书。 174 | 175 | 它接受以下参数: 176 | 177 | - 主体的通用名称(cn) 178 | - 可选的 IP 列表;可以为 nil 179 | - 可选的替代 DNS 名称列表;可以为 nil 180 | - 证书有效期(以天为单位) 181 | - 私钥(PEM 编码);不支持 DSA 密钥 182 | 183 | 它返回具有以下属性的对象: 184 | 185 | - `Cert`:PEM 编码的证书 186 | - `Key`:PEM 编码的私钥 187 | 188 | 示例: 189 | 190 | ``` 191 | $cert := genSelfSignedCertWithKey "foo.com" (list "10.0.0.1" "10.0.0.2") (list "bar.com" "bat.com") 365 (genPrivateKey "ecdsa") 192 | ``` 193 | 194 | ## `genSignedCert` 195 | 196 | `genSignedCert` 函数使用指定的 CA 的 2048 位 RSA 私钥生成一个新的 x509 证书。 197 | 198 | 它接受以下参数: 199 | 200 | - 主体的通用名称(cn) 201 | - 可选的 IP 列表;可以为 nil 202 | - 可选的替代 DNS 名称列表;可以为 nil 203 | - 证书有效期(以天为单位) 204 | - CA(参见 `genCA`) 205 | 206 | 示例: 207 | 208 | ``` 209 | $ca := genCA "foo-ca" 365 210 | $cert := genSignedCert "foo.com" (list "10.0.0.1" "10.0.0.2") (list "bar.com" "bat.com") 365 $ca 211 | ``` 212 | 213 | ## `genSignedCertWithKey` 214 | 215 | `genSignedCertWithKey` 函数使用指定的 CA 和给定的私钥生成一个新的 x509 证书。 216 | 217 | 它接受以下参数: 218 | 219 | - 主体的通用名称(cn) 220 | - 可选的 IP 列表;可以为 nil 221 | - 可选的替代 DNS 名称列表;可以为 nil 222 | - 证书有效期(以天为单位) 223 | - CA(参见 `genCA`) 224 | - 私钥(PEM 编码);不支持 DSA 密钥 225 | 226 | 示例: 227 | 228 | ``` 229 | $ca := genCA "foo-ca" 365 230 | $cert := genSignedCert "foo.com" (list "10.0.0.1" "10.0.0.2") (list "bar.com" "bat.com") 365 $ca (genPrivateKey "ed25519") 231 | ``` 232 | 233 | ## `encryptAES` 234 | 235 | `encryptAES` 函数使用 AES-256 CBC 加密文本,并返回一个 base64 编码的字符串。 236 | 237 | ``` 238 | encryptAES "secretkey" "plaintext" 239 | ``` 240 | 241 | ## `decryptAES` 242 | 243 | `decryptAES` 函数接收一个由 AES-256 CBC 算法编码的 base64 字符串,并返回解码后的文本。 244 | 245 | ``` 246 | "30tEfhuJSVRhpG97XCuWgz2okj7L8vQ1s6V9zVUPeDQ=" | decryptAES "secretkey" 247 | ``` 248 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/date.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 日期函数 6 | 7 | ## `now` 8 | 9 | 当前日期/时间。与其他日期函数一起使用。 10 | 11 | ## `ago` 12 | 13 | `ago` 函数返回从 `time.Now` 开始计算的时间间隔,以秒为单位。 14 | 15 | ``` 16 | ago .CreatedAt" 17 | ``` 18 | 19 | 上述语句以 `time.Duration` String() 格式返回 `2h34m7s` 20 | 21 | ## `date` 22 | 23 | `date` 函数可以格式化日期 24 | 25 | 将日期格式化为 `年-月-日` 26 | 27 | ``` 28 | now | date "2006-01-02" 29 | ``` 30 | 31 | 使用 Go 的时间日期格式化方案 32 | 33 | 简而言之,将以下日期作为格式化的模板日期 34 | 35 | ``` 36 | 1月2日 15:04:05 2006年 37 | ``` 38 | 39 | ## `dateInZone` 40 | 41 | 与 `date` 类似,但包含时区信息 42 | 43 | ``` 44 | dateInZone "2006-01-02" (now) "UTC" 45 | ``` 46 | 47 | ## `duration` 48 | 49 | 将给定的秒数格式化为 `time.Duration` 50 | 51 | ``` 52 | duration 95 53 | ``` 54 | 55 | 上述语句返回 `1m36s` 56 | 57 | ## `durationRound` 58 | 59 | 将给定的时间间隔四舍五入到最重要的单位。解析字符串和 `time.Duration` 作为时间间隔,而 `time.Time` 则计算为时间间隔。 60 | 61 | ``` 62 | durationRound "2h10m5s" 63 | ``` 64 | 65 | 上述语句返回 `2h` 66 | 67 | ``` 68 | durationRound "2400h10m5s" 69 | ``` 70 | 71 | 上述语句返回 `3mo` 72 | 73 | ## `unixEpoch` 74 | 75 | 返回 `time.Time` 自 Unix 时刻以来的秒数 76 | 77 | ``` 78 | now | unixEpoch 79 | ``` 80 | 81 | ## `dateModify`, `mustDateModify` 82 | 83 | `dateModify` 接受一个修改量和一个日期,并返回时间戳 84 | 85 | ``` 86 | now | date_modify "-1.5h" 87 | ``` 88 | 89 | 上述语句从当前时间减去1小时30分钟 90 | 91 | 如果修改格式不正确,则 `dateModify` 将返回日期未修改的结果。否则 `mustDateModify` 将返回错误。 92 | 93 | ## `htmlDate` 94 | 95 | `htmlDate` 函数将日期格式化为 HTML 日期选择器的输入字段的格式。 96 | 97 | ``` 98 | now | htmlDate 99 | ``` 100 | 101 | ## `htmlDateInZone` 102 | 103 | 与 `htmlDate` 相同,但包含时区信息 104 | 105 | ``` 106 | htmlDateInZone (now) "UTC" 107 | ``` 108 | 109 | ## `toDate`, `mustToDate` 110 | 111 | `toDate` 将字符串转换为日期 112 | 113 | 参数 114 | 115 | - 日期模板字符串 116 | - 日期字符串 117 | 118 | `toDate` 如果不能转换字符串,则返回零值 119 | 120 | `mustToDate` 如果字符串无法转换,则返回错误 121 | 122 | 可用于将字符串日期转换为另一种格式 123 | 124 | ``` 125 | toDate "2006-01-02" "2017-12-31" | date "02/01/2006" 126 | ``` 127 | 128 | 上述语句将字符串 `"2017-12-31"` 转换为 `"31/12/2017"` 129 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/defaults.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 默认值函数 6 | 7 | Sprig 提供了为模板设置默认值的工具。 8 | 9 | ## `default` 10 | 11 | 要设置简单的默认值,请使用 `default`: 12 | 13 | ``` 14 | default "foo" .Bar 15 | ``` 16 | 17 | 在上述示例中,如果 `.Bar` 的计算结果为非空值,则使用该值。但如果为空,则返回 `foo`。 18 | 19 | "空" 的定义取决于类型: 20 | 21 | - 数字:`0` 22 | - 字符串:`""` 23 | - 列表:`[]` 24 | - 字典:`{}` 25 | - 布尔值:`false` 26 | - 同时也包括 `nil`(即 null) 27 | 28 | 对于结构体,没有空的定义,因此结构体永远不会返回默认值。 29 | 30 | ## `empty` 31 | 32 | `empty` 函数会根据给定值是否为空返回 `true` 或 `false`。 33 | 34 | 空的值在 `default` 部分中列出。 35 | 36 | ``` 37 | empty .Foo 38 | ``` 39 | 40 | 请注意,在 Go 模板的条件中,会为您计算是否为空。因此,您很少需要使用 `if empty .Foo`。而是直接使用 `if .Foo`。 41 | 42 | ## `coalesce` 43 | 44 | `coalesce` 函数接受一列值,并返回第一个非空值。 45 | 46 | ``` 47 | coalesce 0 1 2 48 | ``` 49 | 50 | 上述示例返回 `1`。 51 | 52 | 此函数适用于扫描多个变量或值的情况: 53 | 54 | ``` 55 | coalesce .name .parent.name "Matt" 56 | ``` 57 | 58 | 上述示例首先检查 `.name` 是否为空。 59 | 60 | 如果不为空,则返回该值。 61 | 62 | 如果为空,`coalesce` 将评估 `.parent.name` 是否为空。 63 | 64 | 最后,如果 `.name` 和 `.parent.name` 都为空,则返回 `Matt`。 65 | 66 | ## `all` 67 | 68 | `all` 函数接受一列值,并在所有值均非空时返回 `true`。 69 | 70 | ``` 71 | all 0 1 2 72 | ``` 73 | 74 | 上述示例返回 `false`。 75 | 76 | 此函数适用于评估多个变量或值的条件的情况: 77 | 78 | ``` 79 | all (eq .Request.TLS.Version 0x0304) (.Request.ProtoAtLeast 2 0) (eq .Request.Method "POST") 80 | ``` 81 | 82 | 上述示例将检查 `http.Request` 是否为 `"POST"` 方法,并具有 `tls 1.3` 和 `http/2` 版本。 83 | 84 | ## `any` 85 | 86 | `any` 函数接受一列值,并在任何一个值非空时返回 `true`。 87 | 88 | ``` 89 | any 0 1 2 90 | ``` 91 | 92 | 上述示例返回 `true`。 93 | 94 | 此函数适用于评估多个变量或值的条件的情况: 95 | 96 | ``` 97 | any (eq .Request.Method "GET") (eq .Request.Method "POST") (eq .Request.Method "OPTIONS") 98 | ``` 99 | 100 | 上述示例将检查 `http.Request` 的方法是否为 `GET/POST/OPTIONS` 之一。 101 | 102 | ## `fromJson`, `mustFromJson` 103 | 104 | `fromJson` 函数将 JSON 文档解码为结构体。 105 | 106 | 如果输入无法解码为 JSON,则该函数将返回空字符串。 107 | 108 | `mustFromJson` 会在 JSON 无效时返回错误。 109 | 110 | ``` 111 | fromJson "{\"foo\": 55}" 112 | ``` 113 | 114 | ## `toJson`, `mustToJson` 115 | 116 | `toJson` 函数将项目编码为 JSON 字符串。 117 | 118 | 如果项目无法转换为 JSON,则该函数将返回空字符串。 119 | 120 | `mustToJson` 会在项目无法以 JSON 编码时返回错误。 121 | 122 | ``` 123 | toJson .Item 124 | ``` 125 | 126 | 上述示例返回 `.Item` 的 JSON 字符串表示形式。 127 | 128 | ## `toPrettyJson`, `mustToPrettyJson` 129 | 130 | `toPrettyJson` 函数将项目编码为漂亮(缩进)的 JSON 字符串。 131 | 132 | ``` 133 | toPrettyJson .Item 134 | ``` 135 | 136 | 上述示例返回 `.Item` 的缩进的 JSON 字符串表示形式。 137 | 138 | ## `toRawJson`, `mustToRawJson` 139 | 140 | `toRawJson` 函数将项目编码为带有未转义 HTML 字符的 JSON 字符串。 141 | 142 | ``` 143 | toRawJson .Item 144 | ``` 145 | 146 | 上述示例返回 `.Item` 的未转义的 JSON 字符串表示形式。 147 | 148 | ## `ternary` 149 | 150 | `ternary` 函数接受两个值和一个测试值。 151 | 152 | 如果测试值为真,则返回第一个值。 153 | 154 | 如果测试值为空,则返回第二个值。 155 | 156 | 这类似于 C 三元运算符。 157 | 158 | ### 测试值为真 159 | 160 | ``` 161 | ternary "foo" "bar" true 162 | ``` 163 | 164 | 或 165 | 166 | ``` 167 | true | ternary "foo" "bar" 168 | ``` 169 | 170 | 上述示例返回 `"foo"`。 171 | 172 | ### 测试值为假 173 | 174 | ``` 175 | ternary "foo" "bar" false 176 | ``` 177 | 178 | 或 179 | 180 | ``` 181 | false | ternary "foo" "bar" 182 | ``` 183 | 184 | 上述示例返回 `"bar"`。 185 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/dicts.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 字典与字典函数 6 | 7 | Sprig 提供了一个称为 `dict`(dictionary 的缩写,类比 Python 中的字典)的键/值存储类型。`dict` 是一个*无序*类型。 8 | 9 | 字典的键**必须是一个字符串**。然而,值可以是任何类型,甚至是另一个 `dict` 或 `list`。 10 | 11 | 与 `list` 不同,`dict` 是可变的。`set` 和 `unset` 函数将修改字典的内容。 12 | 13 | ## `dict` 14 | 15 | 通过调用 `dict` 函数并传递一个键值对的列表来创建字典。 16 | 17 | 以下代码创建了一个包含三个项的字典: 18 | 19 | ``` 20 | $myDict := dict "key1" "value1" "key2" "value2" "key3" "value 3" 21 | ``` 22 | 23 | ## `get` 24 | 25 | 给定一个字典和一个键,从该字典中获取对应的值。 26 | 27 | ``` 28 | get $myDict "key1" 29 | ``` 30 | 31 | 上述代码返回 `"value1"`。 32 | 33 | 请注意,如果未找到键,则此操作将简单地返回 `""`。不会生成错误。 34 | 35 | ## `set` 36 | 37 | 使用 `set` 向字典中添加一个新的键值对。 38 | 39 | ``` 40 | $_ := set $myDict "key4" "value4" 41 | ``` 42 | 43 | 请注意,`set` 返回字典*(这是 Go 模板函数的要求),因此您可能需要像上面的 `$*` 赋值一样捕获该值。 44 | 45 | ## `unset` 46 | 47 | 给定一个字典和一个键,将该键及其对应的值从字典中删除。 48 | 49 | ``` 50 | $_ := unset $myDict "key4" 51 | ``` 52 | 53 | 与 `set` 类似,这会返回字典。 54 | 55 | 请注意,如果未找到键,则此操作将简单地返回。不会生成错误。 56 | 57 | ## `hasKey` 58 | 59 | 如果给定的字典包含给定的键,`hasKey` 函数将返回 `true`。 60 | 61 | ``` 62 | hasKey $myDict "key1" 63 | ``` 64 | 65 | 如果未找到给定的键,则返回 `false`。 66 | 67 | ## `pluck` 68 | 69 | 给定一个键和多个字典,`pluck` 函数可以获取所有匹配项的列表: 70 | 71 | ``` 72 | pluck "name1" $myDict $myOtherDict 73 | ``` 74 | 75 | 上述代码将返回一个包含每个找到的值的 `list`(`[value1 otherValue1]`)。 76 | 77 | 如果给定的键在字典中**未找到**,那么该字典在列表中将没有对应的项(即返回的列表的长度将小于调用 `pluck` 时传入的字典数量)。 78 | 79 | 如果找到了键,但值是一个空值,该值将被插入。 80 | 81 | 在模板中,使用 `pluck ... | first` 的常见用法是从一组字典中获取第一个匹配的键。 82 | 83 | ## `dig` 84 | 85 | `dig` 函数使用一个键名列表访问嵌套的字典集。 86 | 87 | 如果其中某个键在对应的字典中找不到,则返回默认值。 88 | 89 | ``` 90 | dig "user" "role" "humanName" "guest" $dict 91 | ``` 92 | 93 | 给定一个结构化如下的字典: 94 | 95 | ``` 96 | { 97 | user: { 98 | role: { 99 | humanName: "curator" 100 | } 101 | } 102 | } 103 | ``` 104 | 105 | 上面的代码将返回 `"curator"`。如果字典甚至缺少 `user` 字段,则结果将是给定的默认值 `"guest"`。 106 | 107 | `dig` 在你想避免守卫语句的情况下非常有用,特别是因为 Go 的模板包的 `and` 不会进行快速路由。例如,`and a.maybeNil a.maybeNil.iNeedThis` 将始终评估 `a.maybeNil.iNeedThis`,如果 `a` 缺少 `maybeNil` 字段则会引发错误。 108 | 109 | `dig` 函数在最后接受字典参数以支持管道操作。例如: 110 | 111 | ``` 112 | merge a b c | dig "one" "two" "three" "" 113 | ``` 114 | 115 | ## `merge`, `mustMerge` 116 | 117 | 将两个或多个字典合并为一个,以目标字典为准: 118 | 119 | ``` 120 | $newdict := merge $dest $source1 $source2 121 | ``` 122 | 123 | 这是一个深度合并操作,但不是深度复制操作。合并的嵌套对象在两个字典上是同一个实例。 124 | 125 | 如果您想对合并进行深度复制,则需要将 `deepCopy` 函数与合并一起使用。例如: 126 | 127 | ``` 128 | deepCopy $source | merge $dest 129 | ``` 130 | 131 | `mustMerge` 在合并失败时会返回错误。 132 | 133 | ## `mergeOverwrite`, `mustMergeOverwrite` 134 | 135 | 将两个或多个字典合并为一个,从**右到左**给予目标字典优先权,从而覆盖目标字典中的值: 136 | 137 | 假设: 138 | 139 | ``` 140 | dst: 141 | default: default 142 | overwrite: me 143 | key: true 144 | 145 | src: 146 | overwrite: overwritten 147 | key: false 148 | ``` 149 | 150 | 将得到: 151 | 152 | ``` 153 | newdict: 154 | default: default 155 | overwrite: overwritten 156 | key: false 157 | ``` 158 | 159 | ``` 160 | $newdict := mergeOverwrite $dest $source1 $source2 161 | ``` 162 | 163 | 这是一个深度合并操作,但不是深度复制操作。合并的嵌套对象在两个字典上是同一个实例。 164 | 165 | 如果您想对合并进行深度复制,则需要将 `deepCopy` 函数与合并一起使用。例如: 166 | 167 | ``` 168 | deepCopy $source | mergeOverwrite $dest 169 | ``` 170 | 171 | `mustMergeOverwrite` 在合并失败时会返回错误。 172 | 173 | ## `keys` 174 | 175 | `keys` 函数将返回一个包含一个或多个 `dict` 中所有键名组成的 `list`。 176 | 177 | 由于字典是*无序*的,键的顺序不可预测。可以使用 `sortAlpha` 对键进行排序。 178 | 179 | ``` 180 | keys $myDict | sortAlpha 181 | ``` 182 | 183 | 当提供多个字典时,将对键进行连接。使用 `uniq` 函数和 `sortAlpha` 来获得一个唯一的、排序的键列表。 184 | 185 | ``` 186 | keys $myDict $myOtherDict | uniq | sortAlpha 187 | ``` 188 | 189 | ## `pick` 190 | 191 | `pick` 函数从一个字典中仅选择给定的键,创建一个新的 `dict`。 192 | 193 | ``` 194 | $new := pick $myDict "key1" "key2" 195 | ``` 196 | 197 | 上述代码返回 `{key1: value1, key2: value2}` 198 | 199 | ## `omit` 200 | 201 | `omit` 函数类似于 `pick`,但它返回一个新的 `dict`,其中包含所有与给定键**不匹配**的键。 202 | 203 | ``` 204 | $new := omit $myDict "key1" "key3" 205 | ``` 206 | 207 | 上述代码返回 `{key2: value2}` 208 | 209 | ## `values` 210 | 211 | `values` 函数类似于 `keys`,但它返回一个新的 `list`,其中包含源 `dict` 的所有值(仅支持一个字典)。 212 | 213 | ``` 214 | $vals := values $myDict 215 | ``` 216 | 217 | 上述代码返回 `list["value1", "value2", "value 3"]`。请注意,`values` 函数对结果排序不作任何保证,如果您关心这一点,请使用 `sortAlpha`。 218 | 219 | ## `deepCopy`, `mustDeepCopy` 220 | 221 | `deepCopy` 和 `mustDeepCopy` 函数接受一个值并对该值进行深拷贝。这包括字典和其他结构。 222 | 223 | 当有问题时,`deepCopy` 会抛出一个 panics,而 `mustDeepCopy` 会将错误返回给模板系统。 224 | 225 | ``` 226 | dict "a" 1 "b" 2 | deepCopy 227 | ``` 228 | 229 | ## 关于字典内部的注释 230 | 231 | 在 Go 中,`dict` 以 `map[string]interface{}` 的形式实现。Go 开发人员可以将 `map[string]interface{}` 值传递到上下文中,以使它们在模板中作为 `dict` 使用。 232 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/encoding.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 编码函数 6 | 7 | Sprig 拥有以下编码和解码函数: 8 | 9 | - `b64enc`/`b64dec`:使用 `Base64` 进行编码或解码 10 | - `b32enc`/`b32dec`:使用 `Base32` 进行编码或解码 11 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/flow-control.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 流程控制函数 6 | 7 | ## `fail` 8 | 9 | 无条件地返回一个空的`string`和一个带有指定文本的`error`。 10 | 11 | 在其他条件判断模板渲染失败的情况下,这将很有用。 12 | 13 | ``` 14 | fail "请接受最终用户许可协议" 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # `Sprig` 模板函数 6 | 7 | - 主页: [Sprig Function Documentation | sprig](http://masterminds.github.io/sprig/) 8 | - 仓库: [Masterminds/sprig: Useful template functions for Go templates.](https://github.com/Masterminds/sprig) 9 | 10 | ## `Sprig` 函数文档 11 | 12 | - 字符串 13 | - [字符串函数](./strings.md) 14 | - [字符串切片函数](./string-slice.md) 15 | - 整数 16 | - [整数数学函数](./math.md) 17 | - [整数切片函数](./integer-slice.md) 18 | - 浮点数 19 | - [浮点数数学函数](./mathf.md) 20 | - 时间与日期 21 | - [日期函数](./date.md) 22 | - [默认值函数](./defaults.md) 23 | - [编码函数](./encoding.md) 24 | - [列表与列表函数](./lists.md) 25 | - [字典与字典函数](./dicts.md) 26 | - [类型转换函数](./conversion.md) 27 | - [路径与文件路径函数](./paths.md) 28 | - [流控制函数](./flow-control.md) 29 | - 高级函数 30 | - [UUID 函数](./uuid.md) 31 | - [操作系统函数](./os.md) 32 | - [语义化版本号函数](./semver.md) 33 | - [反射函数](./reflection.md) 34 | - [密码学与安全函数](./crypto.md) 35 | - [网络函数](./network.md) 36 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/integer-slice.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 整数切片函数 6 | 7 | ## `until` 8 | 9 | `until` 函数生成一个整数列表 10 | 11 | ``` 12 | until 5 13 | ``` 14 | 15 | 上述语句生成的列表为 `[0, 1, 2, 3, 4]`。 16 | 17 | 这在使用 `range e := until 5` 进行循环时非常有用。 18 | 19 | ## `untilStep` 20 | 21 | 与 `until` 类似,`untilStep` 生成一个计数整数列表。但它允许您定义一个起点、终点和步长: 22 | 23 | ``` 24 | untilStep 3 6 2 25 | ``` 26 | 27 | 上述语句生成一个从 `3` 开始,每次增加 `2` 直到等于或大于 `6` 的整数列表 `[3 5]`。这类似于Python的 `range` 函数。 28 | 29 | ## `seq` 30 | 31 | 作用类似于 bash 的 `seq` 命令。 32 | 33 | - 1个参数 `(end)` 34 | 35 | - 生成从 1 到 `end`(包括 `end`)的所有整数组成的列表 36 | 37 | - 2个参数 `(start, end)` 38 | 39 | - 生成从 `start` 到 `end`(包括 `start` 和 `end`)以 `1` 为步长递增或递减的所有整数组成的列表 40 | 41 | - 3个参数 `(start, step, end)` 42 | 43 | - 生成从 `start` 到 `end`(包括 `start` 和 `end`)以 `step` 为步长递增或递减的所有整数组成的列表 44 | 45 | ``` 46 | seq 5 => 1 2 3 4 5 47 | seq -3 => 1 0 -1 -2 -3 48 | seq 0 2 => 0 1 2 49 | seq 2 -2 => 2 1 0 -1 -2 50 | seq 0 2 10 => 0 2 4 6 8 10 51 | seq 0 -2 -5 => 0 -2 -4 52 | ``` 53 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/lists.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 列表与列表函数 6 | 7 | Sprig 提供了一个简单的 “list” 类型,可以包含任意顺序的数据列表。这类似于数组或切片,但列表被设计用作不可变的数据类型。 8 | 9 | 创建一个整数列表: 10 | 11 | ``` 12 | $myList := list 1 2 3 4 5 13 | ``` 14 | 15 | 上面创建了一个列表 `[1 2 3 4 5]`。 16 | 17 | ## `first`,`mustFirst` 18 | 19 | 要获取列表的第一项,请使用 `first`。 20 | 21 | `first $myList` 返回 `1` 22 | 23 | 如果有问题,则 `first` 会产生 panic,而 `mustFirst` 会返回错误到模板引擎。 24 | 25 | ## `rest`,`mustRest` 26 | 27 | 要获取列表的尾部(除第一项外的所有项),请使用 `rest`。 28 | 29 | `rest $myList` 返回 `[2 3 4 5]` 30 | 31 | 如果有问题,则 `rest` 会产生 panic,而 `mustRest` 会返回错误到模板引擎。 32 | 33 | ## `last`,`mustLast` 34 | 35 | 要获取列表的最后一项,请使用 `last`: 36 | 37 | `last $myList` 返回 `5`。这基本上相当于反转列表然后调用 `first`。 38 | 39 | ## `initial`,`mustInitial` 40 | 41 | 要获取列表除最后一个元素外的所有元素,请使用 `initial`。 42 | `initial $myList` 返回 `[1 2 3 4]`。 43 | 44 | 如果有问题,则 `initial` 会产生 panic,而 `mustInitial` 会返回错误到模板引擎。 45 | 46 | ## `append`,`mustAppend` 47 | 48 | 将新元素附加到现有列表的尾部,创建一个新列表。 49 | 50 | ``` 51 | $new = append $myList 6 52 | ``` 53 | 54 | 上面将 `$new` 设置为 `[1 2 3 4 5 6]`。`$myList` 将保持不变。 55 | 56 | 如果有问题,则 `append` 会产生 panic,而 `mustAppend` 会返回错误到模板引擎。 57 | 58 | ## `prepend`,`mustPrepend` 59 | 60 | 将元素推入现有列表的首部,创建一个新列表。 61 | 62 | ``` 63 | prepend $myList 0 64 | ``` 65 | 66 | 上面会产生 `[0 1 2 3 4 5]`。`$myList` 将保持不变。 67 | 68 | 如果有问题,则 `prepend` 会产生 panic,而 `mustPrepend` 会返回错误到模板引擎。 69 | 70 | ## `concat` 71 | 72 | 将任意数量的列表连接成一个列表。 73 | 74 | ``` 75 | concat $myList ( list 6 7 ) ( list 8 ) 76 | ``` 77 | 78 | 上面会产生 `[1 2 3 4 5 6 7 8]`。`$myList` 将保持不变。 79 | 80 | ## `reverse`,`mustReverse` 81 | 82 | 生成一个具有给定列表的元素顺序翻转的新列表。 83 | 84 | ``` 85 | reverse $myList 86 | ``` 87 | 88 | 上面将生成列表 `[5 4 3 2 1]`。 89 | 90 | 如果有问题,则 `reverse` 会产生 panic,而 `mustReverse` 会返回错误到模板引擎。 91 | 92 | ## `uniq`,`mustUniq` 93 | 94 | 生成一个删除所有重复项的新列表。 95 | 96 | ``` 97 | list 1 1 1 2 | uniq 98 | ``` 99 | 100 | 上面将生成 `[1 2]` 101 | 102 | 如果有问题,则 `uniq` 会产生 panic,而 `mustUniq` 会返回错误到模板引擎。 103 | 104 | ## `without`,`mustWithout` 105 | 106 | `without` 函数从列表中过滤掉项目。 107 | 108 | ``` 109 | without $myList 3 110 | ``` 111 | 112 | 上面将生成 `[1 2 4 5]` 113 | 114 | `without` 可以使用多个过滤器: 115 | 116 | ``` 117 | without $myList 1 3 5 118 | ``` 119 | 120 | 这将生成 `[2 4]` 121 | 122 | 如果有问题,则 `without` 会产生 panic,而 `mustWithout` 会返回错误到模板引擎。 123 | 124 | ## `has`,`mustHas` 125 | 126 | 测试列表是否具有特定元素。 127 | 128 | ``` 129 | has 4 $myList 130 | ``` 131 | 132 | 上述代码将返回 `true`,而 `has "hello" $myList` 将返回 `false`。 133 | 134 | 如果有问题,则 `has` 会产生 panic,而 `mustHas` 会返回错误到模板引擎。 135 | 136 | ## `compact`,`mustCompact` 137 | 138 | 接受一个列表并删除其中的空值条目。 139 | 140 | ``` 141 | $list := list 1 "a" "foo" "" 142 | $copy := compact $list 143 | ``` 144 | 145 | `compact` 将返回一个新列表,其中删除了空项(即`“”`)。 146 | 147 | 如果有问题,则 `compact` 会产生 panic,而 `mustCompact` 会返回错误到模板引擎。 148 | 149 | ## `slice`,`mustSlice` 150 | 151 | 要获取列表的部分元素,请使用 `slice list [n] [m]`。它相当于 `list[n:m]`。 152 | 153 | - `slice $myList` 返回 `[1 2 3 4 5]`。它与 `myList[:]` 相同。 154 | - `slice $myList 3` 返回 `[4 5]`。它与 `myList[3:]` 相同。 155 | - `slice $myList 1 3` 返回 `[2 3]`。它与 `myList[1:3]` 相同。 156 | - `slice $myList 0 3` 返回 `[1 2 3]`。它与 `myList[:3]` 相同。 157 | 158 | 如果有问题,则 `slice` 会产生 panic,而 `mustSlice` 会返回错误到模板引擎。 159 | 160 | ## `chunk` 161 | 162 | 将列表分成给定大小的块,使用 `chunk size list`。这对于分页很有用。 163 | 164 | ``` 165 | chunk 3 (list 1 2 3 4 5 6 7 8) 166 | ``` 167 | 168 | 这将产生列表的列表 `[ [ 1 2 3 ] [ 4 5 6 ] [ 7 8 ] ]`。 169 | 170 | ## 列表内部的注意事项 171 | 172 | 在 Go 中,列表是作为 `[]interface{}` 实现的。对于嵌入 Sprig 的 Go 开发人员,您可以将 `[]interface{}` 项传递到模板上下文中,并能够在这些项上使用所有 `list` 函数。 173 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/math.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 整数数学函数 6 | 7 | 以下数学函数适用于`int64`值。 8 | 9 | ## `add` 10 | 11 | 使用`add`对数字求和。接受两个或更多输入。 12 | 13 | ``` 14 | add 1 2 3 15 | ``` 16 | 17 | ## `add1` 18 | 19 | 使用`add1`来增加 1 20 | 21 | ## `sub` 22 | 23 | 使用`sub`进行减法 24 | 25 | ## `div` 26 | 27 | 使用`div`进行整数除法 28 | 29 | ## `mod` 30 | 31 | 使用`mod`进行取模运算 32 | 33 | ## `mul` 34 | 35 | 使用`mul`进行乘法运算。接受两个或更多输入。 36 | 37 | ``` 38 | mul 1 2 3 39 | ``` 40 | 41 | ## `max` 42 | 43 | 返回一系列整数中的最大值 44 | 45 | ``` 46 | max 1 2 3 47 | ``` 48 | 49 | 上述语句返回`3` 50 | 51 | ## `min` 52 | 53 | 返回一系列整数中的最小值 54 | 55 | ``` 56 | min 1 2 3 57 | ``` 58 | 59 | 上述语句返回`1` 60 | 61 | ## `floor` 62 | 63 | 返回小于等于输入值的最大浮点数值 64 | 65 | ``` 66 | floor 123.9999 67 | ``` 68 | 69 | 上述语句返回`123.0` 70 | 71 | ## `ceil` 72 | 73 | 返回大于等于输入值的最大浮点数值 74 | 75 | ``` 76 | ceil 123.001 77 | ``` 78 | 79 | 上述语句返回`124.0` 80 | 81 | ## `round` 82 | 83 | 返回四舍五入到小数点后给定位数的浮点数值 84 | 85 | ``` 86 | round 123.555555 3 87 | ``` 88 | 89 | 上述语句返回`123.556` 90 | 91 | ## `randInt` 92 | 93 | 从最小值(包含)到最大值(不包含)返回一个随机整数值 94 | 95 | ``` 96 | randInt 12 30 97 | ``` 98 | 99 | 上述语句将返回在区间 `[12,30]` 内的一个随机数 100 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/mathf.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 浮点数数学函数 6 | 7 | 所有的数学函数都作用在 `float64` 类型的值上。 8 | 9 | ## `addf` 10 | 11 | 使用 `addf` 求和 12 | 13 | ``` 14 | addf 1.5 2 2 15 | ``` 16 | 17 | 上述语句返回 `5.5` 18 | 19 | ## `add1f` 20 | 21 | 使用 `add1f` +1 22 | 23 | ``` 24 | add1f 1.5 25 | ``` 26 | 27 | 上述语句返回 `2.5` 28 | 29 | ## `subf` 30 | 31 | 使用 `subf` 进行减法 32 | 33 | ``` 34 | subf 7.5 2 3 35 | ``` 36 | 37 | 上述语句相当于 `7.5 - 2 - 3`,将返回 `2.5` 38 | 39 | ## `divf` 40 | 41 | 使用 `divf` 进行除法。 42 | 43 | ``` 44 | divf 10 2 4 45 | ``` 46 | 47 | 上述语句相当于 `10 / 2 / 4`,将返回 `1.25` 48 | 49 | ## `mulf` 50 | 51 | 使用 `mulf` 进行乘法 52 | 53 | ``` 54 | mulf 1.5 2 2 55 | ``` 56 | 57 | 上述语句将返回 `6` 58 | 59 | ## `maxf` 60 | 61 | 返回一系列浮点数中的最大值 62 | 63 | ``` 64 | maxf 1 2.5 3 65 | ``` 66 | 67 | 上述语句将返回 `3` 68 | 69 | ## `minf` 70 | 71 | 返回一系列浮点数中的最小值 72 | 73 | ``` 74 | minf 1.5 2 3 75 | ``` 76 | 77 | 上述语句将返回 `1.5` 78 | 79 | ## `floor` 80 | 81 | 返回小于或等于输入值的最大浮点数类型的整数值 (向下取整) 82 | 83 | ``` 84 | floor 123.9999 85 | ``` 86 | 87 | 上述语句将返回 `123.0` 88 | 89 | ## `ceil` 90 | 91 | 返回大于或等于输入值的最小浮点数类型的整数值 (向上取整) 92 | 93 | ``` 94 | ceil 123.001 95 | ``` 96 | 97 | 上述语句将返回 `124.0` 98 | 99 | ## `round` 100 | 101 | 返回一个浮点数值,其余数根据给定的小数点后位数四舍五入 102 | 103 | ``` 104 | round 1234.555555555 6 105 | ``` 106 | 107 | 上述语句将返回 `1234.555556` 108 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/network.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 网络函数 6 | 7 | Sprig 的网络操作函数 8 | 9 | ## `getHostByName` 10 | 11 | `getHostByName` 函数接收一个域名并返回对应的 IP 地址 12 | 13 | ``` 14 | getHostByName "www.google.com" 15 | ``` 16 | 17 | 上述语句返回域名 `www.google.com` 对应的 IP 地址 18 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/os.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 操作系统函数 6 | 7 | ::: warning 8 | 如果不适当使用,这些函数可能会导致信息泄露。 9 | 10 | 一些著名的 Sprig 实现(例如 [Kubernetes Helm](http://helm.sh))会因为安全原因而不提供这些函数。 11 | ::: 12 | 13 | ## `env` 14 | 15 | `env` 函数用于读取环境变量 16 | 17 | ``` 18 | env "HOME" 19 | ``` 20 | 21 | ## `expandenv` 22 | 23 | 使用 `expandenv` 函数将字符串环境变量名替换为对应的环境变量值 24 | 25 | ``` 26 | expandenv "Your path is set to $PATH" 27 | ``` 28 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/paths.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 路径与文件路径函数 6 | 7 | 尽管 Sprig 不允许访问文件系统,但它提供了一些函数用于处理遵循文件路径约定的字符串。 8 | 9 | ## 路径 10 | 11 | 路径由斜杠字符(`/`)分隔,由`path`包处理。 12 | 13 | 示例: 14 | 15 | - [Linux](https://en.wikipedia.org/wiki/Linux) 和 [MacOS](https://en.wikipedia.org/wiki/MacOS) 文件系统:`/home/user/file`,`/etc/config`; 16 | - [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier) 的路径部分:`https://example.com/some/content/`,`ftp://example.com/file/`。 17 | 18 | ### `base` 19 | 20 | 返回路径的最后一个元素。 21 | 22 | ``` 23 | base "foo/bar/baz" 24 | ``` 25 | 26 | 上述语句将返回 `"baz"`。 27 | 28 | ### `dir` 29 | 30 | 返回目录,删除路径的最后一部分。因此,`dir "foo/bar/baz"` 返回 `"foo/bar"`。 31 | 32 | ### `clean` 33 | 34 | 清理路径。 35 | 36 | ``` 37 | clean "foo/bar/../baz" 38 | ``` 39 | 40 | 以上将解析 `..` 并返回 `"foo/baz"`。 41 | 42 | ### `ext` 43 | 44 | 返回文件扩展名。 45 | 46 | ``` 47 | ext "foo.bar" 48 | ``` 49 | 50 | 以上将返回 `".bar"`。 51 | 52 | ### `isAbs` 53 | 54 | 要检查路径是否为绝对路径,请使用 `isAbs`。 55 | 56 | ## 文件路径 57 | 58 | 路径由`os.PathSeparator`变量分隔,由`path/filepath`包处理。 59 | 60 | 这些是在解析本地文件系统路径时推荐使用的函数,通常用于处理本地文件、目录等。 61 | 62 | 示例: 63 | 64 | - 在 Linux 或 MacOS 上运行时,文件系统路径由斜杠字符(`/`)分隔: 65 | `/home/user/file`,`/etc/config`; 66 | - 在 [Windows](https://en.wikipedia.org/wiki/Microsoft_Windows) 上运行时,文件系统路径由反斜杠字符(`\`)分隔: 67 | `C:\Users\Username\`,`C:\Program Files\Application\`。 68 | 69 | ### `osBase` 70 | 71 | 返回文件路径的最后一个元素。 72 | 73 | ``` 74 | osBase "/foo/bar/baz" 75 | osBase "C:\\foo\\bar\\baz" 76 | ``` 77 | 78 | 以上在 Linux 和 Windows 上均返回 `"baz"`。 79 | 80 | ### `osDir` 81 | 82 | 返回目录,删除路径的最后一部分。 83 | 84 | `osDir "/foo/bar/baz"` 在 Linux 上返回`"/foo/bar"` 85 | 86 | `osDir "C:\\foo\\bar\\baz"`在 Windows 上返回`"C:\\foo\\bar"` 87 | 88 | ### `osClean` 89 | 90 | 清理路径。 91 | 92 | ``` 93 | osClean "/foo/bar/../baz" 94 | osClean "C:\\foo\\bar\\..\\baz" 95 | ``` 96 | 97 | 上述语句在 Linux 上解析 `..` 并返回 `"foo/baz"`,在 Windows 上返回 `"C:\\foo\\baz"`。 98 | 99 | ### `osExt` 100 | 101 | 返回文件扩展名。 102 | 103 | ``` 104 | osExt "/foo.bar" 105 | osExt "C:\\foo.bar" 106 | ``` 107 | 108 | 上述语句在 Linux 和 Windows 上均返回 `".bar"`。 109 | 110 | ### `osIsAbs` 111 | 112 | 要检查文件路径是否为绝对路径,请使用 `osIsAbs`。 113 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/reflection.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 反射函数 6 | 7 | Sprig 提供了一些基本的反射工具,这些工具帮助高级模板开发者了解特定值的底层 Go 类型信息。 8 | 9 | Go 有几种基本的“种类”,比如 `string`、`slice`、`int64` 和 `bool`。 10 | 11 | Go 有一个开放的类型系统,允许开发者创建自己的类型。 12 | 13 | Sprig 为每个种类提供了一组函数。 14 | 15 | ## 种类函数 16 | 17 | 有两个种类函数: 18 | 19 | `kindOf` 返回一个对象的种类。 20 | 21 | ``` 22 | kindOf "hello" 23 | ``` 24 | 25 | 上面的例子将返回 `"string"`。 26 | 27 | 对于简单的测试(比如在 `if` 语句块中),`kindIs` 函数可以让您验证一个值是否是特定的种类: 28 | 29 | ``` 30 | kindIs "int" 123 31 | ``` 32 | 33 | 上面的例子将返回 `true`。 34 | 35 | ## 类型函数 36 | 37 | 类型稍微复杂些,因此有三个不同的函数: 38 | 39 | - `typeOf`: 返回一个值的底层类型:`typeOf $foo` 40 | - `typeIs`: 类似于 `kindIs`,但用于类型:`typeIs "*io.Buffer" $myVal` 41 | - `typeIsLike`: 与 `typeIs` 相似,但也会解引用指针。 42 | 43 | **注意:** 这些函数都不能测试某个对象是否实现了给定的接口,因为这将需要提前编译接口。 44 | 45 | ## `deepEqual` 46 | 47 | 如果两个值是 [“深度相等”](https://golang.org/pkg/reflect/#DeepEqual) 的则返回 `true` 48 | 49 | 与内置的 `eq` 函数相比,它也适用于非基本类型。 50 | 51 | ``` 52 | deepEqual (list 1 2 3) (list 1 2 3) 53 | ``` 54 | 55 | 上面的例子将返回 `true`。 56 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/semver.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 语义化版本号函数 6 | 7 | 某些版本方案易于解析和比较。Sprig 提供了用于处理[语义化版本2](http://semver.org)的函数。 8 | 9 | ## `semver` 10 | 11 | `semver`函数将字符串解析为语义化版本: 12 | 13 | ``` 14 | $version := semver "1.2.3-alpha.1+123" 15 | ``` 16 | 17 | _如果解析器失败,将导致模板执行停止并显示错误信息。_ 18 | 19 | 此时,`$version`是指向一个带有以下属性的`Version`对象的指针: 20 | 21 | - `$version.Major`:主要编号(上述为`1`) 22 | - `$version.Minor`:次要编号(上述为`2`) 23 | - `$version.Patch`:修订编号(上述为`3`) 24 | - `$version.Prerelease`:预发布版本(上述为`alpha.1`) 25 | - `$version.Metadata`:构建元数据(上述为`123`) 26 | - `$version.Original`:原始版本,以字符串形式 27 | 28 | 此外,您可以使用`Compare`方法将`Version`与另一个`version`进行比较: 29 | 30 | ``` 31 | semver "1.4.3" | (semver "1.2.3").Compare 32 | ``` 33 | 34 | 上述语句将返回`-1`。 35 | 36 | 返回值如下: 37 | 38 | - `-1`:如果给定的语义化版本大于调用了`Compare`方法的语义化版本 39 | - `1`:如果调用了`Compare`函数的版本更大 40 | - `0`:如果它们是相同的版本 41 | 42 | (注意,在语义化版本中,版本比较操作不会考虑`Metadata`字段。) 43 | 44 | ## `semverCompare` 45 | 46 | 提供了一个更强大的比较函数`semverCompare`。该函数支持版本范围: 47 | 48 | - `semverCompare "1.2.3" "1.2.3"`:检查是否完全匹配 49 | - `semverCompare "^1.2.0" "1.2.3"`:检查主要和次要版本是否匹配,并且第二个版本的修订编号大于或等于第一个参数。 50 | 51 | 语义化版本函数使用[Masterminds semver库](https://github.com/Masterminds/semver),由Sprig的开发者创建。 52 | 53 | ## 基本比较 54 | 55 | 比较有两个要素。首先,比较字符串是以空格或逗号分隔的 AND 比较的列表。然后,这些列表使用 ||(OR)比较分隔。例如,`">= 1.2 < 3.0.0 || >= 4.2.3"`表示寻找大于或等于1.2且小于3.0.0,或大于或等于4.2.3的比较。 56 | 57 | 基本比较包括: 58 | 59 | - `=`:等于(别名无运算符) 60 | - `!=`:不等于 61 | - `>`:大于 62 | - `<`:小于 63 | - `>=`:大于或等于 64 | - `<=`:小于或等于 65 | 66 | _注意,根据语义化版本规范,预发布版本可能与其发布版本不符合API兼容性。规范说,_ 67 | 68 | ## 处理预发布版本 69 | 70 | 对于那些不熟悉预发布版本的人来说,预发布版本用于稳定或普通可用版本之前的软件发布。预发布的示例包括开发版、alpha版、beta版和候选发布版。预发布可能是类似`1.2.3-beta.1`的版本,而稳定版本则是`1.2.3`。在顺序上,预发布版本位于其关联发布版本之前。例如,`1.2.3-beta.1 < 1.2.3`。 71 | 72 | 根据语义化版本规范,预发布版本可能与其发布版本不符合 API 兼容性。规范说, 73 | 74 | > 预发布版本表示该版本不稳定,可能无法满足其关联正常版本规定的兼容性要求。 75 | 76 | 使用约束条件进行 SemVer 比较时,如果没有预发布比较器,将跳过预发布版本。例如,当查看一系列发布版本时,`>=1.2.3`将跳过预发布版本,而`>=1.2.3-0`将计算并找到预发布版本。 77 | 78 | 在示例比较中,将`0`作为预发布版本的原因是,根据规范,预发布版本只能包含ASCII字母数字字符和连字符(以及`.`作为分隔符)。排序按照ASCII排序顺序进行,再次根据规范。ASCII 排序顺序中最小的字符是`0`(请参阅[ASCII表](http://www.asciitable.com/))。 79 | 80 | 了解 ASCII 排序顺序很重要,因为 A-Z 在 a-z 之前。这意味着`>=1.2.3-BETA`将返回`1.2.3-alpha`。您可能对大小写敏感性的期望在这里不适用。这是由于 ASCII 排序顺序规范指定的。 81 | 82 | ## 比较**中使用**连字符 `-` 83 | 84 | 有多种方法可以处理范围,其中一种是连字符范围。它们的格式如下: 85 | 86 | - `1.2 - 1.4.5`:等同于`>= 1.2 <= 1.4.5` 87 | - `2.3.4 - 4.5`:等同于`>= 2.3.4 <= 4.5` 88 | 89 | ## 比较中使用通配符 `*` 90 | 91 | `x`、`X`和`*`字符可以用作通配符。这适用于所有比较运算符。当在`=`运算符上使用时,它会回退到修订级别的比较(参见下面的波浪线)。例如, 92 | 93 | - `1.2.x`等同于`>= 1.2.0, < 1.3.0` 94 | - `>= 1.2.x`等同于`>= 1.2.0` 95 | - `<= 2.x`等同于`< 3` 96 | - `*`等同于`>= 0.0.0` 97 | 98 | ## 比较中使用波浪线 `~`(修订版本号) 99 | 100 | 波浪线`~`比较运算符用于修订级别范围,如果指定了次要版本,则用于主要级别更改。例如, 101 | 102 | - `~1.2.3`等同于`>= 1.2.3, < 1.3.0` 103 | - `~1`等同于`>= 1, < 2` 104 | - `~2.3`等同于`>= 2.3, < 2.4` 105 | - `~1.2.x`等同于`>= 1.2.0, < 1.3.0` 106 | - `~1.x`等同于`>= 1, < 2` 107 | 108 | ## 比较中使用抑扬符 `^`(主版本号) 109 | 110 | 抑扬符`^`比较运算符用于主要级别更改,一旦发生稳定(1.0.0)版本的发布。在1.0.0版本发布之前,次要版本充当API稳定级别。在比较 API 版本时,这非常有用,因为主版本号更改会破坏 API。例如, 111 | 112 | - `^1.2.3`等同于`>= 1.2.3, < 2.0.0` 113 | - `^1.2.x`等同于`>= 1.2.0, < 2.0.0` 114 | - `^2.3`等同于`>= 2.3, < 3` 115 | - `^2.x`等同于`>= 2.0.0, < 3` 116 | - `^0.2.3`等同于`>=0.2.3 <0.3.0` 117 | - `^0.2`等同于`>=0.2.0 <0.3.0` 118 | - `^0.0.3`等同于`>=0.0.3 <0.0.4` 119 | - `^0.0`等同于`>=0.0.0 <0.1.0` 120 | - `^0`等同于`>=0.0.0 <1.0.0` 121 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/string-slice.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # 字符串切片函数 6 | 7 | 这些函数用于操作或生成字符串切片。在 Go 中,切片是一个可扩展的数组。在 Sprig 中,它是 `list` 的一个特例。 8 | 9 | ## `join` 10 | 11 | 使用指定的分隔符将字符串列表拼接成一个字符串。 12 | 13 | ``` 14 | list "hello" "world" | join "_" 15 | ``` 16 | 17 | 上述语句将会产生 `hello_world` 18 | 19 | `join` 函数会尝试将非字符串的值转换为字符串: 20 | 21 | ``` 22 | list 1 2 3 | join "+" 23 | ``` 24 | 25 | 上述示例将会产生 `1+2+3` 26 | 27 | ## `splitList`, `split` 28 | 29 | `splitList` 将字符串分割成一个字符串列表: 30 | 31 | ``` 32 | splitList "$" "foo$bar$baz" 33 | ``` 34 | 35 | 上述语句将会返回 `[foo bar baz]` 36 | 37 | `split` 函数将字符串分割成一个 `dict`。它的设计是为了方便使用点表示法访问成员: 38 | 39 | ``` 40 | $a := split "$" "foo$bar$baz" 41 | ``` 42 | 43 | 上述语句将会生成一个具有索引键的映射。`{_0: foo, _1: bar, _2: baz}` 44 | 45 | ``` 46 | $a._0 47 | ``` 48 | 49 | 上述示例将会返回 `foo` 50 | 51 | ## `splitn` 52 | 53 | `splitn` 函数将字符串分割成一个 `dict`。它的设计是为了方便使用模板点表示法访问成员: 54 | 55 | ``` 56 | $a := splitn "$" 2 "foo$bar$baz" 57 | ``` 58 | 59 | 上述语句将会生成一个具有索引键的映射。`{_0: foo, _1: bar$baz}` 60 | 61 | ``` 62 | $a._0 63 | ``` 64 | 65 | 上述语句将会产生 `foo` 66 | 67 | ## sortAlpha 68 | 69 | `sortAlpha` 函数将字符串列表按字母顺序(字典序)进行排序。 70 | 71 | 它不会原地排序,而是返回已排序的列表的副本,与列表的不可变性保持一致。 72 | -------------------------------------------------------------------------------- /docs/zh-Hans/reference/template/sprig/uuid.md: -------------------------------------------------------------------------------- 1 | --- 2 | outline: deep 3 | --- 4 | 5 | # UUID 函数 6 | 7 | Sprig 可以生成 v4 类型的 UUID (通用唯一标识符, Universally Unique Identifier)。 8 | 9 | ``` 10 | uuidv4 11 | ``` 12 | 13 | 以上代码返回一个新的 v4 类型的 UUID 字符串,例如 `a2e5e821-dbe5-4b23-85b7-e95761b4950e`。 14 | -------------------------------------------------------------------------------- /lint-staged.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {import("lint-staged").Config} 3 | * @see {@link https://www.npmjs.com/package/lint-staged | lint-staged} 4 | */ 5 | const config = { 6 | "*": "cspell lint --no-must-find-files", 7 | "*.{js,ts,vue,css}": "eslint --max-warnings 0 --no-warn-ignored --fix", 8 | "*.md": "prettier --ignore-unknown -w", 9 | }; 10 | 11 | export default config; 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "siyuan-developer-docs", 3 | "type": "module", 4 | "packageManager": "pnpm@9.7.0", 5 | "description": "Unofficial documentation for SiYuan community developers", 6 | "author": "SiYuan Community", 7 | "license": "AGPL-3.0-or-later", 8 | "homepage": "https://docs.siyuan-note.club/", 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/siyuan-community/siyuan-developer-docs.git" 12 | }, 13 | "bugs": { 14 | "url": "https://github.com/siyuan-community/siyuan-developer-docs/issues" 15 | }, 16 | "scripts": { 17 | "init": "npm run init:siyuan-sdk", 18 | "init:siyuan-sdk": "node ./scripts/siyuan-sdk.js", 19 | "check": "run-p check:cspell check:eslint check:prettier", 20 | "check:cspell": "cspell .", 21 | "check:eslint": "eslint --max-warnings 0 --no-warn-ignored .", 22 | "check:prettier": "prettier -c \"**/*.md\"", 23 | "format": "run-p format:eslint format:prettier", 24 | "format:eslint": "eslint --fix .", 25 | "format:prettier": "prettier --ignore-unknown -w \"**/*.md\"", 26 | "format:lint-staged": "lint-staged --allow-empty", 27 | "docs:dev": "npm run init && vitepress dev docs", 28 | "docs:build": "npm run init && vitepress build docs", 29 | "docs:preview": "vitepress preview docs", 30 | "prepare": "husky" 31 | }, 32 | "dependencies": { 33 | "@siyuan-community/siyuan-sdk": "^0.3.12", 34 | "@vercel/kv": "^2.0.0", 35 | "@vercel/speed-insights": "^1.0.12", 36 | "npm-run-all": "^4.1.5" 37 | }, 38 | "devDependencies": { 39 | "@antfu/eslint-config": "^2.24.1", 40 | "@commitlint/cli": "^19.3.0", 41 | "@commitlint/config-conventional": "^19.2.2", 42 | "@commitlint/types": "^19.0.3", 43 | "@types/lint-staged": "^13.3.0", 44 | "@types/node": "^22.1.0", 45 | "@vercel/node": "^3.2.8", 46 | "cspell": "^8.13.1", 47 | "eslint": "^9.8.0", 48 | "eslint-plugin-format": "^0.1.2", 49 | "eslint-plugin-tsdoc": "^0.3.0", 50 | "gray-matter": "^4.0.3", 51 | "husky": "^9.1.4", 52 | "lint-staged": "^15.2.8", 53 | "markdown-it-mathjax3": "^4.3.2", 54 | "prettier": "^3.3.3", 55 | "sass-embedded": "^1.77.8", 56 | "vitepress": "^1.3.2", 57 | "vue": "^3.4.35" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /scripts/siyuan-sdk.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2023 SiYuan Community 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU Affero General Public License as 6 | * published by the Free Software Foundation, either version 3 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Affero General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Affero General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | import fs from "node:fs"; 19 | 20 | function copy() { 21 | const targets = [ 22 | { 23 | src: "./node_modules/@siyuan-community/siyuan-sdk/dist/schemas/", 24 | dest: "./docs/public/schemas/", 25 | }, 26 | { 27 | src: "./node_modules/@siyuan-community/siyuan-sdk/dist/schemas/", 28 | dest: "./docs/snippets/siyuan-sdk/schemas/", 29 | }, 30 | { 31 | src: "./node_modules/@siyuan-community/siyuan-sdk/dist/types/", 32 | dest: "./docs/snippets/siyuan-sdk/types/", 33 | }, 34 | ]; 35 | 36 | for (const target of targets) { 37 | fs.cpSync(target.src, target.dest, { 38 | recursive: true, 39 | }); 40 | } 41 | } 42 | 43 | copy(); 44 | -------------------------------------------------------------------------------- /vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "rewrites": [ 3 | { 4 | "source": "/siyuan-sync/:match*", 5 | "destination": "https://siyuan-sync.b3logfile.com/:match*" 6 | }, 7 | { 8 | "source": "/siyuan-data/:match*", 9 | "destination": "https://siyuan-data.b3logfile.com/:match*" 10 | }, 11 | { 12 | "source": "/bazaar/:match*", 13 | "destination": "http://bazaar.b3logfile.com/:match*" 14 | }, 15 | { 16 | "source": "/oss/:match*", 17 | "destination": "https://oss.b3logfile.com/:match*" 18 | }, 19 | { 20 | "source": "/ld246/:match*", 21 | "destination": "https://ld246.com/:match*" 22 | } 23 | ], 24 | "crons": [ 25 | { 26 | "path": "/api/cron", 27 | "schedule": "0 18 * * *" 28 | } 29 | ], 30 | "functions": { 31 | "api/cron.ts": { 32 | "memory": 1024, 33 | "maxDuration": 10 34 | } 35 | } 36 | } 37 | --------------------------------------------------------------------------------