markdown: lead with methods on MarkdownDocument (slice of #146) #178
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
std/markdownoutput is used as methods on the document:document.markdown(),document.html(), andinlines.plainText().Part of #146 (methods are the preferred API style; owner direction 2026-10-06, first applied in #96 as
Digest.equalsConstantTimewithconstantTimeEqualkept as a thin wrapper). This slice follows exactly that pattern.Functions in scope
markdownOfandhtmlOf(receiverMarkdownDocument),plainText(receiverList<MarkdownInline>). Keep as free functions:parsedDocument(text, options)(a constructor-like entry point, text is the input not the receiver) and the ~20 undocumented scanner helpers intext.trb/inlines.trb(internal; their visibility is part of the open question on #146).Source (pinned record)
usethe method like any member. If anextendwithout a trait on a type of another package turns out not to work instd/, stop and re-plan instead of working around it.Acceptance criteria
std/markdownprovidesMarkdownDocument.markdown(),MarkdownDocument.html()andList<MarkdownInline>.plainText()with the current result typesstd/markdowntest files): method result equals free function result on the existing CommonMark and writer round-trip casesdeprecatedhere (the deprecation path is an open owner decision on #146).docs/standard-library/leads with the method in every example; the wrapper is listed as the older spelling. Examples are checked withtrb check;skills/is regenerated.compiler/srcandtools/keep calling the wrapper).Seed
No. Ordinary TorbScript in
std/only: no syntax change, no new native, no driver flag, no std name the compiler looks up by string. If that turns out wrong, stop and re-plan (two commits, seed refresh).Size
One PR, one Conventional Commit (
refactor(<module>): ...orfeat(<module>): ...), tests and docs in the same commit.Dependencies
Tracking epic: #146. No other dependency; independent of the other module slices.
[loop:torbscript] scope update from the owner decision on #146 (torben, 2026-10-08): the free functions covered by this slice are removed in the same PR that adds the methods, not kept as wrappers and not marked
deprecated. Migrate every caller in the repo (std, tests, examples, docs) to the method in the same PR. No lint migration rule needed.[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T13:45:00Z
[loop:torbscript] implement: PR #183 is open and forge CI is green.
MarkdownDocument.markdown()/.html()andList<MarkdownInline>.plainText()now hold the bodies;markdownOf,htmlOfand the freeplainTextare removed and all callers (std/markdown, tests, compiler documentation and reference renderers, docs page, skills copy) migrated. Notes: anextend List<MarkdownInline>declared inlib.trbfails the seed's native back end (selfuntyped), so it lives intree.trband is re-exported withpublic use List.plainText; theskills/page was edited by hand to the docs text (no local torb to rundocs skill, the tier A--checkgate passed). Worker token usage: not measurable from the session (about 5 CI rounds). next: review