This commit is contained in:
cflmy committed 2026-11-18 10:51:28 +00:00
commit a4c04666b4
217 files changed
+506293

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
---
markup: occlusion
title: Hello World
description: Smallest runnable doc
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
Ordinary paragraphs are comments. `print` is a built-in, not a syntax marker.
Lines that start with Markdown emphasis markers can be treated as code — keep narrative as plain prose.
We now **[Display this step's result](> print text="Hello World!")**.
+17
View File
@@ -0,0 +1,17 @@
---
markup: occlusion
title: 你好世界
description: 最小可运行文档
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
普通段落是注释。`打印` 是内置函数,不是语法标记。
以 Markdown 强调标记开头的行可当作代码——叙述请用普通段落。
随后我们**[显示当前步骤的结果](> 打印 内容="你好世界!")**。
+30
View File
@@ -0,0 +1,30 @@
---
markup: occlusion
title: Functions and named calls
description: Callable headings, narrative inputs and readable named calls
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
Headings expose callable definitions. The input contract sits directly below the heading, and its body names the recipient in prose; callers supply that value by name.
Call with `>` and named args `param=value`:
We now **[Call greet](> greet who="World")**.
## greet
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| who | any | required | Recipient name inserted into the greeting |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; display the computed content on stdout |
Input `who`, used by the steps below.
We now **[Display this step's result](> print text="Hello `who`!")**.
+30
View File
@@ -0,0 +1,30 @@
---
markup: occlusion
title: 函数与具名调用
description: `#` 定义函数;`>` 调用;`-` 列出参数名
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
用 `#` / `##` 定义函数。参数是标题下的裸 `- 名` 行。
用 `>` 与具名实参 `参数=值` 调用:
随后我们**[执行 问候](> 问候 谁="世界")**。
## 问候
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 谁 | any | 必填 | 要显示在问候中的称呼 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 空值;通过标准输出显示本函数计算的内容。 |
输入`谁`,按下方步骤使用这个值。
随后我们**[显示当前步骤的结果](> 打印 内容="你好 `谁`!")**。
+32
View File
@@ -0,0 +1,32 @@
---
markup: occlusion
title: Positional arguments
description: Bind by parameter order; named form still works
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
Positional args bind in declaration order (no `who=` needed):
We now **[Call greet](> greet "Marqdo")**.
Named form still works:
We now **[Call greet](> greet who="World")**.
## greet
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| who | any | required | Recipient name inserted into the greeting |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; display the computed content on stdout |
Input `who`, used by the steps below.
We now **[Display this step's result](> print text="Hello `who`!")**.
+32
View File
@@ -0,0 +1,32 @@
---
markup: occlusion
title: 位置实参
description: 按参数声明顺序绑定;具名写法仍然可用
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
位置实参按声明顺序绑定(不必写 `谁=`):
随后我们**[执行 问候](> 问候 "Marqdo")**。
具名写法仍然可用:
随后我们**[执行 问候](> 问候 谁="世界")**。
## 问候
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 谁 | any | 必填 | 要显示在问候中的称呼 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 空值;通过标准输出显示本函数计算的内容。 |
输入`谁`,按下方步骤使用这个值。
随后我们**[显示当前步骤的结果](> 打印 内容="你好 `谁`!")**。
+22
View File
@@ -0,0 +1,22 @@
---
markup: occlusion
title: Branch
description: Ordered branches select one case and retain an explicit fallback
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
Bold markers execute statements and single italics return a value. Ordered list items select a branch; the final asterisk condition is the fallback when earlier conditions do not match.
We first **x = 0** for the next step.
1. `x` > 0
We now **[Display this step's result](> print text="positive")**.
2. `x` < 0
We now **[Display this step's result](> print text="negative")**.
3. *
We now **[Display this step's result](> print text="zero")**.
+22
View File
@@ -0,0 +1,22 @@
---
markup: occlusion
title: 分支
description: `+` 各臂;单独的 `*` 臂为否则
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
斜体行是语句。分支用 `+`;表头仅为 `*` 的是否则臂。
我们先**x = 0**,供下一步使用。
1. `x` > 0
随后我们**[显示当前步骤的结果](> 打印 内容="正数")**。
2. `x` < 0
随后我们**[显示当前步骤的结果](> 打印 内容="负数")**。
3. *
随后我们**[显示当前步骤的结果](> 打印 内容="零")**。
+33
View File
@@ -0,0 +1,33 @@
---
markup: occlusion
title: Loops
description: Condition loops and table walks
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
Inside a function body, `-` starts a loop (not a parameter).
Countdown:
We first **n = 3** for the next step.
- `n` > 0
We now **[Display this step's result](> print text=`n`)**.
We first **n = (`n` - 1)** for the next step.
Walk a table (tables are collections):
`basket` =
| fruit |
|-------|
| apple |
| pear |
- [fruit](遍历 basket 为 fruit)
We now **[Display this step's result](> print text="today `fruit`")**.
+33
View File
@@ -0,0 +1,33 @@
---
markup: occlusion
title: 循环
description: 条件循环与表遍历
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
在函数体里,`-` 表示循环(不是参数)。
倒数:
我们先**n = 3**,供下一步使用。
- `n` > 0
随后我们**[显示当前步骤的结果](> 打印 内容=`n`)**。
我们先**n = (`n` - 1)**,供下一步使用。
遍历表(表即集合):
`篮子` =
| 水果 |
|------|
| 苹果 |
| 梨 |
- [水果](遍历 篮子 为 水果)
随后我们**[显示当前步骤的结果](> 打印 内容="今天 `水果`")**。
+24
View File
@@ -0,0 +1,24 @@
---
markup: occlusion
title: Collections (tables)
description: One-column tables are lists
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
A single-column Markdown table is a list; loop to read each item. Prefer link-index get `[1](basket)` (1-based).
`basket` =
| fruit |
|-------|
| apple |
| pear |
| peach |
- [fruit](遍历 basket 为 fruit)
We now **[Display this step's result](> print text=`fruit`)**.
+24
View File
@@ -0,0 +1,24 @@
---
markup: occlusion
title: 集合(表)
description: 单列竖表即列表
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
单列 Markdown 表是列表;用循环读每一项。按下标优先用链接取元 `[1](篮子)`(1-based)。
`篮子` =
| 水果 |
|------|
| 苹果 |
| 梨 |
| 桃 |
- [水果](遍历 篮子 为 水果)
随后我们**[显示当前步骤的结果](> 打印 内容=`水果`)**。
+27
View File
@@ -0,0 +1,27 @@
---
markup: occlusion
title: Maps (horizontal tables)
description: Multi-column tables are maps; link-index get
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
A multi-column table with one data row is a map. Read values with `[key](map)`.
`kinds` =
| apple | cucumber |
|-------|----------|
| fruit | vegetable |
We first **k = [apple](access(`kinds`, "apple"))** for the next step.
We now **[Display this step's result](> print text=`k`)**.
We first **k = [cucumber](access(`kinds`, "cucumber"))** for the next step.
We now **[Display this step's result](> print text=`k`)**.
+27
View File
@@ -0,0 +1,27 @@
---
markup: occlusion
title: 字典(横表)
description: 多列表是字典;链接取元
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
多列且仅一行数据的表是字典。用 `[键](字典)` 取元。
`分类` =
| 苹果 | 黄瓜 |
|------|------|
| 水果 | 蔬菜 |
我们先**种 = [苹果](access(`分类`, "苹果"))**,供下一步使用。
随后我们**[显示当前步骤的结果](> 打印 内容=`种`)**。
我们先**种 = [黄瓜](access(`分类`, "黄瓜"))**,供下一步使用。
随后我们**[显示当前步骤的结果](> 打印 内容=`种`)**。
+28
View File
@@ -0,0 +1,28 @@
---
markup: occlusion
title: Row records
description: First header @ / row makes a list of maps
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
When the first header is `@` or `row`, each data row is a map (marker column is not a field). Nested get: `[field]([1](orders))`.
`orders` =
| @ | name | qty |
|---|------|-----|
| 1 | apple | 2 |
| 2 | pear | 3 |
We first **n = [name](access([1](access(`orders`, "1")), "name"))** for the next step.
We now **[Display this step's result](> print text=`n`)**.
We first **q = [qty](access([2](access(`orders`, "2")), "qty"))** for the next step.
We now **[Display this step's result](> print text=`q`)**.
+32
View File
@@ -0,0 +1,32 @@
---
markup: occlusion
title: 行向记录表
description: 首列表头「行」→ 每行一个字典
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
表头标记决定了这是一组行记录,而不是按列保存的字段列表。第一条记录的品名为苹果,第二条记录的数量为三;标记列只负责声明形态,不成为业务字段。读者可以先用 access 选出某一条记录,再按字段名取值,逐步核对每一步得到的是列表、记录还是标量。
本例保留两种字段类型:品名是文本,数量是整数,不把整张表先转成 JSON 再解析。遮蔽标签只写读取目的,真正的索引和字段名放在圆括号里;不要把标签中的数字当成另外一次索引。所有数据都来自本页,没有文件或网络访问。扩展字段时应同步更新相关函数的输入契约,让调用者知道新增列是否必填。
首列表头为 `行`(或 `@` / `row`)时,每行数据是一个字典;标记列不进入字段。嵌套取元:`[字段]([1](订单))`。
`订单` =
| 行 | 品名 | 数量 |
|----|------|------|
| 1 | 苹果 | 2 |
| 2 | 梨 | 3 |
我们先**名 = [品名](access([1](access(`订单`, "1")), "品名"))**,供下一步使用。
随后我们**[显示当前步骤的结果](> 打印 内容=`名`)**。
我们先**量 = [数量](access([2](access(`订单`, "2")), "数量"))**,供下一步使用。
随后我们**[显示当前步骤的结果](> 打印 内容=`量`)**。
+58
View File
@@ -0,0 +1,58 @@
---
markup: occlusion
title: Object inheritance
description: "# Child = > Parent; methods walk the base chain"
---
# Greeter
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | Object/type namespace for the child functions below; call the intended child directly |
## hello
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| who | any | required | Recipient name inserted into the greeting |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | The value explicitly returned below; conditional returns follow the selected branch |
Input `who`, used by the steps below.
We first **msg = "Hello, `who`!"** for the next step.
After these steps, return *msg*.
# Loud = > Greeter
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | Object/type namespace for the child functions below; call the intended child directly |
## hello
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| who | any | required | Recipient name inserted into the greeting |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | The value explicitly returned below; conditional returns follow the selected branch |
Input `who`, used by the steps below.
We first **msg = "HELLO, `who`!"** for the next step.
After these steps, return *msg*.
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
We first **g = [Compute g](Greeter())** for the next step.
We first **m = `g`.hello(who="world")** for the next step.
We now **[Display this step's result](> print text=`m`)**.
We first **l = [Compute l](Loud())** for the next step.
We first **m2 = `l`.hello(who="world")** for the next step.
We now **[Display this step's result](> print text=`m2`)**.
+58
View File
@@ -0,0 +1,58 @@
---
markup: occlusion
title: 对象继承
description: "# 子类 = > 父类;方法沿基类链查找"
---
# 问候者
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 供下述方法复用的对象或类型命名空间;直接调用所需的子函数。 |
## 你好
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 谁 | any | 必填 | 要显示在问候中的称呼 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 下文显式返回的计算值或结构化结果;分支存在时遵循实际命中的分支。 |
输入`谁`,按下方步骤使用这个值。
我们先**msg = "你好,`谁`!"**,供下一步使用。
完成上述步骤后,返回*msg*。
# 大声 = > 问候者
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 供下述方法复用的对象或类型命名空间;直接调用所需的子函数。 |
## 你好
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 谁 | any | 必填 | 要显示在问候中的称呼 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 下文显式返回的计算值或结构化结果;分支存在时遵循实际命中的分支。 |
输入`谁`,按下方步骤使用这个值。
我们先**msg = "你好,`谁`!!!"**,供下一步使用。
完成上述步骤后,返回*msg*。
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
我们先**g = [计算并保存 g](问候者())**,供下一步使用。
我们先**m = `g`.你好(谁="世界")**,供下一步使用。
随后我们**[显示当前步骤的结果](> 打印 内容=`m`)**。
我们先**l = [计算并保存 l](大声())**,供下一步使用。
我们先**m2 = `l`.你好(谁="世界")**,供下一步使用。
随后我们**[显示当前步骤的结果](> 打印 内容=`m2`)**。
+23
View File
@@ -0,0 +1,23 @@
---
markup: occlusion
title: Cross-file import
description: Frontmatter nested import: map
import:
utils: utils.mq.md
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
In the YAML header, nested `import:` with `utils: utils.mq.md` imports a sibling module and binds the library name `utils`.
Bind a return value, print it, then call greet:
We first **y = [Compute y](utils.add_one(n=41))** for the next step.
We now **[Display this step's result](> print text=`y`)**.
We now **[Call utils.greet](> utils.greet who="Marqdo")**.
+33
View File
@@ -0,0 +1,33 @@
---
markup: occlusion
title: Utility module
description: Imported by main; italic is return; print for side effects
---
## add_one
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| n | any | required | Numeric input advanced or calculated by this example |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | The value explicitly returned below; conditional returns follow the selected branch |
Input `n`, used by the steps below.
After these steps, return *(`n` + 1)*.
## greet
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| who | any | required | Recipient name inserted into the greeting |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; this function performs the described effects instead of returning business data |
Input `who`, used by the steps below.
We now **[Display this step's result](> print text="Hello, `who`!")**.
After these steps, return *None*.
+23
View File
@@ -0,0 +1,23 @@
---
markup: occlusion
title: 跨文件导入
description: frontmatter 导入 bind:路径.mq.md
导入:
工具: 工具.mq.md
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 空值;按顺序执行本页的演示步骤,观察输出或已说明的副作用。 |
在 YAML 头里写 `导入 工具:工具.mq.md` 可导入同级模块并绑定库名「工具」。
绑定返回值、打印,再调用问候:
我们先**y = [计算并保存 y](工具.加一(n=41))**,供下一步使用。
随后我们**[显示当前步骤的结果](> 打印 内容=`y`)**。
随后我们**[执行 工具.问候](> 工具.问候 谁="Marqdo")**。
+33
View File
@@ -0,0 +1,33 @@
---
markup: occlusion
title: 工具模块
description: 被 main 导入;斜体为返回;副作用用打印
---
## 加一
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| n | any | 必填 | Numeric input advanced or calculated by this example |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 下文显式返回的计算值或结构化结果;分支存在时遵循实际命中的分支。 |
输入`n`,按下方步骤使用这个值。
完成上述步骤后,返回*(`n` + 1)*。
## 问候
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| 谁 | any | 必填 | 要显示在问候中的称呼 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | 空值;本函数通过上述操作产生效果,不返回业务数据。 |
输入`谁`,按下方步骤使用这个值。
随后我们**[显示当前步骤的结果](> 打印 内容="你好,`谁`!")**。
完成上述步骤后,返回*None*。