# ep: Fix code block extraction to require closing fence at line start \(\#46270\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/49c4dcb1ef01c9492c8cda177c4d6d6e41f13851)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 49c4dcb1ef01c9492c8cda177c4d6d6e41f13851

Requested commit: 49c4dcb1ef01c9492c8cda177c4d6d6e41f13851

Commit: 49c4dcb1ef01c9492c8cda177c4d6d6e41f13851

Tree: 48b77423fdbcaf3b9c2366e3eb8abc0a68469a17

Author: Oleksiy Syvokon

Committer: GitHub

## Message

```
ep: Fix code block extraction to require closing fence at line start (#46270)

`extract_last_codeblock` was using `find()` to locate closing fences,
which would match backticks anywhere in the text. This caused incorrect
parsing when the content contained inline backticks or nested code
blocks, resulting in wrong diffs.

Fix by requiring the closing fence to be preceded by a newline.
Release Notes:

- N/A
```

## Parents

- [69acab7f81950588ea0bb0ab73f4f28df1c05931](https://git.cafe/gitcafe/zed/commit/69acab7f81950588ea0bb0ab73f4f28df1c05931?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/49c4dcb1ef01c9492c8cda177c4d6d6e41f13851?format=markdown)
