Welcome to Marqdook
文档
怎样读这份可执行文档
正文说明意图,标记指出哪些片段会执行。遮蔽只在正文显示动作说明,实际逻辑放在侧注;阅读、展开与定位都不会运行代码。
| 标记 | 阅读含义 |
|---|---|
无标记文字 | 作者的解释,按普通 Markdown 阅读。 |
空行 | 分隔叙述与结构,不是计算步骤。 |
# / ## | 一级标题声明对象或入口,更深标题声明函数;说明按钮可查看输入、返回与依据。 |
> | 调用函数;实际执行结果另有标注。 |
1. 递增 | 按条件选择分支,不是普通编号说明。 |
- | 重复或遍历结构;迭代选择器只切换已有运行记录。 |
+ `名` | 兼容的显式形参;新库优先在叙述中声明参数,标题下的表格解释契约。 |
GFM 表 | 未绑定的契约表是说明;绑定表按列、行和 @ 形态构成数据。 |
```lang | 代码块;绑定的外语代码与普通示例区分展示,数学公式另有公式卡片。 |
--- / *** | 分隔内容,不能把分隔线当作函数返回。 |
<!-- marqdo-out --> | 程序写回的结果,区别于作者原始正文。 |
`名` | 叙述中的参数或变量;默认值跟在名称之后。 |
**…** | 执行语句:赋值、调用或计算;不是打印,也不是返回。 |
*…* | 返回表达式;句中以返回、Return 等明确引出。 |
*None* / **** | 显式返回空值或结束当前函数。 |
[键](集合) | 正文显示描述,侧注按函数与参数、可跳转链接、结构化内容展示括号内的细节;空括号表示待补充实际逻辑。阅读不会执行调用。classic 模式保留旧链接取元。 |
修饰… [函数] … | 兼容的带修饰调用;不能把任意普通链接当作执行授权。 |
集合[^键] | 兼容的脚注取元;当前库优先用 access 读取集合。 |
*仅* / **说明** | 普通强调仍属于文字;界面按真实解析结果区分强调、语句与返回。 |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
Hello — and welcome. I built Marqdo so that code is documentation and documentation is code: Markdown markers are the program structure, so what you read is what runs.
AI systems already favor Markdown-shaped output. That raised a simple question: why keep docs and programs as two separate artifacts? Marqdo is the answer. The .mq.md suffix exists so a file stays renderable as Markdown while remaining executable. Richer OKF-style YAML catalogs and even slide decks are on the roadmap; for now this site itself is generated by Marqdo — and that often saves tokens when an AI is writing with you.
The language is still early: structural markers, English/Chinese builtin aliases (print / 打印 …), an importable standard library (see stdlib/ on this site), local view, and static export. Join in at GitHub.
跳转链接stdlib/
原始写法
stdlib/跳转链接GitHub
原始写法
https://github.com/cflmy/marqdo中文文档请看同目录的 00-欢迎.mq.md(叙述与内置均用中文)。
跳转链接00-欢迎.mq.md
原始写法
00-欢迎.mq.mdmarqdo run executes the entry # main. Try greet who="marqdo". Names can include spaces: greet who="marqdo user".This version also runs one function on its own. marqdo call takes the file, the function and named arguments. The page you read is the program that runs. What that is for, and why it matters, is in features/22-call.mq.md.
跳转链接features/22-call.mq.md
原始写法
features/22-call.mq.mdBeyond the basics, Marqdo ships table, time, text, files, system, math, foreign, and more. Math and foreign deserve a special mention.
Write a math block and bind it with a TeX comment:
Foreign lets you embed another language. Use Node Intl for locale-aware currency formatting, a genuine presentation boundary:
console.log(new Intl.NumberFormat("zh-CN", {style:"currency", currency:"CNY"}).format(950));
¥950.00 — 40ms
Under Markdown this stays easy to read — which is the point: code as documentation, documentation as code.
One file, three surfaces.
| Surface | What it is |
|---|---|
| Document | ordinary Markdown: prose, tables, links and fenced code |
| Program | the same markers are executable: assignments, calls, returns |
| Knowledge | frontmatter, links and generated catalog entries an agent can query |
The static site you are reading is generated from these files, so the examples are not screenshots. Run the same source and you get the same page.
Foreign v2 is a good example. Probe Node, then run the bound fence:
函数调用Check the formatting runtime
foreign.probe- lang
- node
原始写法
foreign.probe(lang="node")函数调用ok
源码说明 · 不是运行结果access- 参数 1
`node`- 参数 2
- ok
原始写法
access(`node`, "ok")We first hello = for the next step.函数调用Format the native amount
源码说明 · 不是运行结果foreign.run- code
`hi`
原始写法
foreign.run(code=`hi`)We now .函数调用Display this step's result
源码说明 · 不是运行结果print- text
`hello`
原始写法
> print text=`hello`- elseWe now .
函数调用Display this step's result
源码说明 · 不是运行结果print- text
- (node not found — install Node to run this cell)
原始写法
> print text="(node not found — install Node to run this cell)"
The same module also supports JSON calls, parallel fan-out, persistent kernels and an explicit state bridge. See stdlib/foreign.mq.md and the native-first Intl walkthrough in features/19-foreign-view-cells.mq.md.
跳转链接stdlib/foreign.mq.md
原始写法
stdlib/foreign.mq.md跳转链接features/19-foreign-view-cells.mq.md
原始写法
features/19-foreign-view-cells.mq.mdA view document is still a document. Named kernels and a cell order are ordinary bound tables:
`分析内核` =
| 名称 | 语言 | 说明 |
|------|------|------|
| 分析 | node | shared state |
| 复核 | node | isolated state |
`分析单元` =
| 单元 | 内核 | 说明 |
|------|------|------|
| 准备数据 | 分析 | write |
| 计算指标 | 分析 | read |
| 独立复核 | 复核 | validate |
`会话` = > foreign.session kernels=`分析内核` cells=`分析单元`
marqdo view consumes the foreign-owned 会话 handle and turns it into Run All, Step, per-cell kernels, a journal and a state panel. Without 会话, cells are stateless one-shot runs. There is no separate interactive mode or command; marqdo run still executes the file as one program.
Documentation becomes knowledge when it can be discovered, verified and reused. OKF supplies the portable Markdown + YAML shape; EKC projects the repository into catalog layers L0–L4, a graph and an engineering preflight. The source .mq.md remains the only authority; generated artifacts are marked and rebuildable.
| Loop | Question |
|---|---|
| OKF | How do people and agents share a readable knowledge page? |
| EKC | What existing capability, decision, constraint or failure should be reused before creating more? |
| Preflight | REUSE → ADAPT → CREATE |
Read features/20-okf-ekc.mq.md for the concepts and commands.
跳转链接features/20-okf-ekc.mq.md
原始写法
features/20-okf-ekc.mq.mdWelcome again — enjoy exploring Marqdo.
Installation choices.
Install the interpreter (CLI) in any of these ways:
| Way | Notes |
|---|---|
| Ubuntu PPA | sudo add-apt-repository ppa:cflmy/marqdo then sudo apt install marqdo |
| GitHub Releases | Prebuilt Windows / Linux packages from releases |
| From source | cargo build --release (needs a local Rust toolchain) |
跳转链接releases
原始写法
https://github.com/cflmy/marqdo/releasesOfficial extensions update independently of the CLI:
marqdo ext add web
marqdo ext add quantum
ext add tries CDN https://ext.marqdo.com first, then GitHub, then the proxy mirror. See features/05-extensions.mq.md.
跳转链接features/05-extensions.mq.md
原始写法
features/05-extensions.mq.md| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| who | any | required | Recipient name inserted into the greeting |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; this function performs the described effects instead of returning business data |
Variables
-
_svg text<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 520 360" width="520" height="360" role="img" aria-label="function plot"> <defs> <marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"> <path d="M 0 0 L 10 5 L 0 10 z" fill="#4b5563"/> </marker> </defs> <style> .grid { stroke: #e5e7eb; stroke-width: 1; } .axis { stroke: #4b5563; stroke-width: 1.5; } .tick { stroke: #4b5563; stroke-width: 1; } .curve { fill: none; stroke: #1f6feb; stroke-width: 2; } .pt { fill: #1f6feb; } .axis-label { font: 12px ui-sans-serif, system-ui, sans-serif; fill: #374151; font-weight: 600; } .tick-label { font: 10px ui-sans-serif, system-ui, sans-serif; fill: #6b7280; } </style> <line x1="36.00" y1="36" x2="36.00" y2="324" class="grid"/><line x1="110.67" y1="36" x2="110.67" y2="324" class="grid"/><line x1="185.33" y1="36" x2="185.33" y2="324" class="grid"/><line x1="260.00" y1="36" x2="260.00" y2="324" class="grid"/><line x1="334.67" y1="36" x2="334.67" y2="324" class="grid"/><line x1="409.33" y1="36" x2="409.33" y2="324" class="grid"/><line x1="484.00" y1="36" x2="484.00" y2="324" class="grid"/><line x1="36" y1="310.91" x2="484" y2="310.91" class="grid"/><line x1="36" y1="252.73" x2="484" y2="252.73" class="grid"/><line x1="36" y1="194.55" x2="484" y2="194.55" class="grid"/><line x1="36" y1="136.36" x2="484" y2="136.36" class="grid"/><line x1="36" y1="78.18" x2="484" y2="78.18" class="grid"/><line x1="36" y1="252.73" x2="484" y2="252.73" class="axis" marker-end="url(#arrow)"/><line x1="260.00" y1="324" x2="260.00" y2="36" class="axis" marker-end="url(#arrow)"/><text x="488.00" y="256.73" class="axis-label">x</text><text x="266.00" y="40.00" class="axis-label">y</text><line x1="36.00" y1="248.73" x2="36.00" y2="256.73" class="tick"/><text x="36.00" y="266.73" text-anchor="middle" class="tick-label">-3</text><line x1="110.67" y1="248.73" x2="110.67" y2="256.73" class="tick"/><text x="110.67" y="266.73" text-anchor="middle" class="tick-label">-2</text><line x1="185.33" y1="248.73" x2="185.33" y2="256.73" class="tick"/><text x="185.33" y="266.73" text-anchor="middle" class="tick-label">-1</text><line x1="334.67" y1="248.73" x2="334.67" y2="256.73" class="tick"/><text x="334.67" y="266.73" text-anchor="middle" class="tick-label">1</text><line x1="409.33" y1="248.73" x2="409.33" y2="256.73" class="tick"/><text x="409.33" y="266.73" text-anchor="middle" class="tick-label">2</text><line x1="484.00" y1="248.73" x2="484.00" y2="256.73" class="tick"/><text x="484.00" y="266.73" text-anchor="middle" class="tick-label">3</text><line x1="256.00" y1="310.91" x2="264.00" y2="310.91" class="tick"/><text x="252.00" y="310.91" text-anchor="end" dominant-baseline="middle" class="tick-label">-2</text><line x1="256.00" y1="194.55" x2="264.00" y2="194.55" class="tick"/><text x="252.00" y="194.55" text-anchor="end" dominant-baseline="middle" class="tick-label">2</text><line x1="256.00" y1="136.36" x2="264.00" y2="136.36" class="tick"/><text x="252.00" y="136.36" text-anchor="end" dominant-baseline="middle" class="tick-label">4</text><line x1="256.00" y1="78.18" x2="264.00" y2="78.18" class="tick"/><text x="252.00" y="78.18" text-anchor="end" dominant-baseline="middle" class="tick-label">6</text><text x="252.00" y="266.73" class="tick-label">0</text><path d="M 36.00 49.09 L 38.24 54.30 L 40.48 59.46 L 42.72 64.56 L 44.96 69.62 L 47.20 74.62 L 49.44 79.57 L 51.68 84.46 L 53.92 89.31 L 56.16 94.10 L 58.40 98.84 L 60.64 103.52 L 62.88 108.16 L 65.12 112.74 L 67.36 117.27 L 69.60 121.75 L 71.84 126.17 L 74.08 130.54 L 76.32 134.86 L 78.56 139.13 L 80.80 143.35 L 83.04 147.51 L 85.28 151.62 L 87.52 155.68 L 89.76 159.68 L 92.00 163.64 L 94.24 167.54 L 96.48 171.39 L 98.72 175.18 L 100.96 178.93 L 103.20 182.62 L 105.44 186.26 L 107.68 189.84 L 109.92 193.38 L 112.16 196.86 L 114.40 200.29 L 116.64 203.67 L 118.88 206.99 L 121.12 210.27 L 123.36 213.49 L 125.60 216.65 L 127.84 219.77 L 130.08 222.83 L 132.32 225.84 L 134.56 228.80 L 136.80 231.71 L 139.04 234.56 L 141.28 237.36 L 143.52 240.11 L 145.76 242.81 L 148.00 245.45 L 150.24 248.05 L 152.48 250.59 L 154.72 253.07 L 156.96 255.51 L 159.20 257.89 L 161.44 260.22 L 163.68 262.50 L 165.92 264.72 L 168.16 266.90 L 170.40 269.02 L 172.64 271.09 L 174.88 273.10 L 177.12 275.07 L 179.36 276.98 L 181.60 278.84 L 183.84 280.64 L 186.08 282.40 L 188.32 284.10 L 190.56 285.75 L 192.80 287.35 L 195.04 288.89 L 197.28 290.38 L 199.52 291.82 L 201.76 293.21 L 204.00 294.55 L 206.24 295.83 L 208.48 297.06 L 210.72 298.24 L 212.96 299.36 L 215.20 300.44 L 217.44 301.46 L 219.68 302.43 L 221.92 303.34 L 224.16 304.21 L 226.40 305.02 L 228.64 305.78 L 230.88 306.48 L 233.12 307.14 L 235.36 307.74 L 237.60 308.29 L 239.84 308.79 L 242.08 309.23 L 244.32 309.63 L 246.56 309.97 L 248.80 310.25 L 251.04 310.49 L 253.28 310.67 L 255.52 310.80 L 257.76 310.88 L 260.00 310.91 L 262.24 310.88 L 264.48 310.80 L 266.72 310.67 L 268.96 310.49 L 271.20 310.25 L 273.44 309.97 L 275.68 309.63 L 277.92 309.23 L 280.16 308.79 L 282.40 308.29 L 284.64 307.74 L 286.88 307.14 L 289.12 306.48 L 291.36 305.78 L 293.60 305.02 L 295.84 304.21 L 298.08 303.34 L 300.32 302.43 L 302.56 301.46 L 304.80 300.44 L 307.04 299.36 L 309.28 298.24 L 311.52 297.06 L 313.76 295.83 L 316.00 294.55 L 318.24 293.21 L 320.48 291.82 L 322.72 290.38 L 324.96 288.89 L 327.20 287.35 L 329.44 285.75 L 331.68 284.10 L 333.92 282.40 L 336.16 280.64 L 338.40 278.84 L 340.64 276.98 L 342.88 275.07 L 345.12 273.10 L 347.36 271.09 L 349.60 269.02 L 351.84 266.90 L 354.08 264.72 L 356.32 262.50 L 358.56 260.22 L 360.80 257.89 L 363.04 255.51 L 365.28 253.07 L 367.52 250.59 L 369.76 248.05 L 372.00 245.45 L 374.24 242.81 L 376.48 240.11 L 378.72 237.36 L 380.96 234.56 L 383.20 231.71 L 385.44 228.80 L 387.68 225.84 L 389.92 222.83 L 392.16 219.77 L 394.40 216.65 L 396.64 213.49 L 398.88 210.27 L 401.12 206.99 L 403.36 203.67 L 405.60 200.29 L 407.84 196.86 L 410.08 193.38 L 412.32 189.84 L 414.56 186.26 L 416.80 182.62 L 419.04 178.93 L 421.28 175.18 L 423.52 171.39 L 425.76 167.54 L 428.00 163.64 L 430.24 159.68 L 432.48 155.68 L 434.72 151.62 L 436.96 147.51 L 439.20 143.35 L 441.44 139.13 L 443.68 134.86 L 445.92 130.54 L 448.16 126.17 L 450.40 121.75 L 452.64 117.27 L 454.88 112.74 L 457.12 108.16 L 459.36 103.52 L 461.60 98.84 L 463.84 94.10 L 466.08 89.31 L 468.32 84.46 L 470.56 79.57 L 472.80 74.62 L 475.04 69.62 L 477.28 64.56 L 479.52 59.46 L 481.76 54.30 L 484.00 49.09" class="curve"/> </svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 520 360" width="520" height="360" role="img" aria-label="function plot"> <defs> <marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"> <path d="M 0 0 L 10 5 L 0 10 z" fill="#4b5563"/> </marker> </defs> <style> .grid { stroke: #e5e7eb; stroke-width: 1; } .axis { stroke: #4b5563; stroke-width: 1.5; } .tick { stroke: #4b5563; stroke-width: 1; } .curve { fill: none; stroke: #1f6feb; stroke-width: 2; } .pt { fill: #1f6feb; } .axis-label { font: 12px ui-sans-serif, system-ui, sans-serif; fill: #374151; font-weight: 600; } .tick-label { font: 10px ui-sans-serif, system-ui, sans-serif; fill: #6b7280; } </style> <line x1="36.00" y1="36" x2="36.00" y2="324" class="grid"/><line x1="110.67" y1="36" x2="110.67" y2="324" class="grid"/><line x1="185.33" y1="36" x2="185.33" y2="324" class="grid"/><line x1="260.00" y1="36" x2="260.00" y2="324" class="grid"/><line x1="334.67" y1="36" x2="334.67" y2="324" class="grid"/><line x1="409.33" y1="36" x2="409.33" y2="324" class="grid"/><line x1="484.00" y1="36" x2="484.00" y2="324" class="grid"/><line x1="36" y1="310.91" x2="484" y2="310.91" class="grid"/><line x1="36" y1="252.73" x2="484" y2="252.73" class="grid"/><line x1="36" y1="194.55" x2="484" y2="194.55" class="grid"/><line x1="36" y1="136.36" x2="484" y2="136.36" class="grid"/><line x1="36" y1="78.18" x2="484" y2="78.18" class="grid"/><line x1="36" y1="252.73" x2="484" y2="252.73" class="axis" marker-end="url(#arrow)"/><line x1="260.00" y1="324" x2="260.00" y2="36" class="axis" marker-end="url(#arrow)"/><text x="488.00" y="256.73" class="axis-label">x</text><text x="266.00" y="40.00" class="axis-label">y</text><line x1="36.00" y1="248.73" x2="36.00" y2="256.73" class="tick"/><text x="36.00" y="266.73" text-anchor="middle" class="tick-label">-3</text><line x1="110.67" y1="248.73" x2="110.67" y2="256.73" class="tick"/><text x="110.67" y="266.73" text-anchor="middle" class="tick-label">-2</text><line x1="185.33" y1="248.73" x2="185.33" y2="256.73" class="tick"/><text x="185.33" y="266.73" text-anchor="middle" class="tick-label">-1</text><line x1="334.67" y1="248.73" x2="334.67" y2="256.73" class="tick"/><text x="334.67" y="266.73" text-anchor="middle" class="tick-label">1</text><line x1="409.33" y1="248.73" x2="409.33" y2="256.73" class="tick"/><text x="409.33" y="266.73" text-anchor="middle" class="tick-label">2</text><line x1="484.00" y1="248.73" x2="484.00" y2="256.73" class="tick"/><text x="484.00" y="266.73" text-anchor="middle" class="tick-label">3</text><line x1="256.00" y1="310.91" x2="264.00" y2="310.91" class="tick"/><text x="252.00" y="310.91" text-anchor="end" dominant-baseline="middle" class="tick-label">-2</text><line x1="256.00" y1="194.55" x2="264.00" y2="194.55" class="tick"/><text x="252.00" y="194.55" text-anchor="end" dominant-baseline="middle" class="tick-label">2</text><line x1="256.00" y1="136.36" x2="264.00" y2="136.36" class="tick"/><text x="252.00" y="136.36" text-anchor="end" dominant-baseline="middle" class="tick-label">4</text><line x1="256.00" y1="78.18" x2="264.00" y2="78.18" class="tick"/><text x="252.00" y="78.18" text-anchor="end" dominant-baseline="middle" class="tick-label">6</text><text x="252.00" y="266.73" class="tick-label">0</text><path d="M 36.00 49.09 L 38.24 54.30 L 40.48 59.46 L 42.72 64.56 L 44.96 69.62 L 47.20 74.62 L 49.44 79.57 L 51.68 84.46 L 53.92 89.31 L 56.16 94.10 L 58.40 98.84 L 60.64 103.52 L 62.88 108.16 L 65.12 112.74 L 67.36 117.27 L 69.60 121.75 L 71.84 126.17 L 74.08 130.54 L 76.32 134.86 L 78.56 139.13 L 80.80 143.35 L 83.04 147.51 L 85.28 151.62 L 87.52 155.68 L 89.76 159.68 L 92.00 163.64 L 94.24 167.54 L 96.48 171.39 L 98.72 175.18 L 100.96 178.93 L 103.20 182.62 L 105.44 186.26 L 107.68 189.84 L 109.92 193.38 L 112.16 196.86 L 114.40 200.29 L 116.64 203.67 L 118.88 206.99 L 121.12 210.27 L 123.36 213.49 L 125.60 216.65 L 127.84 219.77 L 130.08 222.83 L 132.32 225.84 L 134.56 228.80 L 136.80 231.71 L 139.04 234.56 L 141.28 237.36 L 143.52 240.11 L 145.76 242.81 L 148.00 245.45 L 150.24 248.05 L 152.48 250.59 L 154.72 253.07 L 156.96 255.51 L 159.20 257.89 L 161.44 260.22 L 163.68 262.50 L 165.92 264.72 L 168.16 266.90 L 170.40 269.02 L 172.64 271.09 L 174.88 273.10 L 177.12 275.07 L 179.36 276.98 L 181.60 278.84 L 183.84 280.64 L 186.08 282.40 L 188.32 284.10 L 190.56 285.75 L 192.80 287.35 L 195.04 288.89 L 197.28 290.38 L 199.52 291.82 L 201.76 293.21 L 204.00 294.55 L 206.24 295.83 L 208.48 297.06 L 210.72 298.24 L 212.96 299.36 L 215.20 300.44 L 217.44 301.46 L 219.68 302.43 L 221.92 303.34 L 224.16 304.21 L 226.40 305.02 L 228.64 305.78 L 230.88 306.48 L 233.12 307.14 L 235.36 307.74 L 237.60 308.29 L 239.84 308.79 L 242.08 309.23 L 244.32 309.63 L 246.56 309.97 L 248.80 310.25 L 251.04 310.49 L 253.28 310.67 L 255.52 310.80 L 257.76 310.88 L 260.00 310.91 L 262.24 310.88 L 264.48 310.80 L 266.72 310.67 L 268.96 310.49 L 271.20 310.25 L 273.44 309.97 L 275.68 309.63 L 277.92 309.23 L 280.16 308.79 L 282.40 308.29 L 284.64 307.74 L 286.88 307.14 L 289.12 306.48 L 291.36 305.78 L 293.60 305.02 L 295.84 304.21 L 298.08 303.34 L 300.32 302.43 L 302.56 301.46 L 304.80 300.44 L 307.04 299.36 L 309.28 298.24 L 311.52 297.06 L 313.76 295.83 L 316.00 294.55 L 318.24 293.21 L 320.48 291.82 L 322.72 290.38 L 324.96 288.89 L 327.20 287.35 L 329.44 285.75 L 331.68 284.10 L 333.92 282.40 L 336.16 280.64 L 338.40 278.84 L 340.64 276.98 L 342.88 275.07 L 345.12 273.10 L 347.36 271.09 L 349.60 269.02 L 351.84 266.90 L 354.08 264.72 L 356.32 262.50 L 358.56 260.22 L 360.80 257.89 L 363.04 255.51 L 365.28 253.07 L 367.52 250.59 L 369.76 248.05 L 372.00 245.45 L 374.24 242.81 L 376.48 240.11 L 378.72 237.36 L 380.96 234.56 L 383.20 231.71 L 385.44 228.80 L 387.68 225.84 L 389.92 222.83 L 392.16 219.77 L 394.40 216.65 L 396.64 213.49 L 398.88 210.27 L 401.12 206.99 L 403.36 203.67 L 405.60 200.29 L 407.84 196.86 L 410.08 193.38 L 412.32 189.84 L 414.56 186.26 L 416.80 182.62 L 419.04 178.93 L 421.28 175.18 L 423.52 171.39 L 425.76 167.54 L 428.00 163.64 L 430.24 159.68 L 432.48 155.68 L 434.72 151.62 L 436.96 147.51 L 439.20 143.35 L 441.44 139.13 L 443.68 134.86 L 445.92 130.54 L 448.16 126.17 L 450.40 121.75 L 452.64 117.27 L 454.88 112.74 L 457.12 108.16 L 459.36 103.52 L 461.60 98.84 L 463.84 94.10 L 466.08 89.31 L 468.32 84.46 L 470.56 79.57 L 472.80 74.62 L 475.04 69.62 L 477.28 64.56 L 479.52 59.46 L 481.76 54.30 L 484.00 49.09" class="curve"/> </svg>
-
description textUser-docs home — code as documentation (English)User-docs home — code as documentation (English)
-
f formula$$x^{2} - 2$$$$x^{2} - 2$$
-
hello text¥950.00¥950.00
-
hi code · node```node console.log(new Intl.NumberFormat("zh-CN", {style:"currency", currency:"CNY"}).format(950)); ``````node console.log(new Intl.NumberFormat("zh-CN", {style:"currency", currency:"CNY"}).format(950)); ```
-
markup textocclusionocclusion
-
node map · 6
lang node cmd node -v path /usr/local/bin/node ok True version v24.22.3 error key value lang node cmd node -v path /usr/local/bin/node ok True version v24.22.3 error -
title textWelcome to MarqdoWelcome to Marqdo
可执行知识 · 输入、返回与依据
这份文档怎样成为可调用的知识
2 个知识单元 · 20 个结构步骤。先读输入、返回与调用边界,再按需查看依赖和依据。
以下来自静态分析,不代表程序已经运行、测试通过或内容已获领域确认。实际运行见正文标注与“运行与结果”。
main程序入口
这是程序入口或对象声明。成员函数的输入输出在各自说明中列出。
源码中的返回契约
any · None; execute this page's documented steps in order and observe their output or stated effects
调用边界
输出文本、启动进程。权限由实际运行入口授予;静态副作用信息不等于运行许可。
依赖哪些知识
当前有哪些依据
- 语法与引用
- 检查通过;检查通过
- 契约检查
- 尚未检查
- 测试记录
- 没有可用记录
- 内容来源
- 尚无已核验证据
- 领域审阅
- 尚未进行领域审阅
查看本单元的结构步骤
这是源码结构,不是实际执行时序;正文引用不会因阅读而执行。
- 调用greet
- navigation`00-欢迎.mq.md`
- navigationfeatures/22-call.mq.md
- 正文引用Check the formatting runtime
- 正文引用Format the native amount
- 正文引用Display this step's result
- 正文引用Display this step's result
- navigationstdlib/foreign.mq.md
- navigationfeatures/19-foreign-view-cells.mq.md
- navigationfeatures/20-okf-ekc.mq.md
- navigation`features/05-extensions.mq.md`
- 调用greet
- 调用Check the formatting runtime
- 调用Format the native amount
- 调用Display this step's result
- 调用Display this step's result
- navigation`stdlib/`
- navigationGitHub
技术详情:身份、摘要与原始状态
- 目标标识
mq://public/00-welcome/type/main- 制品摘要(未检查锁定状态)
sha256:361fffe63f087fd80ba0afdf4383a04ac18f600b0a037ad1a184c2d31f3aa7bd- 依赖标识
mq://public/00-welcome/function/main/greet- 原始验证状态
parse: passed; resolve: passed; contract: unchecked; execution: not_run; tests: unknown; evidence: unverified; domain: unreviewed
main.greet函数
需要什么输入
| 参数 | 类型 | 提供方式 | 含义 |
|---|---|---|---|
who | any | 必填 | Recipient name inserted into the greeting |
返回什么
any · None; this function performs the described effects instead of returning business data
调用边界
输出文本。权限由实际运行入口授予;静态副作用信息不等于运行许可。
当前有哪些依据
- 语法与引用
- 检查通过;检查通过
- 契约检查
- 尚未检查
- 测试记录
- 没有可用记录
- 内容来源
- 尚无已核验证据
- 领域审阅
- 尚未进行领域审阅
技术详情:身份、摘要与原始状态
- 目标标识
mq://public/00-welcome/function/main/greet- 制品摘要(未检查锁定状态)
sha256:464de2f88e46c4cc2c84286a541a554f5b34300f938b770134d476c7bf22663e- 依赖标识
- 原始验证状态
parse: passed; resolve: passed; contract: unchecked; execution: not_run; tests: unknown; evidence: unverified; domain: unreviewed
运行与结果
完整源码
---
markup: occlusion
title: Welcome to Marqdo
description: User-docs home — code as documentation (English)
import:
math: lib/math.mq.md
foreign: lib/foreign.mq.md
---
# main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |
Hello — and welcome. I built Marqdo so that code is documentation and documentation is code: Markdown markers are the program structure, so what you read is what runs.
AI systems already favor Markdown-shaped output. That raised a simple question: why keep docs and programs as two separate artifacts? Marqdo is the answer. The `.mq.md` suffix exists so a file stays renderable as Markdown while remaining executable. Richer OKF-style YAML catalogs and even slide decks are on the roadmap; for now this site itself is generated by Marqdo — and that often saves tokens when an AI is writing with you.
The language is still early: structural markers, English/Chinese builtin aliases (`print` / `打印` …), an importable standard library (see [`stdlib/`](stdlib/) on this site), local `view`, and static export. Join in at [GitHub](https://github.com/cflmy/marqdo).
中文文档请看同目录的 [`00-欢迎.mq.md`](00-欢迎.mq.md)(叙述与内置均用中文)。
Want a quick hello? `marqdo run` executes the entry `# main`. Try **greet who="marqdo"**. Names can include spaces: **greet who="marqdo user"**.
This version also runs one function on its own. `marqdo call` takes the file, the function and named arguments. The page you read is the program that runs. What that is for, and why it matters, is in [features/22-call.mq.md](features/22-call.mq.md).
Beyond the basics, Marqdo ships table, time, text, files, system, math, foreign, and more. Math and foreign deserve a special mention.
Write a math block and bind it with a TeX comment:
$$
% marqdo: var=f
x^2 - 2
$$
Then plot it: **_svg = math.plot formula=`f` var="x" min=-3 max=3**
Foreign lets you embed another language. Use Node Intl for locale-aware currency formatting, a genuine presentation boundary:
`hi` =
```node
console.log(new Intl.NumberFormat("zh-CN", {style:"currency", currency:"CNY"}).format(950));
```
Under Markdown this stays easy to read — which is the point: code as documentation, documentation as code.
One file, three surfaces.
| Surface | What it is |
|---|---|
| Document | ordinary Markdown: prose, tables, links and fenced code |
| Program | the same markers are executable: assignments, calls, returns |
| Knowledge | frontmatter, links and generated catalog entries an agent can query |
The static site you are reading is generated from these files, so the examples are not screenshots. Run the same source and you get the same page.
Foreign v2 is a good example. Probe Node, then run the bound fence:
We first **node = [Check the formatting runtime](foreign.probe(lang="node"))** for the next step.
1. [ok](access(`node`, "ok"))
We first **hello = [Format the native amount](foreign.run(code=`hi`))** for the next step.
We now **[Display this step's result](> print text=`hello`)**.
2. *
We now **[Display this step's result](> print text="(node not found — install Node to run this cell)")**.
The same module also supports JSON calls, parallel fan-out, persistent kernels and an explicit state bridge. See [stdlib/foreign.mq.md](stdlib/foreign.mq.md) and the native-first Intl walkthrough in [features/19-foreign-view-cells.mq.md](features/19-foreign-view-cells.mq.md).
A view document is still a document. Named kernels and a cell order are ordinary bound tables:
```text
`分析内核` =
| 名称 | 语言 | 说明 |
|------|------|------|
| 分析 | node | shared state |
| 复核 | node | isolated state |
`分析单元` =
| 单元 | 内核 | 说明 |
|------|------|------|
| 准备数据 | 分析 | write |
| 计算指标 | 分析 | read |
| 独立复核 | 复核 | validate |
`会话` = > foreign.session kernels=`分析内核` cells=`分析单元`
```
`marqdo view` consumes the foreign-owned `会话` handle and turns it into Run All, Step, per-cell kernels, a journal and a state panel. Without `会话`, cells are stateless one-shot runs. There is no separate interactive mode or command; `marqdo run` still executes the file as one program.
Documentation becomes knowledge when it can be discovered, verified and reused. OKF supplies the portable Markdown + YAML shape; EKC projects the repository into catalog layers L0–L4, a graph and an engineering preflight. The source `.mq.md` remains the only authority; generated artifacts are marked and rebuildable.
| Loop | Question |
|---|---|
| OKF | How do people and agents share a readable knowledge page? |
| EKC | What existing capability, decision, constraint or failure should be reused before creating more? |
| Preflight | REUSE → ADAPT → CREATE |
Read [features/20-okf-ekc.mq.md](features/20-okf-ekc.mq.md) for the concepts and commands.
Welcome again — enjoy exploring Marqdo.
Installation choices.
Install the interpreter (CLI) in any of these ways:
| Way | Notes |
|------|------|
| Ubuntu PPA | sudo add-apt-repository ppa:cflmy/marqdo then sudo apt install marqdo |
| GitHub Releases | Prebuilt Windows / Linux packages from [releases](https://github.com/cflmy/marqdo/releases) |
| From source | cargo build --release (needs a local Rust toolchain) |
Official extensions update independently of the CLI:
```text
marqdo ext add web
marqdo ext add quantum
```
`ext add` tries CDN https://ext.marqdo.com first, then GitHub, then the proxy mirror. See [`features/05-extensions.mq.md`](features/05-extensions.mq.md).
## greet
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| who | any | required | Recipient name inserted into the greeting |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; this function performs the described effects instead of returning business data |
When we meet a visitor `who`, we **print text="Welcome, `who`!"** and close with*None*.