Skip to main content

Module sink

Module sink 

Source
Expand description

Output sink abstraction for inline emission.

The inline parser (super::core) emits its CST through exactly three operations: emit a leaf token, open a node, close a node. Abstracting those behind InlineSink lets the common path write straight into a GreenNodeBuilder (zero-cost, monomorphized) while a blockquote paragraph can swap in [MarkerInjectingSink], which splices BLOCK_QUOTE_MARKER tokens into the stream at recorded byte offsets during the same pass — no temporary tree built and replayed.

The marker-injection logic mirrors the lossless reconstruction rules: a leaf token is split when a marker falls in its interior, and a marker whose offset coincides with a node boundary is emitted outside the node (before start_node) so it never nests inside e.g. an EMPHASIS_MARKER.

Traits§

InlineSink
The three CST-building operations the inline emitter relies on.