From 2a13e529813ac7ea6afa4c308c6694af21b31457 Mon Sep 17 00:00:00 2001 From: cflmy Date: Sun, 18 Oct 2026 13:35:51 +0800 Subject: [PATCH] docs(view): show low-level session evaluation as code fences Replace inline source strings with readable Python code fences bound as Marqdo code values. The low-level session evaluates those values; no long escaped source argument remains. --- public/features/19-foreign-view-cells.mq.md | 21 ++++++++++++++++++--- public/features/19-外联视图单元.mq.md | 21 ++++++++++++++++++--- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/public/features/19-foreign-view-cells.mq.md b/public/features/19-foreign-view-cells.mq.md index 09dc45c..5fcbfa4 100644 --- a/public/features/19-foreign-view-cells.mq.md +++ b/public/features/19-foreign-view-cells.mq.md @@ -38,7 +38,12 @@ The `订单` table is a normal Marqdo value. `foreign.session_set` copies it int **> foreign.session_set id=`内核会话` name="orders" value=`订单`** -**total = > foreign.session_eval id=`内核会话` source="round(sum(float(row['金额']) for row in orders), 2)"** +`total_code` = +```python +round(sum(float(row["金额"]) for row in orders), 2) +``` + +**total = > foreign.session_eval id=`内核会话` code=`total_code`** > print text=[result](`total`) @@ -50,9 +55,19 @@ Kernel state persists. Two evaluations share the same kernel. The second sees the first variable. -**> foreign.session_eval id=`内核会话` source="values = [3, 4, 5]"** +`set_values_code` = +```python +values = [3, 4, 5] +``` -**square_sum = > foreign.session_eval id=`内核会话` source="sum(value * value for value in values)"** +**> foreign.session_eval id=`内核会话` code=`set_values_code`** + +`square_sum_code` = +```python +sum(value * value for value in values) +``` + +**square_sum = > foreign.session_eval id=`内核会话` code=`square_sum_code`** > print text=[result](`square_sum`) diff --git a/public/features/19-外联视图单元.mq.md b/public/features/19-外联视图单元.mq.md index 1c476d1..d526a8b 100644 --- a/public/features/19-外联视图单元.mq.md +++ b/public/features/19-外联视图单元.mq.md @@ -38,7 +38,12 @@ Marqdo 值进入内核。 **> 外联.会话设值 标识=`内核会话` 名称="orders" 值=`订单`** -**合计 = > 外联.会话求值 标识=`内核会话` 源码="round(sum(float(row['金额']) for row in orders), 2)"** +`合计代码` = +```python +round(sum(float(row["金额"]) for row in orders), 2) +``` + +**合计 = > 外联.会话求值 标识=`内核会话` 代码=`合计代码`** > 打印 内容=[result](`合计`) @@ -50,9 +55,19 @@ Marqdo 值进入内核。 两次求值共享同一个内核。第二次能看到第一次创建的变量。 -**> 外联.会话求值 标识=`内核会话` 源码="values = [3, 4, 5]"** +`设值代码` = +```python +values = [3, 4, 5] +``` -**平方和 = > 外联.会话求值 标识=`内核会话` 源码="sum(value * value for value in values)"** +**> 外联.会话求值 标识=`内核会话` 代码=`设值代码`** + +`平方和代码` = +```python +sum(value * value for value in values) +``` + +**平方和 = > 外联.会话求值 标识=`内核会话` 代码=`平方和代码`** > 打印 内容=[result](`平方和`)