feat(markup): finish v0.3 stock migration and green gold

Migrate remaining .mq.md (tests/ext/public/examples), stop elevating local assigns to params, inject form_target in Go libweb, and skip live LLM gold without a real key.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-13 23:43:44 +08:00
1 parent bfb10d172b
commit b5c07385e9
324 files changed
+4572 -4339

No files matched your search

+2 -2
View File
@@ -7,7 +7,7 @@ import foreign:lib/foreign.mq.md
# main
Hi — thanks for reading this far. I am Marqdo’s developer. Marqdo is a language where **code is documentation, and documentation is code**: Markdown markers are the program structure, so what you read is what runs.
Hi — thanks for reading this far. I am Marqdo’s developer. Marqdo is a language where *code is documentation, and documentation is code*: Markdown markers are the program structure, so what you read is what runs.
AI already prefers Markdown-shaped output. The idea was: why keep docs and code as two separate worlds? So Marqdo was born as a “docs are code” language. To keep every source renderable as Markdown, files use the `.mq.md` suffix. From early on we aimed for richer tooling — auto-generated YAML for OKF-style knowledge bases, even auto-generated slides — those are later goals. Happily, it already works well as a blogging tool: yes, this site is generated by Marqdo. And when AI writes Marqdo, you tend to burn fewer tokens — wallets everywhere thank you.
@@ -41,7 +41,7 @@ $$
Then plot it:
*`_svg` = > math.plot formula=`f` var="x" min=-3 max=3*
**`_svg` = > math.plot formula=`f` var="x" min=-3 max=3**
The foreign library lets you call external code, for example:
+2 -2
View File
@@ -7,7 +7,7 @@ description: 用户文档首页 — 代码即文档(中文版)
# main
阅读到这里的朋友你好!我是 Marqdo 的开发者。Marqdo 是一门**代码即文档,文档即代码**的语言:Markdown 标记就是程序结构,你读到的就是能跑的程序。
阅读到这里的朋友你好!我是 Marqdo 的开发者。Marqdo 是一门*代码即文档,文档即代码*的语言:Markdown 标记就是程序结构,你读到的就是能跑的程序。
AI 偏爱 Markdown结构的输出。作者的念头是:何必再把文档和代码拆成两套?我们来实现一个文档即代码的语言,所以marqdo应运而生,为了确保代码一定可以被渲染,marqdo的文件后缀定义为了`.mq.md`。在开发之处我们就尝试希望更丰富的支持,自动生成一个yaml文件使得 OKF 式知识库便捷的自动配置,乃至自动生成ppt,自然这都是以后的目标了。不过相当不错的是,至少这会成为一个不错的博客工具——对,这个站点就是 Marqdo 生成的,而且AI输出的时候会节约不少token,你知道的,token烧的太多,钱包会可怜的饿瘦的。
@@ -41,7 +41,7 @@ $$
之后让我们画个图像吧!
*`_svg` = > 数学.绘图 formula=`f` var="x" min=-3 max=3*
**`_svg` = > 数学.绘图 formula=`f` var="x" min=-3 max=3**
外联库则允许你调用外部代码,例如:
+1 -1
View File
@@ -34,7 +34,7 @@ ext/llm — OpenAI-compatible chat. Design: doc/design/ext-llm.md
ext/agent — agent framework + native plugin. Design: doc/design/ext-agent.md
ext/web — HTTP / SQLite·Postgres site helpers + native plugin (default **Go libweb**, v0.4.0). **W0–W7 + P3 + W8** + **customization C0–C4**; acceptance example `examples/anlian-mq/`. **Browser embed (routes D/E/F, v0.3.4)**: `web.client_embed` auto-mounts WASM — zero author JS; `lib/browser` + GFM tables; build with `marqdo wasm build`; examples: browser-hello · browser-app · browser-media · web-client-site. Design: doc/design/ext-web.md · WASM: doc/adr/0002-browser-marqdo-wasm.md · roadmaps D/E/F.
ext/web — HTTP / SQLite·Postgres site helpers + native plugin (default *Go libweb*, v0.4.0). **W0–W7 + P3 + W8** + **customization C0–C4**; acceptance example `examples/anlian-mq/`. **Browser embed (routes D/E/F, v0.3.4)**: `web.client_embed` auto-mounts WASM — zero author JS; `lib/browser` + GFM tables; build with `marqdo wasm build`; examples: browser-hello · browser-app · browser-media · web-client-site. Design: doc/design/ext-web.md · WASM: doc/adr/0002-browser-marqdo-wasm.md · roadmaps D/E/F.
ext/quantum — circuits, draw, noise, formula matrix custom gates, Q7 density/viz, Q8 themed SVG (`theme=dark|light|bw`). Design: doc/design/ext-quantum.md · doc/design/ext-quantum-viz-style.md
+1 -1
View File
@@ -34,7 +34,7 @@ ext/llm(大模型)— OpenAI 兼容聊天。设计:doc/design/ext-llm.md
ext/agent(智能体)— 智能体框架 + 原生插件。设计:doc/design/ext-agent.md
ext/web(网页)— HTTP / SQLite 站点助手 + 原生插件(默认 **Go libweb**,v0.4.0)。**W0–W7 + P3 + W8** + **定制 C0–C4**;验收示例 `examples/anlian-mq/`。**浏览器挂载(路线 D/E/F,v0.3.4)**:`网页.客户端挂载` / `web.client_embed` 自动 mount(作者零业务 JS);`lib/浏览器` + GFM;先 `marqdo wasm build`;示例 examples/browser-hello/ · examples/browser-app/ · examples/browser-media/ · examples/web-client-site/。设计:doc/design/ext-web.md · WASM:doc/adr/0002-browser-marqdo-wasm.md · 路线 D/E/F:doc/roadmap/browser-wasm-*.md
ext/web(网页)— HTTP / SQLite 站点助手 + 原生插件(默认 *Go libweb*,v0.4.0)。**W0–W7 + P3 + W8** + **定制 C0–C4**;验收示例 `examples/anlian-mq/`。**浏览器挂载(路线 D/E/F,v0.3.4)**:`网页.客户端挂载` / `web.client_embed` 自动 mount(作者零业务 JS);`lib/浏览器` + GFM;先 `marqdo wasm build`;示例 examples/browser-hello/ · examples/browser-app/ · examples/browser-media/ · examples/web-client-site/。设计:doc/design/ext-web.md · WASM:doc/adr/0002-browser-marqdo-wasm.md · 路线 D/E/F:doc/roadmap/browser-wasm-*.md
ext/quantum(量子)— 电路、绘图、噪声、公式矩阵自定义门、Q7 密度/高级图、Q8 主题 SVG(`主题=dark|light|bw`)。设计:doc/design/ext-quantum.md · doc/design/ext-quantum-viz-style.md
+5 -5
View File
@@ -22,11 +22,11 @@ Q8: `draw theme="dark"|"light"|"bw"` (default dark lab look) on circuit / probs
| 2 | CX | 0,1 |
| 3 | CX | 0,2 |
*`qc` = > quantum.circuit qubits=3 steps=`steps`*
*`p` = > `qc`.probabilities*
*`_` = > `qc`.draw kind="probs" theme="dark"*
*`H` = > quantum.gate name="H"*
*`__` = > `H`.draw kind="matrix"*
**`qc` = > quantum.circuit qubits=3 steps=`steps`**
**`p` = > `qc`.probabilities**
**`_` = > `qc`.draw kind="probs" theme="dark"**
**`H` = > quantum.gate name="H"**
**`__` = > `H`.draw kind="matrix"**
> print text=`p`
> print text=quantum-feature-ok
+5 -5
View File
@@ -22,11 +22,11 @@ Q8:`绘图 主题="dark"|"light"|"bw"`(默认 dark 科技感)作用于电
| 2 | CX | 0,1 |
| 3 | CX | 0,2 |
*`qc` = > 量子.电路 比特数=3 步骤=`步骤`*
*`p` = > `qc`.概率*
*`_` = > `qc`.绘图 种类="probs" 主题="dark"*
*`H` = > 量子.门 名="H"*
*`__` = > `H`.绘图 种类="matrix"*
**`qc` = > 量子.电路 比特数=3 步骤=`步骤`**
**`p` = > `qc`.概率**
**`_` = > `qc`.绘图 种类="probs" 主题="dark"**
**`H` = > 量子.门 名="H"**
**`__` = > `H`.绘图 种类="matrix"**
> 打印 内容=`p`
> 打印 内容=量子特性-ok
+6 -6
View File
@@ -8,7 +8,7 @@ import la:ext/linalg/linalg.mq.md
Not stdlib. Install: `marqdo ext add linalg` (or build `marqdo_plugin_linalg`).
**Idea:** if the `.mq.md` runs and the asserted form matches, the identity holds under the library rules. Algebra reads like a lecture; `factorize` / `lstsq` / `draw` stay explicit calculation steps.
*Idea:* if the `.mq.md` runs and the asserted form matches, the identity holds under the library rules. Algebra reads like a lecture; `factorize` / `lstsq` / `draw` stay explicit calculation steps.
# main
@@ -21,11 +21,11 @@ Declare symbols in a table, multiply, transpose — `T_ascii` is one-step displa
| 1 | A | 2 | 3 |
| 2 | B | 3 | 2 |
*`env` = > la.declare table=`shapes`*
*`A` = env[^A]*
*`B` = env[^B]*
*`P` = `A` * `B`*
*`t` = > `P`.T_ascii*
**`env` = > la.declare table=`shapes`**
**`A` = env[^A]**
**`B` = env[^B]**
**`P` = `A` * `B`**
**`t` = > `P`.T_ascii**
> print text=`t`
1. `t` == "B^T*A^T"
> print text=formula-doc-ok
+6 -6
View File
@@ -8,7 +8,7 @@ description: ext/linalg 公式文档面 — 声明、中缀、跑通即正确
可选扩展(非 stdlib)。安装:`marqdo ext add linalg`(中文 id:`线性代数`)。
**思想:** `.mq.md` 能跑通且断言的规范形一致,则在库规则下该恒等式成立。代数叙述像讲义;`分解` / `最小二乘` / `绘图` 才是显式计算步骤。
*思想:* `.mq.md` 能跑通且断言的规范形一致,则在库规则下该恒等式成立。代数叙述像讲义;`分解` / `最小二乘` / `绘图` 才是显式计算步骤。
# main
@@ -21,11 +21,11 @@ description: ext/linalg 公式文档面 — 声明、中缀、跑通即正确
| 1 | A | 2 | 3 |
| 2 | B | 3 | 2 |
*`环境` = > la.声明 表=`形状`*
*`A` = 环境[^A]*
*`B` = 环境[^B]*
*`P` = `A` * `B`*
*`t` = > `P`.转置文本*
**`环境` = > la.声明 表=`形状`**
**`A` = 环境[^A]**
**`B` = 环境[^B]**
**`P` = `A` * `B`**
**`t` = > `P`.转置文本**
> 打印 内容=`t`
1. `t` == "B^T*A^T"
> 打印 内容=formula-doc-ok
+3 -3
View File
@@ -11,9 +11,9 @@ Mid-tier stdlib: everyday primitives stay in `lib/`, not ABI plugins.
# main
*`ok` = > re.is_match text="user@example.com" pattern="^[^@]+@[^@]+$"*
*`tok` = > enc.base64_encode text="marqdo"*
*`hex` = > enc.hex_encode text="ok"*
**`ok` = > re.is_match text="user@example.com" pattern="^[^@]+@[^@]+$"**
**`tok` = > enc.base64_encode text="marqdo"**
**`hex` = > enc.hex_encode text="ok"**
> print text=`ok`
> print text=`tok`
> print text=`hex`
+3 -3
View File
@@ -11,9 +11,9 @@ description: lib/正则 + lib/编码,无需插件(中层 M1)
# main
*`ok` = > 正则.匹配 内容="user@example.com" 模式="^[^@]+@[^@]+$"*
*`tok` = > 编码.基64编码 内容="marqdo"*
*`hex` = > 编码.十六进制编码 内容="ok"*
**`ok` = > 正则.匹配 内容="user@example.com" 模式="^[^@]+@[^@]+$"**
**`tok` = > 编码.基64编码 内容="marqdo"**
**`hex` = > 编码.十六进制编码 内容="ok"**
> 打印 内容=`ok`
> 打印 内容=`tok`
> 打印 内容=`hex`
+3 -3
View File
@@ -11,11 +11,11 @@ Join and normalize without plugins; copy/move stay sandboxed under the program d
# main
*`p` = > path.join a="out" b="demo.txt"*
*`n` = > path.normalize path="out/./x/../demo.txt"*
**`p` = > path.join a="out" b="demo.txt"**
**`n` = > path.normalize path="out/./x/../demo.txt"**
> fs.write_text path=`p` text="path-m2"
> fs.copy_file src=`p` dest="out/demo-copy.txt"
*`body` = > fs.read_text path="out/demo-copy.txt"*
**`body` = > fs.read_text path="out/demo-copy.txt"**
> print text=`p`
> print text=`n`
> print text=`body`
+3 -3
View File
@@ -11,11 +11,11 @@ description: lib/路径 + 文件复制/移动/临时(中层 M2)
# main
*`p` = > 路径.拼接 甲="out" 乙="demo.txt"*
*`n` = > 路径.规范化 路径="out/./x/../demo.txt"*
**`p` = > 路径.拼接 甲="out" 乙="demo.txt"**
**`n` = > 路径.规范化 路径="out/./x/../demo.txt"**
> 文件.写文本 路径=`p` 内容="path-m2"
> 文件.复制文件 源=`p` 目标="out/demo-copy.txt"
*`body` = > 文件.读文本 路径="out/demo-copy.txt"*
**`body` = > 文件.读文本 路径="out/demo-copy.txt"**
> 打印 内容=`p`
> 打印 内容=`n`
> 打印 内容=`body`
+3 -3
View File
@@ -11,9 +11,9 @@ Integrity digests and cryptographic tokens stay in `lib/` — do not use `math.r
# main
*`d` = > hash.sha256 text="marqdo"*
*`t` = > sec.token_hex n=8*
*`L` = > len `t`*
**`d` = > hash.sha256 text="marqdo"**
**`t` = > sec.token_hex n=8**
**`L` = > len `t`**
> print text=`d`
> print text=`L`
1. `L` == 16
+3 -3
View File
@@ -11,9 +11,9 @@ description: lib/哈希 + lib/机密,无需插件(中层 M3)
# main
*`d` = > 哈希.哈希256 内容="marqdo"*
*`t` = > 机密.十六进制令牌 字节数=8*
*`L` = > 长度 `t`*
**`d` = > 哈希.哈希256 内容="marqdo"**
**`t` = > 机密.十六进制令牌 字节数=8**
**`L` = > 长度 `t`**
> 打印 内容=`d`
> 打印 内容=`L`
1. `L` == 16
+5 -5
View File
@@ -11,13 +11,13 @@ Parse a tiny CSV, normalize a field, print — no plugins.
# main
*raw = "name,city\nAda,london\nBob,PARIS\n"*
*rows = > csv.parse text=`raw`*
*r0 = > at value=`rows` index=0*
*city = > text.to_upper text=`r0`[^city]*
**raw = "name,city\nAda,london\nBob,PARIS\n"**
**rows = > csv.parse text=`raw`**
**r0 = > at value=`rows` index=0**
**city = > text.to_upper text=`r0`[^city]**
> print text=`r0`[^name]
> print text=`city`
*n = > len `rows`*
**n = > len `rows`**
1. `n` == 2
> print text=mid-m4-ok
2. *
+5 -5
View File
@@ -11,13 +11,13 @@ description: lib/逗号表 + 加厚 lib/文本(中层 M4)
# main
*raw = "name,city\nAda,london\nBob,PARIS\n"*
*rows = > 逗号表.解析 内容=`raw`*
*r0 = > at value=`rows` index=0*
*city = > 文本.大写 内容=`r0`[^city]*
**raw = "name,city\nAda,london\nBob,PARIS\n"**
**rows = > 逗号表.解析 内容=`raw`**
**r0 = > at value=`rows` index=0**
**city = > 文本.大写 内容=`r0`[^city]**
> 打印 内容=`r0`[^name]
> 打印 内容=`city`
*n = > 长度 `rows`*
**n = > 长度 `rows`**
1. `n` == 2
> 打印 内容=mid-m4-ok
2. *
+6 -6
View File
@@ -12,14 +12,14 @@ Zero plugins: parse CSV, sort by key, parse `--input`.
# main
*raw = "name,score\nbob,2\nalice,10\n"*
*rows = > csv.parse text=`raw`*
*rows = > table.sort_by list=`rows` key="name"*
*r0 = > at value=`rows` index=0*
**raw = "name,score\nbob,2\nalice,10\n"**
**rows = > csv.parse text=`raw`**
**rows = > table.sort_by list=`rows` key="name"**
**r0 = > at value=`rows` index=0**
> print text=`r0`[^name]
*args = > split value="--input,scores.csv,--pretty" sep=","*
*flags = > cli.parse args=`args`*
**args = > split value="--input,scores.csv,--pretty" sep=","**
**flags = > cli.parse args=`args`**
> print text=`flags`[^input]
1. `flags`[^pretty]
> print text=mid-m5-ok
+6 -6
View File
@@ -12,14 +12,14 @@ description: 表排序/去重 + 命令行解析(中层 M5)
# main
*raw = "name,score\nbob,2\nalice,10\n"*
*rows = > 逗号表.解析 内容=`raw`*
*rows = > 表.按键排序 list=`rows` key="name"*
*r0 = > at value=`rows` index=0*
**raw = "name,score\nbob,2\nalice,10\n"**
**rows = > 逗号表.解析 内容=`raw`**
**rows = > 表.按键排序 list=`rows` key="name"**
**r0 = > at value=`rows` index=0**
> 打印 内容=`r0`[^name]
*args = > split value="--input,scores.csv,--pretty" sep=","*
*flags = > 命令行.解析 参数=`args`*
**args = > split value="--input,scores.csv,--pretty" sep=","**
**flags = > 命令行.解析 参数=`args`**
> 打印 内容=`flags`[^input]
1. `flags`[^pretty]
> 打印 内容=mid-m5-ok
+2 -2
View File
@@ -19,6 +19,6 @@ Default log level is info; raise to debug when you need more. Mint ids with uuid
> log.debug text="now-visible"
*id = > uuid.v4*
*n = > len `id`*
**id = > uuid.v4**
**n = > len `id`**
> print text=`n`
+2 -2
View File
@@ -19,6 +19,6 @@ description: 按级别过滤的日志 + UUID 版本4(中层 M6)
> 日志.调试 内容="现在可见"
*id = > 标识.版本4*
*n = > 长度 `id`*
**id = > 标识.版本4**
**n = > 长度 `id`**
> 打印 内容=`n`
+2 -2
View File
@@ -11,9 +11,9 @@ Moments are maps `{unix, zone, iso}`. Parse HTTPS URLs and round-trip query stri
# main
*epoch = > dt.from_unix unix=0 zone="Asia/Shanghai"*
**epoch = > dt.from_unix unix=0 zone="Asia/Shanghai"**
> print text=`epoch`[^iso]
*u = > url.parse text="https://example.com/path?q=1#top"*
**u = > url.parse text="https://example.com/path?q=1#top"**
> print text=`u`[^host]
> print text=`u`[^query]
+2 -2
View File
@@ -11,9 +11,9 @@ description: 日历时刻 + URL/查询串(Mid2 M7)
# main
*epoch = > 日时.自戳 秒=0 区="Asia/Shanghai"*
**epoch = > 日时.自戳 秒=0 区="Asia/Shanghai"**
> print text=`epoch`[^iso]
*u = > 址.解析 内容="https://example.com/path?q=1"*
**u = > 址.解析 内容="https://example.com/path?q=1"**
> print text=`u`[^host]
> print text=`u`[^query]
+4 -4
View File
@@ -12,13 +12,13 @@ Parse a TOML subset for tools, escape HTML before assembly, encode with base32.
# main
*cfg = > toml.parse text="app = \"demo\"\n[server]\nport = 8080\n"*
**cfg = > toml.parse text="app = \"demo\"\n[server]\nport = 8080\n"**
> print text=`cfg`[^app]
*srv = `cfg`[^server]*
**srv = `cfg`[^server]**
> print text=`srv`[^port]
*safe = > html.escape text="<tag>"*
**safe = > html.escape text="<tag>"**
> print text=`safe`
*b = > enc.base32_encode text="ok"*
**b = > enc.base32_encode text="ok"**
> print text=`b`
@@ -10,11 +10,11 @@ description: TOML 配置 + HTML 转义 + base32(Mid2 M8)
# main
*cfg = > 配置.解析 内容="app = \"演示\"\n"*
**cfg = > 配置.解析 内容="app = \"演示\"\n"**
> print text=`cfg`[^app]
*safe = > 超.转义 内容="<tag>"*
**safe = > 超.转义 内容="<tag>"**
> print text=`safe`
*b = > 编.基32编码 内容="ok"*
**b = > 编.基32编码 内容="ok"**
> print text=`b`
+3 -3
View File
@@ -14,11 +14,11 @@ import fs:lib/fs.mq.md
> fs.write_text path="m9-demo/readme.txt" text="ok"
*st = > fs.stat path="m9-demo/readme.txt"*
**st = > fs.stat path="m9-demo/readme.txt"**
> print text=`st`[^size]
*w = > fs.walk path="m9-demo"*
*n = > len `w`*
**w = > fs.walk path="m9-demo"**
**n = > len `w`**
> print text=`n`
> fs.remove_tree path="m9-demo"
+3 -3
View File
@@ -12,11 +12,11 @@ description: 递归目录、遍历与元数据(Mid2 M9)
> 文件.写文本 路径="m9-演示/说明.txt" 内容="好"
*st = > 文件.状态 路径="m9-演示/说明.txt"*
**st = > 文件.状态 路径="m9-演示/说明.txt"**
> print text=`st`[^size]
*w = > 文件.遍历 路径="m9-演示"*
*n = > 长度 `w`*
**w = > 文件.遍历 路径="m9-演示"**
**n = > 长度 `w`**
> print text=`n`
> 文件.删目录树 路径="m9-演示"
+1 -1
View File
@@ -19,7 +19,7 @@ Light statistics and optional `fields=` on log lines — no remote sinks, no dat
| 20 |
| 30 |
*m = > stats.mean list=`xs`*
**m = > stats.mean list=`xs`**
> print text=`m`
`fld` =
+1 -1
View File
@@ -17,7 +17,7 @@ description: 薄均值/中位数/标准差 + 日志 fields(Mid2 M10)
| 20 |
| 30 |
*m = > 统计.均值 列表=`xs`*
**m = > 统计.均值 列表=`xs`**
> print text=`m`
`fld` =
+3 -3
View File
@@ -7,15 +7,15 @@ description: True / False / None and and / or / not
Keywords: `True`, `False`, `None`, and `and` / `or` / `not`.
*`a` = True*
*`b` = False*
**`a` = True**
**`b` = False**
1. `a` and not `b`
> print text=ok
2. *
> print text=fail
*`probe` = 1*
**`probe` = 1**
1. None
> print text=none-truthy
+1 -1
View File
@@ -8,6 +8,6 @@ stdin: Ada
The input builtin reads one line. For demos and marqdo view / static export, put sample lines in frontmatter (stdin:). CLI can also use a pipe or --stdin-file. Live view can override with the Preset input box.
*`name` = > input prompt="Name: "*
**`name` = > input prompt="Name: "**
> print text=Hello `name`!
+7 -7
View File
@@ -7,25 +7,25 @@ description: Host builtins for strings and tables
Length and type:
*`s` = "hello"*
**`s` = "hello"**
*`n` = > len `s`*
**`n` = > len `s`**
> print text=`n`
*`ty` = > type `s`*
**`ty` = > type `s`**
> print text=`ty`
Trim, split, join, and index:
*`t` = > trim value=" hi "*
**`t` = > trim value=" hi "**
*`parts` = > split value="a,b" sep=","*
**`parts` = > split value="a,b" sep=","**
*`mid` = > at value=`parts` index=0*
**`mid` = > at value=`parts` index=0**
*`j` = > join value=`parts` sep="-"*
**`j` = > join value=`parts` sep="-"**
> print text=`t`
+2 -2
View File
@@ -7,9 +7,9 @@ description: 无需导入:打印、长度、文本、整数 与 print / len /
内核中英别名等价,可混用:
*`s` = "你好"*
**`s` = "你好"**
*`n` = > 长度 值=`s`*
**`n` = > 长度 值=`s`**
> 打印 内容=`n`
+3 -3
View File
@@ -7,15 +7,15 @@ description: 真 / 假 / 空 与 且 / 或 / 非
关键字:`真`、`假`、`空`,以及 `且` / `或` / `非`。
*`a` = 真*
*`b` = 假*
**`a` = 真**
**`b` = 假**
1. `a` 且 非 `b`
> 打印 内容=通过
2. *
> 打印 内容=失败
*`probe` = 1*
**`probe` = 1**
1. 空
> 打印 内容=空为真
+7 -7
View File
@@ -7,25 +7,25 @@ description: 主机内置;中文别名覆盖常用几个
长度与英文 `type`(类型无中文内核别名,见标准库文档):
*`s` = "你好"*
**`s` = "你好"**
*`n` = > 长度 值=`s`*
**`n` = > 长度 值=`s`**
> 打印 内容=`n`
*`ty` = > type `s`*
**`ty` = > type `s`**
> 打印 内容=`ty`
去空白、拆分、拼接、按下标(主机名仍为英文):
*`t` = > trim value=" 嗨 "*
**`t` = > trim value=" 嗨 "**
*`parts` = > split value="甲,乙" sep=","*
**`parts` = > split value="甲,乙" sep=","**
*`mid` = > at value=`parts` index=0*
**`mid` = > at value=`parts` index=0**
*`j` = > join value=`parts` sep="-"*
**`j` = > join value=`parts` sep="-"**
> 打印 内容=`t`
+1 -1
View File
@@ -8,6 +8,6 @@ description: 从 stdin 读一行;可选提示。演示数据写在 frontmatter
内置「输入」读一行。演示与 marqdo view / 静态导出可在 frontmatter 写「输入:」(或 stdin:)。CLI 也可用管道或 --stdin-file。Live view 可用 Preset input 覆盖。
*`名字` = > 输入 提示="名字:"*
**`名字` = > 输入 提示="名字:"**
> 打印 内容=你好 `名字`!
+1 -1
View File
@@ -15,6 +15,6 @@ print("hello-from-python")
Default command is python (Windows) or python3 (Unix). Override with set_cmd, env MARQDO_FOREIGN_PYTHON, or the command box in live view. Failures ask you to check that configuration.
*`out` = > foreign.run code=`hi` *
**`out` = > foreign.run code=`hi` **
> print text=`out`
+1 -1
View File
@@ -10,7 +10,7 @@ Import lib/fs.mq.md. Functions: read_text, write_text, append_text, exists, list
Bare path words must not contain a slash character (parsed as division). Prefer a same-folder name or a variable.
*`ok` = > fs.exists path="demo.txt"*
**`ok` = > fs.exists path="demo.txt"**
1. `ok`
> print text=demo-present
+3 -3
View File
@@ -8,12 +8,12 @@ import json:lib/json.mq.md
Import lib/json.mq.md from both English and Chinese docs (no translated twin). Functions: parse(text), stringify(value), get(value, key), keys(value), quote(text) — JSON string literal with quotes (for building request bodies). Objects become the map runtime type.
*`obj` = > json.parse text="{}"*
**`obj` = > json.parse text="{}"**
*`ty` = > type `obj` *
**`ty` = > type `obj` **
> print text=`ty`
*`out` = > json.stringify value=`obj` *
**`out` = > json.stringify value=`obj` **
> print text=`out`
+5 -5
View File
@@ -17,22 +17,22 @@ Numeric helpers: pi, e, num, add/sub/mul/div/pow, sin/cos/tan, sqrt/abs/ln/exp,
Symbolic: formula(text), simplify, expand, diff, subs, eval, solve.
Plotting (already in the library): plot / plot_points / plot_conic return SVG text. Axes include arrows and tick labels; **grid is on by default** (pass grid=False / grid=假 to hide). Optional path= writes a file under the sandbox. With no path, CLI auto-writes stem-plot-n.svg and prints plot: …; view embeds the SVG under Execution.
Plotting (already in the library): plot / plot_points / plot_conic return SVG text. Axes include arrows and tick labels; grid is on by default (pass grid=False / grid=假 to hide). Optional path= writes a file under the sandbox. With no path, CLI auto-writes stem-plot-n.svg and prints plot: …; view embeds the SVG under Execution.
diff / simplify / expand / partial subs return formula values so you can chain (e.g. differentiate twice, then plot or eval).
*`ty` = > type `f`*
**`ty` = > type `f`**
> print text=`ty`
*`df` = > math.diff formula=`f` var="x"*
**`df` = > math.diff formula=`f` var="x"**
> print text=`df`
*`roots` = > math.solve formula=`f` var="x"*
**`roots` = > math.solve formula=`f` var="x"**
> print text=`roots`
*`_svg` = > math.plot formula=`f` var="x" min=-3 max=3*
**`_svg` = > math.plot formula=`f` var="x" min=-3 max=3**
> print text=plot-ok
+1 -1
View File
@@ -8,6 +8,6 @@ import net:lib/net.mq.md
Import lib/net.mq.md. Functions: http_get, http_post, http_post_sse, openai_sse_parse, http_request, url_encode. HTTPS and optional headers= map are supported. Default post content-type is JSON. `http_post_sse` / `openai_sse_parse` return OpenAI chat stream event lists (`delta` / `done`).
*`e` = > net.url_encode text="hello world"*
**`e` = > net.url_encode text="hello world"**
> print text=`e`
+2 -2
View File
@@ -8,9 +8,9 @@ import plugin:lib/plugin.mq.md
Import lib/plugin.mq.md. Functions: load(path), unload(), list(). After load, registered plugin names are callable like other functions. C ABI: include/marqdo_abi.h — see doc/design/ext-abi.md. Path must stay under the program sandbox (cwd / fs root).
*`names` = > plugin.list *
**`names` = > plugin.list **
*`n` = > len `names` *
**`n` = > len `names` **
1. `n` >= 0
> print text=plugin-ok
+2 -2
View File
@@ -8,9 +8,9 @@ import sys:lib/sys.mq.md
Import lib/sys.mq.md. Functions: env_get, env_set, load_dotenv(optional path), args, cwd, exit(code), exec(cmd), stream_publish(event). load_dotenv does not override existing variables. Under view, exit soft-fails instead of killing the process. `stream_publish` feeds the view SSE EventBus.
*`d` = > sys.cwd *
**`d` = > sys.cwd **
*`n` = > len `d` *
**`n` = > len `d` **
1. `n` > 0
> print text=cwd-ok
+4 -4
View File
@@ -6,9 +6,9 @@ import table:lib/table.mq.md
# main
Prefer `table.put` for element updates (`at=` text key, **1-based** int, or list path). Use `json` for parse/stringify only.
Prefer `table.put` for element updates (`at=` text key, 1-based int, or list path). Use `json` for parse/stringify only.
*`h` = > table.put in=None at="Authorization" value="Bearer-demo"*
**`h` = > table.put in=None at="Authorization" value="Bearer-demo"**
`xs` =
@@ -17,8 +17,8 @@ Prefer `table.put` for element updates (`at=` text key, **1-based** int, or list
| a |
| b |
*`xs` = > table.put in=`xs` at=1 value="A"*
*`n` = > table.rows xs=`xs`*
**`xs` = > table.put in=`xs` at=1 value="A"**
**`n` = > table.rows xs=`xs`**
> print text=`h`[^Authorization]
> print text=`xs`[^1]
+3 -3
View File
@@ -8,12 +8,12 @@ import text:lib/text.mq.md
Import lib/text.mq.md. Functions: str_trim(s), str_split(s, sep), str_join(xs, sep).
*`t` = > text.str_trim s=" marqdo "*
**`t` = > text.str_trim s=" marqdo "**
> print text=`t`
*`parts` = > text.str_split s="a,b,c" sep=","*
**`parts` = > text.str_split s="a,b,c" sep=","**
*`j` = > text.str_join xs=`parts` sep="-"*
**`j` = > text.str_join xs=`parts` sep="-"**
> print text=`j`
+2 -2
View File
@@ -8,11 +8,11 @@ import time:lib/time.mq.md
Import lib/time.mq.md. Functions: now_unix, now_ms, format(unix, pattern), parse(text, pattern), sleep_ms(ms). Patterns use strftime.
*`s` = > time.format unix=0 pattern="%Y-%m-%d"*
**`s` = > time.format unix=0 pattern="%Y-%m-%d"**
> print text=`s`
*`u` = > time.parse text="1970-01-01 00:00:00" pattern="%Y-%m-%d %H:%M:%S"*
**`u` = > time.parse text="1970-01-01 00:00:00" pattern="%Y-%m-%d %H:%M:%S"**
> print text=`u`
+1 -1
View File
@@ -15,6 +15,6 @@ print("hello-from-python")
默认命令可用 设置命令 或 MARQDO_FOREIGN_PYTHON 覆盖;live view 里可改命令框再点 Run。
*`out` = > 外联.运行 代码=`hi` *
**`out` = > 外联.运行 代码=`hi` **
> print text=`out`
+2 -2
View File
@@ -8,9 +8,9 @@ description: 加载可选共享库(.dll / .so / .dylib)
导入 lib/插件.mq.md。函数:加载(路径)、卸载()、列出()。加载后,插件注册的名称可像普通函数一样调用。C 契约见 include/marqdo_abi.h 与 doc/design/ext-abi.md。路径须落在程序沙箱内。
*`names` = > 插件.列出 *
**`names` = > 插件.列出 **
*`n` = > 长度 值=`names` *
**`n` = > 长度 值=`names` **
1. `n` >= 0
> 打印 内容=插件就绪
+5 -5
View File
@@ -17,22 +17,22 @@ $$
符号:公式、化简、展开、求导、代入、求值、求解。
作图(库已提供):绘图 / 绘点列 / 绘圆锥,返回 SVG 文本。坐标轴带箭头与刻度;**默认显示网格**(`grid=假` 可关闭)。可选 path= 写盘。无 path 时 CLI 自动写 stem-plot-n.svg 并打印 plot: …;view 在 Execution 内嵌 SVG。
作图(库已提供):绘图 / 绘点列 / 绘圆锥,返回 SVG 文本。坐标轴带箭头与刻度;*默认显示网格*(`grid=假` 可关闭)。可选 path= 写盘。无 path 时 CLI 自动写 stem-plot-n.svg 并打印 plot: …;view 在 Execution 内嵌 SVG。
求导 / 化简 / 展开 / 未完全数值化的代入仍返回 formula,可继续链式调用(例如求二阶导后再绘图或求值)。
*`ty` = > type `f`*
**`ty` = > type `f`**
> print text=`ty`
*`df` = > 数学.求导 formula=`f` var="x"*
**`df` = > 数学.求导 formula=`f` var="x"**
> print text=`df`
*`roots` = > 数学.求解 formula=`f` var="x"*
**`roots` = > 数学.求解 formula=`f` var="x"**
> print text=`roots`
*`_svg` = > 数学.绘图 formula=`f` var="x" min=-3 max=3*
**`_svg` = > 数学.绘图 formula=`f` var="x" min=-3 max=3**
> print text=plot-ok
+1 -1
View File
@@ -10,7 +10,7 @@ description: 沙箱内读写文本
裸路径字面量不要写斜杠(会被当成除法)。可用同目录文件名或变量。
*`ok` = > 文件.存在 路径="demo.txt"*
**`ok` = > 文件.存在 路径="demo.txt"**
1. `ok`
> 打印 内容=有演示文件
+3 -3
View File
@@ -8,12 +8,12 @@ description: 去空白、拆分、拼接
导入 lib/文本.mq.md。函数:去空白(s)、拆分(s, sep)、拼接(xs, sep)。
*`t` = > 文本.去空白 s=" marqdo "*
**`t` = > 文本.去空白 s=" marqdo "**
> 打印 内容=`t`
*`parts` = > 文本.拆分 s="甲,乙,丙" sep=","*
**`parts` = > 文本.拆分 s="甲,乙,丙" sep=","**
*`j` = > 文本.拼接 xs=`parts` sep="-"*
**`j` = > 文本.拼接 xs=`parts` sep="-"**
> 打印 内容=`j`
+2 -2
View File
@@ -8,11 +8,11 @@ description: Unix 时间、格式化、解析、睡眠
导入 lib/时间.mq.md。函数:此刻秒、此刻毫秒、格式化(秒, 格式)、解析时间(内容, 格式)、睡眠毫秒(毫秒)。格式为 strftime。
*`s` = > 时间.格式化 秒=0 格式="%Y-%m-%d"*
**`s` = > 时间.格式化 秒=0 格式="%Y-%m-%d"**
> 打印 内容=`s`
*`u` = > 时间.解析时间 内容="1970-01-01 00:00:00" 格式="%Y-%m-%d %H:%M:%S"*
**`u` = > 时间.解析时间 内容="1970-01-01 00:00:00" 格式="%Y-%m-%d %H:%M:%S"**
> 打印 内容=`u`
+2 -2
View File
@@ -8,9 +8,9 @@ description: 环境变量、dotenv、工作目录、参数、退出、执行
导入 lib/系统.mq.md。函数:取环境、设环境、加载环境(可选路径)、参数表、工作目录、退出(码)、执行(命令)。加载环境不覆盖已有变量。view 下退出会软失败,不结束进程。
*`d` = > 系统.工作目录 *
**`d` = > 系统.工作目录 **
*`n` = > 长度 值=`d` *
**`n` = > 长度 值=`d` **
1. `n` > 0
> 打印 内容=工作目录就绪
+1 -1
View File
@@ -8,6 +8,6 @@ description: HTTP(S) 与地址编码
导入 lib/网络.mq.md。函数:获取(地址)、提交(地址, 内容;可选 content_type / headers)、编码地址(内容)。支持 HTTP 与 HTTPS(ureq)。
*`e` = > 网络.编码地址 内容="你好"*
**`e` = > 网络.编码地址 内容="你好"**
> 打印 内容=`e`
+2 -2
View File
@@ -15,10 +15,10 @@ description: 行数与取行
| 甲 |
| 乙 |
*`n` = > 表.行数 xs=`xs`*
**`n` = > 表.行数 xs=`xs`**
> 打印 内容=`n`
*`r` = > 表.取行 xs=`xs` i=0*
**`r` = > 表.取行 xs=`xs` i=0**
> 打印 内容=`r`
+1 -1
View File
@@ -7,7 +7,7 @@ description: `+` arms; a lone `*` arm is else
Italic lines are statements. Branches use `+`; a head that is only `*` is the else arm.
*`x` = 0*
**`x` = 0**
1. `x` > 0
> print text=positive
+1 -1
View File
@@ -7,7 +7,7 @@ description: `+` 各臂;单独的 `*` 臂为否则
斜体行是语句。分支用 `+`;表头仅为 `*` 的是否则臂。
*`x` = 0*
**`x` = 0**
1. `x` > 0
> 打印 内容=正数
+2 -2
View File
@@ -9,11 +9,11 @@ Inside a function body, `-` starts a loop (not a parameter).
Countdown:
*`n` = 3*
**`n` = 3**
- `n` > 0
> print text=`n`
*`n` = `n` - 1*
**`n` = `n` - 1**
Walk a table (tables are collections):
+2 -2
View File
@@ -9,11 +9,11 @@ description: 条件循环与表遍历
倒数:
*`n` = 3*
**`n` = 3**
- `n` > 0
> 打印 内容=`n`
*`n` = `n` - 1*
**`n` = `n` - 1**
遍历表(表即集合):
+2 -2
View File
@@ -13,10 +13,10 @@ A multi-column table with one data row is a map. Read values with footnote keys.
|-------|----------|
| fruit | vegetable |
*`k` = `kinds`[^apple] *
**`k` = `kinds`[^apple] **
> print text=`k`
*`k` = `kinds`[^cucumber] *
**`k` = `kinds`[^cucumber] **
> print text=`k`
+2 -2
View File
@@ -13,10 +13,10 @@ description: 多列表是字典;脚注按键取元
|------|------|
| 水果 | 蔬菜 |
*`种` = `分类`[^苹果] *
**`种` = `分类`[^苹果] **
> 打印 内容=`种`
*`种` = `分类`[^黄瓜] *
**`种` = `分类`[^黄瓜] **
> 打印 内容=`种`
+2 -2
View File
@@ -14,10 +14,10 @@ When the first header is `@` or `row`, each data row is a map (marker column is
| 1 | apple | 2 |
| 2 | pear | 3 |
*`n` = `orders`[^1][^name] *
**`n` = `orders`[^1][^name] **
> print text=`n`
*`q` = `orders`[^2][^qty] *
**`q` = `orders`[^2][^qty] **
> print text=`q`
+2 -2
View File
@@ -14,10 +14,10 @@ description: 首列表头「行」→ 每行一个字典
| 1 | 苹果 | 2 |
| 2 | 梨 | 3 |
*`名` = `订单`[^1][^品名] *
**`名` = `订单`[^1][^品名] **
> 打印 内容=`名`
*`量` = `订单`[^2][^数量] *
**`量` = `订单`[^2][^数量] **
> 打印 内容=`量`
+8 -8
View File
@@ -8,22 +8,22 @@ description: "# Child = > Parent; methods walk the base chain"
## hello
+ `who`
*`msg` = "Hello, `who`!"*
**`msg`**
**`msg` = "Hello, `who`!"**
*`msg`*
# Loud = > Greeter
## hello
+ `who`
*`msg` = "HELLO, `who`!"*
**`msg`**
**`msg` = "HELLO, `who`!"**
*`msg`*
# main
*`g` = > Greeter*
*`m` = > `g`.hello who="world"*
**`g` = > Greeter**
**`m` = > `g`.hello who="world"**
> print text=`m`
*`l` = > Loud*
*`m2` = > `l`.hello who="world"*
**`l` = > Loud**
**`m2` = > `l`.hello who="world"**
> print text=`m2`
+8 -8
View File
@@ -8,22 +8,22 @@ description: "# 子类 = > 父类;方法沿基类链查找"
## 你好
+ `谁`
*`msg` = "你好,`谁`!"*
**`msg`**
**`msg` = "你好,`谁`!"**
*`msg`*
# 大声 = > 问候者
## 你好
+ `谁`
*`msg` = "你好,`谁`!!!"*
**`msg`**
**`msg` = "你好,`谁`!!!"**
*`msg`*
# main
*`g` = > 问候者*
*`m` = > `g`.你好 谁="世界"*
**`g` = > 问候者**
**`m` = > `g`.你好 谁="世界"**
> 打印 内容=`m`
*`l` = > 大声*
*`m2` = > `l`.你好 谁="世界"*
**`l` = > 大声**
**`m2` = > `l`.你好 谁="世界"**
> 打印 内容=`m2`
+1 -1
View File
@@ -10,7 +10,7 @@ In the YAML header, `import utils:utils.mq.md` imports a sibling module and bind
Bind a return value, print it, then call greet:
*`y` = > utils.add_one n=41*
**`y` = > utils.add_one n=41**
> print text=`y`
+1 -1
View File
@@ -10,7 +10,7 @@ description: frontmatter 导入 bind:路径.mq.md
绑定返回值、打印,再调用问候:
*`y` = > 工具.加一 n=41*
**`y` = > 工具.加一 n=41**
> 打印 内容=`y`