deltachat::simplify

Function escape_message_footer_marks

source
pub fn escape_message_footer_marks(text: &str) -> String
Expand description

Protects lines starting with -- against being treated as a footer. for that, we insert a ZERO WIDTH SPACE (ZWSP, 0x200B); this should be invisible on most systems and there is no need to unescape it again (which won’t be done by non-deltas anyway).

This escapes a bit more than actually needed by delta (e.g. also lines as “– footer”), but for non-delta-compatibility, that seems to be better. (to be only compatible with delta, only “[\r\n|\n]– {0,2}[\r\n|\n]” needs to be replaced)