Skip to content

Commit 04076ca

Browse files
committed
version: 0.5.0
0 parents  commit 04076ca

26 files changed

+2031
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.d.ts]
15+
trim_trailing_whitespace = false

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Siyuan workspace path
2+
# The workspace contains `data` folder
3+
VITE_SIYUAN_WORKSPACE_PATH=/path/to/siyuan/workspace
4+
5+
# Manually set the dist dir to work with Symbolic Links
6+
VITE_DEV_DIST_DIR=

.github/workflows/release.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Create Release on Tag Push
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
# Checkout
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
18+
# Install Node.js
19+
- name: Install Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 18
23+
registry-url: "https://registry.npmjs.org"
24+
25+
# Install pnpm
26+
- name: Install pnpm
27+
uses: pnpm/action-setup@v2
28+
id: pnpm-install
29+
with:
30+
version: 8
31+
run_install: false
32+
33+
# Get pnpm store directory
34+
- name: Get pnpm store directory
35+
id: pnpm-cache
36+
shell: bash
37+
run: |
38+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
39+
40+
# Setup pnpm cache
41+
- name: Setup pnpm cache
42+
uses: actions/cache@v3
43+
with:
44+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
45+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
46+
restore-keys: |
47+
${{ runner.os }}-pnpm-store-
48+
49+
# Install dependencies
50+
- name: Install dependencies
51+
run: pnpm install
52+
53+
# Build for production, 这一步会生成一个 package.zip
54+
- name: Build for production
55+
run: pnpm build
56+
57+
- name: Release Info
58+
id: release_info
59+
run: |
60+
echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
61+
echo "changelog<<EOF" >> $GITHUB_OUTPUT
62+
sed -n '/^## 更新日志/,$p' README_zh_CN.md >> $GITHUB_OUTPUT
63+
echo "EOF" >> $GITHUB_OUTPUT
64+
65+
- name: Release
66+
uses: ncipollo/release-action@v1
67+
with:
68+
name: ${{ steps.release_info.outputs.tag_name }}
69+
tag: ${{ github.ref }}
70+
allowUpdates: true
71+
artifactErrorsFailBuild: true
72+
artifacts: "package.zip"
73+
token: ${{ secrets.GITHUB_TOKEN }}
74+
draft: false
75+
prerelease: false
76+
generateReleaseNotes: true
77+
body: ${{ steps.release_info.outputs.changelog }}
78+

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.idea
2+
# .vscode
3+
.DS_Store
4+
pnpm-lock.yaml
5+
package.zip
6+
node_modules
7+
dev
8+
dist
9+
build
10+
tmp
11+
.env

.vscode/settings.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"volar.autoCompleteRefs": true,
3+
"volar.updateImportOnFileMove.enabled": true,
4+
"css.validate": false,
5+
"scss.validate": false,
6+
"less.validate": false,
7+
"typescript.tsdk": "node_modules/typescript/lib",
8+
"todo-tree.tree.showBadges": true,
9+
"todo-tree.tree.showCountsInTree": true,
10+
// Disable the default formatter, use eslint instead
11+
"prettier.enable": false,
12+
"editor.formatOnSave": false,
13+
14+
// Auto fix
15+
"editor.codeActionsOnSave": {
16+
"source.fixAll.eslint": "explicit",
17+
"source.organizeImports": "never"
18+
},
19+
20+
// Silent the stylistic rules in you IDE, but still auto fix them
21+
// "eslint.rules.customizations": [
22+
// { "rule": "style/*", "severity": "warn", "fixable": true },
23+
// { "rule": "format/*", "severity": "warn", "fixable": true },
24+
// { "rule": "*-indent", "severity": "warn", "fixable": true },
25+
// { "rule": "*-spacing", "severity": "warn", "fixable": true },
26+
// { "rule": "*-spaces", "severity": "warn", "fixable": true },
27+
// { "rule": "*-order", "severity": "warn", "fixable": true },
28+
// { "rule": "*-dangle", "severity": "warn", "fixable": true },
29+
// { "rule": "*-newline", "severity": "warn", "fixable": true },
30+
// { "rule": "*quotes", "severity": "warn", "fixable": true },
31+
// { "rule": "*semi", "severity": "warn", "fixable": true }
32+
// ],
33+
"eslint.lintTask.enable": true,
34+
"eslint.lintTask.options": "-c ./eslint.config.mjs --quiet src",
35+
// Enable eslint for all supported languages
36+
"eslint.validate": [
37+
"javascript",
38+
"javascriptreact",
39+
"typescript",
40+
"typescriptreact",
41+
"vue",
42+
"html",
43+
"markdown",
44+
"json",
45+
"json5",
46+
"jsonc",
47+
"yaml",
48+
"toml",
49+
"xml",
50+
"gql",
51+
"graphql",
52+
"astro",
53+
"css",
54+
"less",
55+
"scss",
56+
"pcss",
57+
"postcss"
58+
]
59+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Yuxin Zhao
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<p align="center">
2+
<img alt="Pseudocode" src="./icon.png" width="160px">
3+
<br>
4+
5+
<p align="center">
6+
<strong>SiYuan Plugin「Embed Series」</strong>
7+
<br>
8+
Elegantly Writing and Displaying Pseudocode in SiYuan using LaTeX algorithm syntax.
9+
<br>
10+
No external dependencies · Full editability · Free to share
11+
</p>
12+
13+
<p align="center">
14+
<a href="https://github.com/YuxinZhaozyx/siyuan-embed-pseudocode/blob/main/README_zh_CN.md">中文</a> | <a href="https://github.com/YuxinZhaozyx/siyuan-embed-pseudocode/blob/main/README.md">English</a>
15+
</p>
16+
17+
---
18+
19+
## Embed Series
20+
21+
This plugin is an upgraded version of the Pseudocode Widget (`siyuan-pseudocode`), and serves as the second plugin in the **Embed Series**, aiming to provide a more complete and flexible Pseudocode experience within SiYuan.
22+
23+
**The principle of Embed Series plugins**: They are designed solely as auxiliary editing tools for SiYuan, embedding all information directly into formats supported by SiYuan and Markdown. This ensures that all content created by the plugin remains fully visible and functional even after being separated from the plugin — or even from SiYuan itself — such as when exporting to Markdown or sharing on third-party platforms.
24+
25+
For users of the original Pseudocode Widget, this plugin provides a one-click migration feature to help you quickly transition. For detailed steps, please refer to the Usage Guide section below.
26+
27+
## Effects
28+
29+
<details>
30+
<summary> Pseudocode Source Code </summary>
31+
32+
```
33+
\begin{algorithm}
34+
\caption{Quicksort}
35+
\begin{algorithmic}
36+
\PROCEDURE{Quicksort}{$A, p, r$}
37+
\IF{$p < r$}
38+
\STATE $q = $ \CALL{Partition}{$A, p, r$}
39+
\STATE \CALL{Quicksort}{$A, p, q - 1$}
40+
\STATE \CALL{Quicksort}{$A, q + 1, r$}
41+
\ENDIF
42+
\ENDPROCEDURE
43+
\PROCEDURE{Partition}{$A, p, r$}
44+
\STATE $x = A[r]$
45+
\STATE $i = p - 1$
46+
\FOR{$j = p$ \TO $r - 1$}
47+
\IF{$A[j] < x$}
48+
\STATE $i = i + 1$
49+
\STATE exchange
50+
$A[i]$ with $A[j]$
51+
\ENDIF
52+
\STATE exchange $A[i]$ with $A[r]$
53+
\ENDFOR
54+
\ENDPROCEDURE
55+
\end{algorithmic}
56+
\end{algorithm}
57+
```
58+
59+
</details>
60+
61+
![image.png](https://b3logfile.com/file/2025/11/image-L8Mdwbk.png)
62+
63+
## Features
64+
65+
- [x] Offline usage (no internet required)
66+
- [x] CodeMirror editor (syntax highlighting, auto-completion, error hints)
67+
- [x] Configure rendering style
68+
- [x] Store pseudocode in markdown native code blocks
69+
70+
> If you have additional feature requests or suggestions, feel free to [open an issue on GitHub](https://github.com/YuxinZhaozyx/siyuan-embed-pseudocode/issues) or [post in the SiYuan community](https://ld246.com/article/1762459066676).
71+
72+
## Usage Guide
73+
74+
**Create Pseudocode:**
75+
Type `/pseudoode` in the editor to create a pseudocode block.
76+
77+
**Edit Pseudocode:**
78+
Click the menu button in the left side / top-right corner of the code block. If the block is recognized as a valid pseudocode block, an `Edit Pseudocode` option will appear. Click it to open the editor.
79+
80+
**Switch Pseudocode View:**
81+
Click the menu button in the left side / top-right corner of the code block. If the block is recognized as a valid pseudocode block, an `Enable Pseudocode View` / `Disable Pseudocode View` option will appear. Click it to switch between pseudocode view and normal code block.
82+
83+
**Migrate from Pseudocode Widget:**
84+
Click the menu button on the left side of a Pseudocode Widget block. An option labeled `Convert to Embed Pseudocode` will appear. Click it to convert the old widget block into a new Embed Series pseudocode block.
85+
86+
## Changelog
87+
88+
+ v0.5.0
89+
+ Inherits all core features from the original Pseudocode Widget (`siyuan-pseudocode`)
90+
+ Added ability to edit and show pseudocode via the top-right menu button
91+
+ One-click migration from the original Pseudocode Widget
92+
+ Dark mode support

README_zh_CN.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<p align="center">
2+
<img alt="Pseudocode" src="./icon.png" width="160px">
3+
<br>
4+
5+
<p align="center">
6+
<strong>思源插件「嵌入式系列」</strong>
7+
<br>
8+
使用 LaTeX algorithm语法,在思源笔记中优雅地书写和展示伪代码。
9+
<br>
10+
无需外部依赖 · 自由编辑 · 自由分享
11+
</p>
12+
13+
<p align="center">
14+
<a href="https://github.com/YuxinZhaozyx/siyuan-embed-pseudocode/blob/main/README_zh_CN.md">中文</a> | <a href="https://github.com/YuxinZhaozyx/siyuan-embed-pseudocode/blob/main/README.md">English</a>
15+
</p>
16+
17+
---
18+
19+
## 嵌入式系列
20+
21+
本插件为Pseudocode挂件(siyuan-pseudocode)的升级版,作为第二个「嵌入式系列」插件,旨在为思源笔记提供更加完善且自由的伪代码编写体验。
22+
23+
**嵌入式系列插件的宗旨**:仅作为思源笔记的辅助编辑插件,将所有信息嵌入思源笔记和markdown所支持的数据格式中,使得插件所创造的所有内容在脱离插件甚至脱离思源笔记(导出为markdown/分享到第三方平台)后仍然可以正常显示。
24+
25+
对于原伪代码挂件用户,本插件也提供了一键转换功能,以帮助原伪代码挂件用户快速迁移到本插件,详细步骤请阅读本文使用指南小节。
26+
27+
28+
## 使用效果
29+
30+
31+
<details>
32+
<summary> 伪代码源码 </summary>
33+
34+
```
35+
\begin{algorithm}
36+
\caption{Quicksort}
37+
\begin{algorithmic}
38+
\PROCEDURE{Quicksort}{$A, p, r$}
39+
\IF{$p < r$}
40+
\STATE $q = $ \CALL{Partition}{$A, p, r$}
41+
\STATE \CALL{Quicksort}{$A, p, q - 1$}
42+
\STATE \CALL{Quicksort}{$A, q + 1, r$}
43+
\ENDIF
44+
\ENDPROCEDURE
45+
\PROCEDURE{Partition}{$A, p, r$}
46+
\STATE $x = A[r]$
47+
\STATE $i = p - 1$
48+
\FOR{$j = p$ \TO $r - 1$}
49+
\IF{$A[j] < x$}
50+
\STATE $i = i + 1$
51+
\STATE exchange
52+
$A[i]$ with $A[j]$
53+
\ENDIF
54+
\STATE exchange $A[i]$ with $A[r]$
55+
\ENDFOR
56+
\ENDPROCEDURE
57+
\end{algorithmic}
58+
\end{algorithm}
59+
```
60+
61+
</details>
62+
63+
![image.png](https://b3logfile.com/file/2025/11/image-L8Mdwbk.png)
64+
65+
## 功能
66+
67+
- [x] 无网络离线使用
68+
- [x] CodeMirror编辑器(语法高亮、代码自动补全、错误提示)
69+
- [x] 设置伪代码块的显示风格
70+
- [x] 以markdown原生代码块存储伪代码
71+
72+
> 如有更多需求/建议欢迎[在GitHub仓库中提issue](https://github.com/YuxinZhaozyx/siyuan-embed-pseudocode/issues)[在思源笔记社区中发帖](https://ld246.com/article/1762459066676)
73+
74+
## 使用指南
75+
76+
**创建伪代码:** 在编辑器中输入 `/pseudocode` 命令即可创建新的伪代码。
77+
78+
**编辑伪代码:** 点击代码块左侧/右上角的菜单按钮,如果代码块被识别为伪代码块(语言为`pseudocode`的代码块),则会出现 `编辑伪代码` 的选项,点击即可编辑。
79+
80+
**切换伪代码视图:** 点击代码块左侧/右上角的菜单按钮,如果代码块被识别为伪代码块(语言为`pseudocode`的代码块),则会出现 `开启伪代码视图` / `关闭伪代码视图` 的选项,点击切换。
81+
82+
**从伪代码挂件迁移:** 点击伪代码挂件块左侧的菜单按钮,会显示 `转换为嵌入式伪代码` 的选项,点击即可将伪代码挂件块转换为伪代码块。
83+
84+
85+
## 更新日志
86+
87+
+ v0.5.0
88+
+ 继承伪代码挂件(siyuan-pseudocode)的所有功能,点击代码块右上角按钮可切换为伪代码视图与编辑伪代码
89+
+ 提供原伪代码挂件转换为新版本插件代码块的功能
90+
+ 暗黑模式支持
91+

0 commit comments

Comments
 (0)