doc: format markdown.

This commit is contained in:
小弟调调
2025-08-13 22:32:12 +08:00
parent 6687a0989a
commit 5a4f7cdf37
4 changed files with 19 additions and 17 deletions

View File

@@ -1397,6 +1397,7 @@ Yoki.sound() # => Woof!
### 属性封装与访问控制 ### 属性封装与访问控制
实现计算属性、只读属性和验证逻辑。 实现计算属性、只读属性和验证逻辑。
```python ```python
class Person: class Person:
def __init__(self, age): def __init__(self, age):
@@ -1840,9 +1841,11 @@ else: # try/except 块的可选子句。 必须遵循除块
finally: # 在所有情况下执行 finally: # 在所有情况下执行
print("我们可以在这里清理资源") print("我们可以在这里清理资源")
``` ```
### 高阶函数map ### 高阶函数map
将一个函数应用到可迭代对象(如列表)的每个元素上,并返回一个新的迭代器。 将一个函数应用到可迭代对象(如列表)的每个元素上,并返回一个新的迭代器。
```python ```python
def square(x): def square(x):
return x ** 2 return x ** 2
@@ -1858,6 +1861,7 @@ print(list(result)) # 输出: [1, 4, 9, 16]
### 高阶函数sorted ### 高阶函数sorted
对可迭代对象进行排序,返回一个新的已排序列表(原对象不变) 对可迭代对象进行排序,返回一个新的已排序列表(原对象不变)
```python ```python
# 按照分数排序 # 按照分数排序
users = [ users = [
@@ -1883,6 +1887,7 @@ for user in sorted_users:
### 高阶函数reduce ### 高阶函数reduce
将一个二元函数(接受两个参数的函数)累积应用到可迭代对象的元素上,最终合并为单个值 将一个二元函数(接受两个参数的函数)累积应用到可迭代对象的元素上,最终合并为单个值
```python ```python
from functools import reduce from functools import reduce
@@ -1896,9 +1901,11 @@ result = reduce(multiply, numbers)
print(result) # 输出: 1202×3×4×5=120 print(result) # 输出: 1202×3×4×5=120
``` ```
### 偏函数 ### 偏函数
固定原函数的某些参数,生成新函数 固定原函数的某些参数,生成新函数
```python ```python
from functools import partial from functools import partial
@@ -1914,7 +1921,6 @@ print(square(5)) # 输出: 25 (5²)
print(square(10)) # 输出: 100 (10²) print(square(10)) # 输出: 100 (10²)
``` ```
### pyenv & pipenv ### pyenv & pipenv
<!--rehype:wrap-class=col-span-3--> <!--rehype:wrap-class=col-span-3-->

View File

@@ -296,7 +296,6 @@ $ ssh -L 4000:192.168.1.10:80 user@example.com -N
其中 `-N` 表示不执行远程命令,只是建立隧道。 其中 `-N` 表示不执行远程命令,只是建立隧道。
### 远程端口转发 ### 远程端口转发
<!--rehype:wrap-class=col-span-3--> <!--rehype:wrap-class=col-span-3-->

View File

@@ -2027,12 +2027,11 @@ print(intStorage.retrieve() ?? "Empty")
`swift-inspect` | 模块/符号分析工具 | 检查模块结构/调试工具输出 `swift-inspect` | 模块/符号分析工具 | 检查模块结构/调试工具输出
<!--rehype:className=show-header left-align--> <!--rehype:className=show-header left-align-->
### swift — 脚本执行 & REPL ### swift — 脚本执行 & REPL
<!--rehype:wrap-class=row-span-3--> <!--rehype:wrap-class=row-span-3-->
命令 | 说明 命令 | 说明
:-- | :-- :-- | :--
`swift` | 启动交互式环境REPL `swift` | 启动交互式环境REPL
`swift my_script.swift` | 运行 Swift 脚本文件 `swift my_script.swift` | 运行 Swift 脚本文件
`swift build` | 使用 SwiftPM 编译项目 `swift build` | 使用 SwiftPM 编译项目
@@ -2068,7 +2067,7 @@ $ swift package dump-package
<!--rehype:wrap-class=col-span-2--> <!--rehype:wrap-class=col-span-2-->
命令 | 说明 命令 | 说明
:-- | :-- :-- | :--
`swiftc main.swift` | 编译为默认名 `main` 的可执行文件 `swiftc main.swift` | 编译为默认名 `main` 的可执行文件
`swiftc main.swift -o myapp` | 编译为 `myapp` 可执行文件 `swiftc main.swift -o myapp` | 编译为 `myapp` 可执行文件
`swiftc -c Foo.swift` | 编译为中间的 `.o` 文件 `swiftc -c Foo.swift` | 编译为中间的 `.o` 文件
@@ -2080,12 +2079,11 @@ $ swift package dump-package
`swiftc -emit-object Foo.swift` | 输出目标文件 `.o` `swiftc -emit-object Foo.swift` | 输出目标文件 `.o`
<!--rehype:className=show-header left-align--> <!--rehype:className=show-header left-align-->
### swift-inspect ### swift-inspect
<!--rehype:wrap-class=col-span-2--> <!--rehype:wrap-class=col-span-2-->
命令 | 说明 命令 | 说明
:-- | :-- :-- | :--
`swift-inspect MyApp` | 分析一个编译产物(如 `.app``.dylib` `swift-inspect MyApp` | 分析一个编译产物(如 `.app``.dylib`
`swift-inspect --symbols MyModule.swiftmodule` | 查看模块的符号信息 `swift-inspect --symbols MyModule.swiftmodule` | 查看模块的符号信息
`swift-inspect --help` | 查看所有可用选项 `swift-inspect --help` | 查看所有可用选项

View File

@@ -292,14 +292,14 @@ ClipboardSetText("text")
### Windows 打包 ### Windows 打包
<!--rehype:wrap-class=col-span-2 row-span-2--> <!--rehype:wrap-class=col-span-2 row-span-2-->
#### <red>■</red> 默认生成: `.exe` 可执行文件 #### <red>■</red> 默认生成: `.exe` 可执行文件
<!--rehype:style=text-align: left;font-weight: bold;--> <!--rehype:style=text-align: left;font-weight: bold;-->
```bash ```bash
$ wails build -platform windows/amd64 $ wails build -platform windows/amd64
``` ```
#### <red>■</red> 生成 NSIS 安装程序: #### <red>■</red> 生成 NSIS 安装程序
<!--rehype:style=text-align: left;font-weight: bold;--> <!--rehype:style=text-align: left;font-weight: bold;-->
**前提条件**: 需要预先安装 [NSIS (Nullsoft Scriptable Install System)](https://nsis.sourceforge.io/Download)。 **前提条件**: 需要预先安装 [NSIS (Nullsoft Scriptable Install System)](https://nsis.sourceforge.io/Download)。
@@ -320,7 +320,7 @@ $ wails build -platform windows/amd64
$ wails build -platform windows/amd64 -nsis $ wails build -platform windows/amd64 -nsis
``` ```
#### <red>■</red> 处理 WebView2 依赖: #### <red>■</red> 处理 WebView2 依赖
<!--rehype:style=text-align: left;font-weight: bold;--> <!--rehype:style=text-align: left;font-weight: bold;-->
`download`: 提示用户下载 WebView2。 `download`: 提示用户下载 WebView2。
@@ -328,11 +328,13 @@ $ wails build -platform windows/amd64 -nsis
```bash ```bash
$ wails build -platform windows/amd64 -webview2 download $ wails build -platform windows/amd64 -webview2 download
``` ```
`embed`: 将 WebView2 嵌入到应用中(推荐)。 `embed`: 将 WebView2 嵌入到应用中(推荐)。
```bash ```bash
$ wails build -platform windows/amd64 -webview2 embed $ wails build -platform windows/amd64 -webview2 embed
``` ```
`browser`: 在浏览器中打开下载页面。 `browser`: 在浏览器中打开下载页面。
```bash ```bash
@@ -341,20 +343,19 @@ $ wails build -platform windows/amd64 -webview2 browser
### macOS 打包 ### macOS 打包
#### <red>■</red> 默认生成: `.app` 应用程序包
#### <red>■</red> 默认生成: `.app` 应用程序包。
<!--rehype:style=text-align: left;font-weight: bold;--> <!--rehype:style=text-align: left;font-weight: bold;-->
```bash ```bash
$ wails build -platform darwin/amd64 $ wails build -platform darwin/amd64
``` ```
#### <red>■</red> 代码签名与公证: #### <red>■</red> 代码签名与公证
<!--rehype:style=text-align: left;font-weight: bold;--> <!--rehype:style=text-align: left;font-weight: bold;-->
需要通过 Apple 开发者账户进行 **代码签名** 和 **公证** 才能分发。 需要通过 Apple 开发者账户进行 **代码签名** 和 **公证** 才能分发。
#### <red>■</red> 跳过打包成 `.app` 步骤: #### <red>■</red> 跳过打包成 `.app` 步骤
<!--rehype:style=text-align: left;font-weight: bold;--> <!--rehype:style=text-align: left;font-weight: bold;-->
```bash ```bash
@@ -389,7 +390,7 @@ $ wails build -platform linux/amd64 -rpm
#### AppImage 支持 #### AppImage 支持
Wails 不直接内置对 AppImage 的支持,但可以使用外部工具手动创建。使用 `appimagetool`: Wails 不直接内置对 AppImage 的支持,但可以使用外部工具手动创建。使用 `appimagetool`:
```shell ```shell
appimagetool ./your-app-dir appimagetool ./your-app-dir
@@ -474,7 +475,6 @@ func (a *App) LongRunningTask(ctx context.Context) error {
- **Go 部分**: 使用 `wails dev -debug` 启动并附加您的 Go 调试器。 - **Go 部分**: 使用 `wails dev -debug` 启动并附加您的 Go 调试器。
- **前端部分**: 在 `wails dev` 模式下,右键点击应用,选择“检查”打开浏览器开发者工具。 - **前端部分**: 在 `wails dev` 模式下,右键点击应用,选择“检查”打开浏览器开发者工具。
### 性能优化 ### 性能优化
#### 构建优化 #### 构建优化
@@ -528,7 +528,6 @@ $ wails dev
$ wails dev -frontenddevserverurl http://localhost:3000 $ wails dev -frontenddevserverurl http://localhost:3000
``` ```
参考资料 参考资料
--- ---