fn find_own_close(rest: &str, close: &str, next_open: &str) -> Option<usize>Expand description
Find this tag’s own closing marker inside rest: the LAST occurrence of
close before the next sibling next_open marker (or before the end of
rest, if there is no next sibling).
A naive rest.find(close) truncates the value early whenever it happens
to contain the literal closing-tag text — a real risk for a content or
code parameter carrying anything that looks like markup. The tag’s true
close is always the one immediately before its next sibling opens (or the
end of the block), never an earlier occurrence, so searching backward
from that boundary finds it correctly even when the value embeds the
marker text. This is not a complete fix — a value that also happens to
contain the next sibling’s open marker is still ambiguous, since this
dialect has no escaping mechanism — but it is strictly more often correct
than a forward search from the start.