Add v0.2 surface syntax, writeback/subtask stdlib, and view input deferral.

Use + for parameters, ordered-list branches, backtick identifiers, and quoted strings with escapes. Add writeback and subtask host libs, optional parameter defaults, narrative-bold comment fix, and defer view execution until preset stdin is submitted.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-06 17:52:33 +08:00
1 parent 92d88fe761
commit 63e5be80ab
116 files changed
+2226 -559

No files matched your search

+5 -5
View File
@@ -4,19 +4,19 @@ description: Run bound code fences and inline sources via local interpreters
---
## set_cmd
- lang
- cmd
+ `lang`
+ `cmd`
**> host_foreign_set_cmd lang=`lang` cmd=`cmd`**
## run
- code
+ `code`
**> host_foreign_run code=`code`**
## run_lang
- lang
- source
+ `lang`
+ `source`
**> host_foreign_run_lang lang=`lang` source=`source`**
+9 -9
View File
@@ -4,38 +4,38 @@ description: English filesystem wrappers
---
## read_text
- path
+ `path`
**> host_read_text path=`path`**
## write_text
- path
- text
+ `path`
+ `text`
**> host_write_text path=`path` text=`text`**
## append_text
- path
- text
+ `path`
+ `text`
**> host_append_text path=`path` text=`text`**
## exists
- path
+ `path`
**> host_exists path=`path`**
## list_dir
- path
+ `path`
**> host_list_dir path=`path`**
## make_dir
- path
+ `path`
**> host_make_dir path=`path`**
## remove
- path
+ `path`
**> host_remove path=`path`**
+11 -11
View File
@@ -4,40 +4,40 @@ description: JSON parse/stringify (shared EN/ZH import)
---
## parse
- text
+ `text`
**> host_json_parse text=`text`**
## stringify
- value
+ `value`
**> host_json_stringify value=`value`**
## get
- value
- key
+ `value`
+ `key`
**> host_json_get value=`value` key=`key`**
## keys
- value
+ `value`
**> host_json_keys value=`value`**
## quote
- text
+ `text`
**> host_json_quote text=`text`**
## set
- map
- key
- value
+ `map`
+ `key`
+ `value`
**> host_map_set map=`map` key=`key` value=`value`**
## append
- list
- item
+ `list`
+ `item`
**> host_list_append list=`list` item=`item`**
+52 -52
View File
@@ -12,114 +12,114 @@ description: High-school math — num, random, formula, plot
**> host_e**
## num
- value
+ `value`
**> host_num value=`value`**
## add
- a
- b
+ `a`
+ `b`
**> host_math_add a=`a` b=`b`**
## sub
- a
- b
+ `a`
+ `b`
**> host_math_sub a=`a` b=`b`**
## mul
- a
- b
+ `a`
+ `b`
**> host_math_mul a=`a` b=`b`**
## div
- a
- b
+ `a`
+ `b`
**> host_math_div a=`a` b=`b`**
## pow
- a
- b
+ `a`
+ `b`
**> host_math_pow a=`a` b=`b`**
## neg
- value
+ `value`
**> host_math_neg value=`value`**
## sin
- value
+ `value`
**> host_math_sin value=`value`**
## cos
- value
+ `value`
**> host_math_cos value=`value`**
## tan
- value
+ `value`
**> host_math_tan value=`value`**
## asin
- value
+ `value`
**> host_math_asin value=`value`**
## acos
- value
+ `value`
**> host_math_acos value=`value`**
## atan
- value
+ `value`
**> host_math_atan value=`value`**
## sqrt
- value
+ `value`
**> host_math_sqrt value=`value`**
## abs
- value
+ `value`
**> host_math_abs value=`value`**
## ln
- value
+ `value`
**> host_math_ln value=`value`**
## exp
- value
+ `value`
**> host_math_exp value=`value`**
## floor
- value
+ `value`
**> host_math_floor value=`value`**
## ceil
- value
+ `value`
**> host_math_ceil value=`value`**
## min
- a
- b
+ `a`
+ `b`
**> host_math_min a=`a` b=`b`**
## max
- a
- b
+ `a`
+ `b`
**> host_math_max a=`a` b=`b`**
@@ -128,73 +128,73 @@ description: High-school math — num, random, formula, plot
**> host_random**
## random_int
- min
- max
+ `min`
+ `max`
**> host_random_int min=`min` max=`max`**
## seed
- value
+ `value`
**> host_seed value=`value`**
## formula
- text
+ `text`
**> host_formula value=`text`**
## simplify
- formula
+ `formula`
**> host_simplify value=`formula`**
## expand
- formula
+ `formula`
**> host_expand value=`formula`**
## diff
- formula
- var
+ `formula`
+ `var`
**> host_diff formula=`formula` var=`var`**
## subs
- formula
- var
- value
+ `formula`
+ `var`
+ `value`
**> host_subs formula=`formula` var=`var` value=`value`**
## eval
- formula
- var
- value
+ `formula`
+ `var`
+ `value`
**> host_eval formula=`formula` var=`var` value=`value`**
## solve
- formula
- var
+ `formula`
+ `var`
**> host_solve formula=`formula` var=`var`**
## plot
- formula
- var
- min
- max
+ `formula`
+ `var`
+ `min`
+ `max`
**> host_plot formula=`formula` var=`var` min=`min` max=`max`**
## plot_points
- xs
- ys
+ `xs`
+ `ys`
**> host_plot_points xs=`xs` ys=`ys`**
## plot_conic
- kind
- a
+ `kind`
+ `a`
**> host_plot_conic kind=`kind` a=`a`**
+6 -6
View File
@@ -4,29 +4,29 @@ description: English HTTP(S) wrappers. Optional headers / content_type via host
---
## http_get
- url
+ `url`
HTTPS supported. Optional named arg `headers=` (map).
**> host_http_get url=`url`**
## http_post
- url
- body
+ `url`
+ `body`
Default content type is JSON. Optional `content_type=` / `headers=` (map).
**> host_http_post url=`url` body=`body`**
## http_request
- method
- url
+ `method`
+ `url`
Optional `body=` / `content_type=` / `headers=`.
**> host_http_request method=`method` url=`url`**
## url_encode
- text
+ `text`
**> host_url_encode text=`text`**
+1 -1
View File
@@ -4,7 +4,7 @@ description: Load optional native ABI plugins (.dll / .so / .dylib)
---
## load
- path
+ `path`
**> host_plugin_load path=`path`**
+28
View File
@@ -0,0 +1,28 @@
---
title: lib/subtask
description: OS subprocess subtasks (parent exit kills children)
---
## spawn
+ `path`
**> host_subtask_spawn path=`path`**
## poll
+ `id`
**> host_subtask_poll id=`id`**
## wait
+ `id`
**> host_subtask_join id=`id`**
## kill
+ `id`
**> host_subtask_kill id=`id`**
## wait_all
**> host_subtask_wait_all**
+5 -5
View File
@@ -4,13 +4,13 @@ description: English system wrappers (load_dotenv accepts optional path via host
---
## env_get
- name
+ `name`
**> host_env_get name=`name`**
## env_set
- name
- value
+ `name`
+ `value`
**> host_env_set name=`name` value=`value`**
@@ -29,11 +29,11 @@ Load `.env` (optional named arg `path=`). Existing process env is not overridden
**> host_cwd**
## exit
- code
+ `code`
**> host_exit code=`code`**
## exec
- cmd
+ `cmd`
**> host_exec cmd=`cmd`**
+3 -3
View File
@@ -4,12 +4,12 @@ description: English table helpers over len / at
---
## rows
- xs
+ `xs`
**> len `xs`**
## row_at
- xs
- i
+ `xs`
+ `i`
**> at value=`xs` index=`i`**
+5 -5
View File
@@ -4,18 +4,18 @@ description: English text helpers over trim / split / join
---
## str_trim
- s
+ `s`
**> trim `s`**
## str_split
- s
- sep
+ `s`
+ `sep`
**> split value=`s` sep=`sep`**
## str_join
- xs
- sep
+ `xs`
+ `sep`
**> join value=`xs` sep=`sep`**
+5 -5
View File
@@ -12,18 +12,18 @@ description: English time wrappers
**> host_now_ms**
## format
- unix
- pattern
+ `unix`
+ `pattern`
**> host_format_time unix=`unix` pattern=`pattern`**
## sleep_ms
- ms
+ `ms`
**> host_sleep_ms ms=`ms`**
## parse
- text
- pattern
+ `text`
+ `pattern`
**> host_parse_time text=`text` pattern=`pattern`**
+32
View File
@@ -0,0 +1,32 @@
---
title: lib/writeback
description: Persist run output in .mq.md (Jupyter-style writeback)
---
## record
+ `value`
+ `at_end`=False
Write `value` to `<!-- marqdo-out … -->` in the entry file. Default: insert or replace the block immediately below the call; `at_end=true` appends a single block at EOF.
**> host_writeback_record value=`value` at_end=`at_end`**
## get
+ `at_end`=False
Read persisted output for the current call site (adjacent block), or the EOF block when `at_end=true`.
**> host_writeback_get at_end=`at_end`**
## clear
+ `at_end`=False
Remove the adjacent or EOF output block.
**> host_writeback_clear at_end=`at_end`**
## list
List all output blocks in the entry file.
**> host_writeback_list**
+5 -5
View File
@@ -4,19 +4,19 @@ description: 通过本机解释器运行绑定的代码围栏与内联源码
---
## 设置命令
- 语言
- 命令
+ `语言`
+ `命令`
**> host_foreign_set_cmd lang=`语言` cmd=`命令`**
## 运行
- 代码
+ `代码`
**> host_foreign_run code=`代码`**
## 按语言运行
- 语言
- 源码
+ `语言`
+ `源码`
**> host_foreign_run_lang lang=`语言` source=`源码`**
+28
View File
@@ -0,0 +1,28 @@
---
title: lib/子任务
description: OS 子进程子任务(父进程结束则子进程结束)
---
## 启动
+ `路径`
**> host_subtask_spawn path=`路径`**
## 探测
+ `id`
**> host_subtask_poll id=`id`**
## 等待
+ `id`
**> host_subtask_join id=`id`**
## 终止
+ `id`
**> host_subtask_kill id=`id`**
## 等待全部
**> host_subtask_wait_all**
+1 -1
View File
@@ -4,7 +4,7 @@ description: 加载可选原生 ABI 插件(.dll / .so / .dylib)
---
## 加载
- 路径
+ `路径`
**> host_plugin_load path=`路径`**
+52 -52
View File
@@ -12,114 +12,114 @@ description: 高中数学 — 数值、随机、公式、作图
**> host_e**
## 数
- value
+ `value`
**> host_num value=`value`**
## 加
- a
- b
+ `a`
+ `b`
**> host_math_add a=`a` b=`b`**
## 减
- a
- b
+ `a`
+ `b`
**> host_math_sub a=`a` b=`b`**
## 乘
- a
- b
+ `a`
+ `b`
**> host_math_mul a=`a` b=`b`**
## 除
- a
- b
+ `a`
+ `b`
**> host_math_div a=`a` b=`b`**
## 幂
- a
- b
+ `a`
+ `b`
**> host_math_pow a=`a` b=`b`**
## 负
- value
+ `value`
**> host_math_neg value=`value`**
## 正弦
- value
+ `value`
**> host_math_sin value=`value`**
## 余弦
- value
+ `value`
**> host_math_cos value=`value`**
## 正切
- value
+ `value`
**> host_math_tan value=`value`**
## 反正弦
- value
+ `value`
**> host_math_asin value=`value`**
## 反余弦
- value
+ `value`
**> host_math_acos value=`value`**
## 反正切
- value
+ `value`
**> host_math_atan value=`value`**
## 平方根
- value
+ `value`
**> host_math_sqrt value=`value`**
## 绝对值
- value
+ `value`
**> host_math_abs value=`value`**
## 对数
- value
+ `value`
**> host_math_ln value=`value`**
## 指数
- value
+ `value`
**> host_math_exp value=`value`**
## 向下取整
- value
+ `value`
**> host_math_floor value=`value`**
## 向上取整
- value
+ `value`
**> host_math_ceil value=`value`**
## 最小
- a
- b
+ `a`
+ `b`
**> host_math_min a=`a` b=`b`**
## 最大
- a
- b
+ `a`
+ `b`
**> host_math_max a=`a` b=`b`**
@@ -128,73 +128,73 @@ description: 高中数学 — 数值、随机、公式、作图
**> host_random**
## 随机整数
- min
- max
+ `min`
+ `max`
**> host_random_int min=`min` max=`max`**
## 设种子
- value
+ `value`
**> host_seed value=`value`**
## 公式
- text
+ `text`
**> host_formula value=`text`**
## 化简
- formula
+ `formula`
**> host_simplify value=`formula`**
## 展开
- formula
+ `formula`
**> host_expand value=`formula`**
## 求导
- formula
- var
+ `formula`
+ `var`
**> host_diff formula=`formula` var=`var`**
## 代入
- formula
- var
- value
+ `formula`
+ `var`
+ `value`
**> host_subs formula=`formula` var=`var` value=`value`**
## 求值
- formula
- var
- value
+ `formula`
+ `var`
+ `value`
**> host_eval formula=`formula` var=`var` value=`value`**
## 求解
- formula
- var
+ `formula`
+ `var`
**> host_solve formula=`formula` var=`var`**
## 绘图
- formula
- var
- min
- max
+ `formula`
+ `var`
+ `min`
+ `max`
**> host_plot formula=`formula` var=`var` min=`min` max=`max`**
## 绘点列
- xs
- ys
+ `xs`
+ `ys`
**> host_plot_points xs=`xs` ys=`ys`**
## 绘圆锥
- kind
- a
+ `kind`
+ `a`
**> host_plot_conic kind=`kind` a=`a`**
+9 -9
View File
@@ -4,38 +4,38 @@ description: 中文文件系统包装
---
## 读文本
- 路径
+ `路径`
**> host_read_text path=`路径`**
## 写文本
- 路径
- 内容
+ `路径`
+ `内容`
**> host_write_text path=`路径` text=`内容`**
## 追加文本
- 路径
- 内容
+ `路径`
+ `内容`
**> host_append_text path=`路径` text=`内容`**
## 存在
- 路径
+ `路径`
**> host_exists path=`路径`**
## 列目录
- 路径
+ `路径`
**> host_list_dir path=`路径`**
## 建目录
- 路径
+ `路径`
**> host_make_dir path=`路径`**
## 删除
- 路径
+ `路径`
**> host_remove path=`路径`**
+5 -5
View File
@@ -4,18 +4,18 @@ description: 中文文本库:去空白 / 拆分 / 拼接
---
## 去空白
- s
+ `s`
**> trim `s`**
## 拆分
- s
- sep
+ `s`
+ `sep`
**> split value=`s` sep=`sep`**
## 拼接
- xs
- sep
+ `xs`
+ `sep`
**> join value=`xs` sep=`sep`**
+5 -5
View File
@@ -12,18 +12,18 @@ description: 中文时间包装
**> host_now_ms**
## 格式化
- 秒
- 格式
+ `秒`
+ `格式`
**> host_format_time unix=`秒` pattern=`格式`**
## 睡眠毫秒
- 毫秒
+ `毫秒`
**> host_sleep_ms ms=`毫秒`**
## 解析时间
- 内容
- 格式
+ `内容`
+ `格式`
**> host_parse_time text=`内容` pattern=`格式`**
+5 -5
View File
@@ -4,13 +4,13 @@ description: 中文系统包装(加载环境 可选 路径=)
---
## 取环境
- 名
+ `名`
**> host_env_get name=`名`**
## 设环境
- 名
- 值
+ `名`
+ `值`
**> host_env_set name=`名` value=`值`**
@@ -29,11 +29,11 @@ description: 中文系统包装(加载环境 可选 路径=)
**> host_cwd**
## 退出
- 码
+ `码`
**> host_exit code=`码`**
## 执行
- 命令
+ `命令`
**> host_exec cmd=`命令`**
+6 -6
View File
@@ -4,29 +4,29 @@ description: 中文 HTTP(S) 包装。可选 headers / content_type 经宿主别
---
## 获取
- 地址
+ `地址`
支持 HTTPS。可选具名实参 `headers=`(映射)。
**> host_http_get url=`地址`**
## 提交
- 地址
- 内容
+ `地址`
+ `内容`
默认 Content-Type 为 JSON。可选 `content_type=` / `headers=`。
**> host_http_post url=`地址` body=`内容`**
## 请求
- 方法
- 地址
+ `方法`
+ `地址`
可选 `body=` / `content_type=` / `headers=`。
**> host_http_request method=`方法` url=`地址`**
## 编码地址
- 内容
+ `内容`
**> host_url_encode text=`内容`**
+30
View File
@@ -0,0 +1,30 @@
---
title: lib/自写回
description: 将运行结果写回 .mq.md(Jupyter 式自写回)
---
## 写回
+ `值`
+ `末尾`=False
在入口文件中写入 `<!-- marqdo-out … -->`。默认在调用行下方插入或替换;`末尾=true` 时在文件末尾保留单块。
**> host_writeback_record value=`值` at_end=`末尾`**
## 取
+ `末尾`=False
读取当前调用处紧邻块,或 `末尾=true` 时读取文件末尾块。
**> host_writeback_get at_end=`末尾`**
## 清除
+ `末尾`=False
删除紧邻块或末尾块。
**> host_writeback_clear at_end=`末尾`**
## 列出
**> host_writeback_list**
+3 -3
View File
@@ -4,12 +4,12 @@ description: 中文表库:行数 / 取行
---
## 行数
- xs
+ `xs`
**> len `xs`**
## 取行
- xs
- i
+ `xs`
+ `i`
**> at value=`xs` index=`i`**