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.
834 B
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 调用下方。