Beaver-Notes/Beaver-Notes

Code blocks don't work well

asimov-zst opened this issue · 3 comments

Using the code block button on the toolbar renders the code properly, but it's not convenient to use.

  1. when I paste the code from somewhere else into the code block, the formatting gets messed up
  2. I can't use the TAB key to indent when entering code in code block

screenshots
bug1

Hey, thanks for reporting this issue. I'm already looking into it. As of now, the issue seems to be related to the source from which the code is copied. For example, pieces of code copied from GitHub are correctly formatted, while the ones copied from VSCode don't show up correctly. As far as the buttons are concerned, you can also insert a code block by typing ``` or ~~~ and then clicking the spacebar.

Thank you for your reply. As you said, pieces of code copied from GitHub are correctly formatted, while the ones copied from VSCode don't show up correctly. After checking the information on the internet, I found that I can solve this pasting problem by setting VSCode. Steps are as follows:

  1. open the VSCode settings (the shortcut key is ctrl + ,)
  2. type copy and locate the Text Editor
  3. the option Copy With Syntax Highlighting in front of the check mark removed (screenshot below)

settings

This allows the code to be copied from VScode to the application's code block and formatted correctly!

I'm happy it worked. To be honest, I thought it could have been an issue, but I was wary of dismissing it as a VSCode problem. Anyway, I'll add a page to the docs so that anyone facing the same issue will know how to solve it.