Expand description
§prompt-fence-strip
Strip code fences, leading prose (“Sure, here you go:”), and
trailing chatter (“Let me know if you need anything else!”) from
LLM output so the structured payload inside survives.
§Example
use prompt_fence_strip::strip_fences;
let raw = "Sure!\n```json\n{\"a\":1}\n```\nLet me know!";
assert_eq!(strip_fences(raw), "{\"a\":1}");Functions§
- strip_
fences - Strip
code fencesand surrounding prose. Returns the inner content of the first fenced block. If no fenced block is found, the input is returned trimmed of surrounding whitespace. - strip_
fences_ cow - Strip without copying when no change is needed. Returns a borrowed
slice into
swhen possible, else an ownedString.