Files
marqdo/examples/foreign-writeback/index.mq.md
T
cflmy 5acf026e0c docs(view): add a runnable foreign writeback example
Move persistence guidance out of the walkthrough into separate static pages. Add examples/foreign-writeback/index.mq.md, which executes a foreign code fence and writes a keyed total slot into its own source.
2026-10-18 13:45:27 +08:00

834 B


title: Foreign result writeback description: Execute a foreign code fence and persist the result into this .mq.md import foreign:lib/foreign.mq.md import writeback:lib/writeback.mq.md

main

This is a runnable example, not a screenshot. Run it with:

marqdo run examples/foreign-writeback/index.mq.md

The foreign fence below is a normal Marqdo code value. foreign.run executes it; writeback.record writes the result into a keyed output slot immediately below the call. Re-running replaces only the total slot.

合计代码 =

print(950)

结果 = > foreign.run code=合计代码

> writeback.record value=结果 key="total"

The keyed slot below is generated by the run:

查看源码,确认 total 槽位就在这次 writeback 调用下方。