Backticks break images and sketches

Testing version: 2208

What were you doing: inserting image and fencing it in codeblock

What feature did you use: codeblock and images

What happened: fencing the image i.e., putting triple back ticks in front of an imge like [](assets/image.JPG) shows it as the markdown code that implements it, which is perfectly fine and expected :slight_smile: . But removing the backticks again does not render the picture again. The same happens with embedded sketches and documents.
I guess it has to do with the way pandas inserts images/sketches and internally remembers that they are special objects, but this is lost if fenced in backticks.

What did you expect to happen:

Hi there,

Thank you for taking the time to test the update, and for reporting the above.

This may be something the development team has not yet considered. I’ll pass it onto them to have a look into.

Just wanted to mention that this can easily happen by accident (not only by nosy beta testers :slight_smile: ) if one writes ``` and then everythign below that will be turned into a code block.
This happens every time one writes a fenced code block via keyboard.

I just wanted to bump this issue up again. I am sure it is being worked on, so I am sorry for the pressure. I also wanted to mention that closing and reopening the file—I use a textbundle exported from Bear—in panda will not re-render the images. In short, backticks ``` wreck havoc with anything embedded below it.

1 Like

Panda 1.0 (3096) on macOS 12.5

Even if there is nothing below the code fence, I have felt stuck inside the code block, when I forget that I need to close it.

One possible solution to both of these problems would be to auto-close the code fence, similar to how many programmer’s editors auto-close various tags. Typing just 3 backpacks could result in something like this:

```
```

With the cursor still on the first line, ready to type in some code or language name:

```| <- cursor
```

That auto-closing behaviour may be useful elsewhere in the future too.

For example, the Markdown mode in Sublime Text will auto-close bold when typing a single asterisk, leaving the cursor in the middle **. That case is less important, and a bit trickier to implement. E.g. in Sublime Text, pressing asterisk and then space will remove the second asterisk, because then it’s a list instead of bold.

Workaround

Ctrl-Command-C works in both Panda 1.0 (3096) and Bear 1.9.6 (9044) to create a closed code block that doesn’t mangle the content below. Since that’s fewer keystrokes anyway, I’d will willing to adopt that shortcut.

1 Like

I think auto closing should also be the default even when typing the three ticks.

1 Like

Other apps call it “auto-pair”.

This remains an issue. The lack of auto-pairing also impacts smaller code snippets.

Let’s say I want to type cargo new --help into Bear 2.0 (10757). If I type it in from left to right, I end up with cargo new —help. Notice the difference? It’s converted the hyphens to an emdash.

Then I have to go back and fix it. Or I need to retrain my brain (which is very use to working this way) to either type the closing tilde first or use the Command-Option-C shortcut. Not fun.

1 Like