# Code Block Affecting Attachments

**URL:** <https://community.bear.app/t/code-block-affecting-attachments/16538>\
**Category:** Bear Bug Report\
**Created:** [May 1, 2025, 10:42pm UTC](https://community.bear.app/t/code-block-affecting-attachments/16538 "2025-05-01T22:42:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AdamRadPro](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@AdamRadPro](https://community.bear.app/u/AdamRadPro)\
**Post date:** [May 1, 2025, 10:42pm UTC](https://community.bear.app/t/code-block-affecting-attachments/16538/1 "2025-05-01T22:42:37Z")

</div>

- **Bear Version** : Version 2.3.12 (13245)
- **OS Version** : macOS 15.4.1 (24E263)

**What were you doing**

- Applying a code block

**What feature did you use**

- Highlighted text with tabs
- `Command Control C` to apply a code block

**What happened**

- The code block affected the attachment after the end of the code block

**What did you expect to happen**

- The embedded attachment should be left alone
- The start and end of the code block backticks should be on the left side of the note. They should not be tabbed.
- [**See screen recording**](https://screen.studio/share/grhTCEUt)
- **See screenshot** of result after applying the code block

  
 ![2025-05-01-183055 - Screenshot](https://europe1.discourse-cdn.com/flex013/uploads/bear/original/2X/0/0bfbad48c08d5546330a09efc1370b979e52c880.jpeg)

---

<div class="post-metadata">

**Author:** ![rexikan](https://dub1.discourse-cdn.com/flex013/user_avatar/community.bear.app/rexikan/32/4117_2.png) [@rexikan](https://community.bear.app/u/rexikan)\
**Post date:** [May 2, 2025, 6:30am UTC](https://community.bear.app/t/code-block-affecting-attachments/16538/2 "2025-05-02T06:30:17Z")

</div>

Yes, the end marker of the code block is inserted in the wrong place. Thanks for reporting!

---

<div class="post-metadata">

**Author:** ![rexikan](https://dub1.discourse-cdn.com/flex013/user_avatar/community.bear.app/rexikan/32/4117_2.png) [@rexikan](https://community.bear.app/u/rexikan)\
**Post date:** [May 12, 2025, 1:32pm UTC](https://community.bear.app/t/code-block-affecting-attachments/16538/3 "2025-05-12T13:32:26Z")

</div>

Hi, I had a look at the code and I decided against fixing this particular issue. Fenced code blocks are tricky to get right when selecting cr oss different levels of lists and there are endless combinations to consider. It is just not feasible to cover them all.

Sorry about that. There are many benefits of having a markdown-first editor, but this is one of the downsides.

In your case, you would have gotten better results if your selection included the blank line at the end.

---

<div class="post-metadata">

**Author:** ![AdamRadPro](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@AdamRadPro](https://community.bear.app/u/AdamRadPro)\
**Post date:** [May 13, 2025, 11:50am UTC](https://community.bear.app/t/code-block-affecting-attachments/16538/4 "2025-05-13T11:50:23Z")

</div>

No worries. Thanks for the update. I wasn’t sure if this is breaking a Markdown rule or a bug, so I wanted to report it. I see what I have to do now. I’m fine with _learning the ways of the Markdown Gods_. But I appreciate Bear hacking the Markdown syntax and making it more fun to use than other editors. 😀 Thank you for giving it a look!

**Good**

 ![2025-05-13-074700 - Screenshot](https://europe1.discourse-cdn.com/flex013/uploads/bear/original/2X/2/23d1fff05c59f9553a5303a85fc8e1903ac985d5.jpeg)

**Bad**

 ![2025-05-13-074645 - Screenshot](https://europe1.discourse-cdn.com/flex013/uploads/bear/original/2X/3/39b77f7d1950bc5324e78bdcb9bf4d13543c5a76.jpeg)
