markdown: Fix out of range panic in parser (cherry-pick #30510) (#30512)
gcp-cherry-pick-bot[bot]
and
Bennet Bo Fenner
created
Cherry-picked markdown: Fix out of range panic in parser (#30510)
For some reason `pulldown_cmark` treats \````` as a codeblock, meaning
that we could end up with an invalid range generated from
`extract_code_block_content_range` (`3..2`)
Closes #30495
Release Notes:
- agent: Fix an edge case where the editor would crash when model
generated malformed markdown
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>