docs(lib): narrate table/text/json as code-as-docs pilot

Add purpose lines and bracket-call examples in EN/ZH libs and public/stdlib
demos; keep explicit + params so function-body prose cannot be mistaken for
link-index or bold code.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-14 11:38:24 +08:00
1 parent 0e0655b316
commit 53bc3538da
13 files changed
+238 -89

No files matched your search

+8 -10
View File
@@ -1,19 +1,17 @@
---
title: lib/json — JSON
description: Shared EN/ZH path; parse and stringify
description: Shared EN/ZH path; parse and stringify (code-as-docs pilot)
import json:lib/json.mq.md
---
# main
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.
Shared JSON helpers for EN and ZH docs. Prefer parse, stringify, and quote.
Build maps with tables or table.put — not json.set chains.
**`obj` = > json.parse text="{}"**
**`obj` = [json.parse] text="{}"**
**`ty` = > type `obj`**
**打印 内容=`ty`**
**`ty` = > type `obj` **
> print text=`ty`
**`out` = > json.stringify value=`obj` **
> print text=`out`
**`out` = > json.stringify value=`obj`**
**打印 内容=`out`**
+8 -7
View File
@@ -1,14 +1,15 @@
---
title: lib/table — collections
description: put, append, and map helpers
description: put, append, and map helpers (code-as-docs pilot)
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).
Read with link-index get. 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,9 +18,9 @@ Prefer `table.put` for element updates (`at=` text key, 1-based int, or list pat
| a |
| b |
**`xs` = > table.put in=`xs` at=1 value="A"**
**`xs` = [table.put] in=`xs` at=1 value="A"**
**`n` = > table.rows xs=`xs`**
> print text=`h`[^Authorization]
> print text=`xs`[^1]
> print text=`n`
**打印 内容=[Authorization](h)**
**打印 内容=[1](xs)**
**打印 内容=`n`**
+5 -8
View File
@@ -1,19 +1,16 @@
---
title: lib/text — strings
description: Trim, split, join wrappers
description: Trim, split, join (code-as-docs pilot)
import text:lib/text.mq.md
---
# main
Import lib/text.mq.md. Functions: str_trim(s), str_split(s, sep), str_join(xs, sep).
Import lib/text. Bracket path or classic dotted calls both work.
**`t` = > text.str_trim s=" marqdo "**
> print text=`t`
**`t` = [text.str_trim] s=" marqdo "**
**打印 内容=`t`**
**`parts` = > text.str_split s="a,b,c" sep=","**
**`j` = > text.str_join xs=`parts` sep="-"**
> print text=`j`
**打印 内容=`j`**
+5 -8
View File
@@ -1,19 +1,16 @@
---
title: lib/文本 — 字符串
description: 去空白、拆分、拼接
description: 去空白、拆分、拼接(代码即文档试点)
导入 文本:lib/文本.mq.md
---
# main
导入 lib/文本.mq.md。函数:去空白(s)、拆分(s, sep)、拼接(xs, sep)。
导入 lib/文本。括号路径或经典点号调用均可。
**`t` = > 文本.去空白 s=" marqdo "**
> 打印 内容=`t`
**`t` = [文本.去空白] s=" marqdo "**
**打印 内容=`t`**
**`parts` = > 文本.拆分 s="甲,乙,丙" sep=","**
**`j` = > 文本.拼接 xs=`parts` sep="-"**
> 打印 内容=`j`
**打印 内容=`j`**
+7 -7
View File
@@ -1,12 +1,12 @@
---
title: lib/表 — 列表
description: 行数与取行
title: lib/表 — 列表与字典
description: 改 / 行数 / 取行(代码即文档试点)
导入 表:lib/表.mq.md
---
# main
导入 lib/表.mq.md。函数:行数(xs)、取行(xs, i)。单列表在运行时是列表。
嵌套写入用 表.改;读元用链接取元。
`xs` =
@@ -15,10 +15,10 @@ description: 行数与取行
| 甲 |
| 乙 |
**`xs` = [表.改] 入=`xs` 于=1 值="甲改"**
**`n` = > 表.行数 xs=`xs`**
> 打印 内容=`n`
**`r` = > 表.取行 xs=`xs` i=0**
> 打印 内容=`r`
**打印 内容=[1](xs)**
**打印 内容=`n`**
**打印 内容=`r`**