Skip to main content

needs_djot_escaping

Function needs_djot_escaping 

Source
pub fn needs_djot_escaping(s: &str) -> bool
Expand description

Whether plain_text_to_djot would rewrite s at all.

For a caller migrating a stored field from plain text to Djot: a value this returns false for is already legal Djot meaning exactly itself, so it can be left byte-identical on disk and stays readable by an older build. Only the values this returns true for force a rewrite — which is the distinction a format-version floor should be gated on, rather than stamping every project that merely has comments.

Note this asks whether the stored bytes change, not whether meaning survives. For that, see djot_round_trip_is_lossy — the two are independent, and a migration generally wants both.