func Code
Code renders s as an inline code span that cannot be closed early. Control characters become spaces, format characters are dropped, and "|" becomes "¦" so the span is also safe inside a table cell.
Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.
Package render is the Remix Lab rendering block: escaping for untrusted text, Markdown tables, paginated lists, route...
Package render is the Remix Lab rendering block: escaping for untrusted text, Markdown tables, paginated lists, route parsing and gnoweb transaction links.
Every string that came from a user must pass through Text or Paragraph before it reaches Markdown. Escaped output cannot open links, images, HTML, headings, tables, code spans, bare URLs or @mentions. (gnoweb still links a bare g1 address; that target is a first-party user page.) Invisible and direction-changing format characters are dropped.
Code renders s as an inline code span that cannot be closed early. Control characters become spaces, format characters are dropped, and "|" becomes "¦" so the span is also safe inside a table cell.
Heading returns a Markdown heading with escaped text. level is clamped to 1..6.
Link renders a link with an escaped label to a realm-relative target, e.g. "/r/foo/bar:polls/3". External or scheme-bearing targets are refused and rendered as plain escaped text.
Page reads a 1-based "page" query value, clamped to 1..maxPage (a maxPage below 1 counts as 1).
PageCount returns the number of pages needed for total items.
Pager renders previous/next links for a paginated route under pkgPath. page is clamped to 1..pages.
Paragraph escapes multi-line text, keeping line breaks as hard breaks. Leading indentation is removed so no line becomes a code block.
ParsePath splits a render path such as "polls/3?page=2" into its route segments and query values. Malformed queries yield empty values.
RealmQueryURL is RealmURL with query parameters: keys must be Go identifiers and values are URL-encoded, so any value (including "&", "=" or "%") reaches Render intact through ParsePath. route itself must not contain "?". It returns "" on invalid input.
RealmURL turns a package path into the realm-relative URL gnoweb serves, optionally with a render path: RealmURL("gno.land/r/a/b", "polls/1") -> "/r/a/b:polls/1".
Row escapes every cell.
Table renders a Markdown table. Headers are escaped with Text. Row cells are NOT escaped: build rows with Row (untrusted text) or TrustedRow (markup from Link, TxLink, Code). As a last line of defence every cell has line breaks replaced and unescaped "|" escaped, so a cell can never split the row or end the table. Rows shorter than the header are padded; longer rows are truncated.
Text escapes s for inline Markdown. Newlines and control characters become spaces, invisible and direction-changing format characters are dropped, every ASCII punctuation character Markdown or gnoweb could interpret is backslash-escaped, and "<", ">" and "&" become entities.
TrustedRow marks a row whose cells were already built from escaped text and trusted markup (for example links from Link or TxLink). Use Row for untrusted cells.
TxLink renders a gnoweb transaction link for fn on the realm at pkgPath with the given key/value arguments. Function and key names must be Go identifiers; values are URL-encoded. Invalid input renders the label as plain text so a bad link never reaches the page.
TxURL builds the gnoweb "$help" URL used by TxLink, or "" when the input is invalid.