Skip to main content

with_reference

Function with_reference 

Source
pub fn with_reference(body: &str, reads: &[SourceRead]) -> String
Expand description

The draft, then the marker, then the original quoted beneath it.

Writing a reply with the original in front of you is the whole reason the section exists, and a reviewer reading it in a pager and then editing from memory is only half a fix. So it goes into the buffer — which means text an attacker may control now sits in the file that becomes an outgoing email, and the round-trip is the security boundary.

It is made survivable rather than merely careful:

  • Quoted, not pasted. Every line is > -prefixed, so the region is visually the original at a glance and a stray paste of it into the reply is visible as quoting rather than as prose.
  • Below the draft, never above. An editor opens at the top; the words being edited are what should be there.
  • Cut on a marker, and strip_reference refuses when it is gone. See there for why that direction.