1// Package wiki is a Wikipedia-shaped wiki engine for gno.land: namespaced2// titles, an append-only revision chain, wikilinks with backlinks, categories,3// redirects, protection levels, line diffs, and markdown rendering.4//5// It is pure: no realm globals, no chain imports. Every call takes the context6// it needs (author address, wall clock, block height) from the caller, so the7// whole engine is unit-testable off-chain. The live demo realm is8// gno.land/r/moul/x/wiki/v0.9//10// # Storage model11//12// A realm write locks a storage deposit proportional to the bytes it adds13// (100ugnot per byte since gnolang/gno#6171), so a wiki that kept every14// revision in full would charge its editors for the whole history forever.15// This engine instead stores a content-addressed spine plus a bounded body16// window:17//18// - Every revision keeps its metadata permanently: id, parent, author,19// time, height, summary, byte size, and the SHA-256 of the body. That is20// roughly 200 bytes, independent of article size.21// - Only the newest Retention revisions of a page keep their body. Older22// bodies are evicted (set to ""), which releases their deposit.23//24// An evicted body is not lost: its bytes were an argument of the transaction25// that wrote it, so they remain in the chain's transaction history, and the26// retained hash proves which bytes were the real ones. The realm stops paying27// rent for deep history; the archive lives where archives belong.28//29// # Untrusted markdown30//31// Article bodies are attacker-controlled markdown. Render passes every body32// through gno.land/p/nt/markdown/sanitize/v0 before any wikilink rewriting,33// never after: sanitize escapes "[" to "\\[", so a rewriter that ran first34// would hand its own generated links to the escaper. See links.gno.35package wiki36Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.