Extract every example from a ReSpec/zcap-spec document, streaming.
This is the main entry point of the library. It accepts a Response, a
ReadableStream, any async iterable of chunks, or a plain string, and yields
one ZcapSpecExample at a time, in document order.
Nothing accumulates: each example is emitted as soon as its closing tag
arrives and is then dropped, so memory stays flat regardless of document
size. You never have to hold the whole spec as a string.
Examples are recognised by a class="example" on an <aside>, <div>,
<figure>, or <pre>, which covers the shapes different ReSpec versions
produce. Markup nested inside the example (syntax-highlighting <span>s and
the like) is flattened away and HTML entities are decoded, so content is
the example text as an author would write it.
Extract every example from a ReSpec/zcap-spec document, streaming.
This is the main entry point of the library. It accepts a
Response, aReadableStream, any async iterable of chunks, or a plain string, and yields one ZcapSpecExample at a time, in document order.Nothing accumulates: each example is emitted as soon as its closing tag arrives and is then dropped, so memory stays flat regardless of document size. You never have to hold the whole spec as a string.
Examples are recognised by a
class="example"on an<aside>,<div>,<figure>, or<pre>, which covers the shapes different ReSpec versions produce. Markup nested inside the example (syntax-highlighting<span>s and the like) is flattened away and HTML entities are decoded, socontentis the example text as an author would write it.