notaapp / talk

Issues and discussions for the notes app, Nota.
https://nota.md
60 stars 1 forks source link

Some cases code block not correctly works. #243

Open HwiNyeonKim opened 2 years ago

HwiNyeonKim commented 2 years ago

I've experienced three cases the code block does not correctly work.

  1. When I try to write a code block at a line starting with a tab. In this case, a code block is not automatically generated in my case.
  2. When I try to write a code block at a line starting with an indented bullet point, a code block is not correctly generated. Only the head of the code block is generated. The language selection popup also does not appear.
  3. Like case two, an indented bullet point is needed. Remove the indented bullet point so that the cursor lay in the indented position without a bullet point. And then, try to write a code block. The code block is correctly generated, but when I input a return key, the cursor starts from the wrong position at the next line.

I attach a screenshot of the three cases below.

nota-codeblock-problems
erusev commented 2 years ago

Hi šŸ‘‹ and thanks for taking the time to create this issue.

Point 1 works like this because we try to follow the Markdown spec. You play with the reference Markdown parser at https://spec.commonmark.org/dingus/.

Point 2 is something we've wanted to fix for a while now, and hopefully, we'll do it soon.

Point 3 feels related to point 1, but I'm not sure I understand it right. Do you think you could make a video (or gif) to demo the issue?

Thanks again!

HwiNyeonKim commented 2 years ago
  1. I tested the reference Markdown parser you linked and this is the result. I think it also works weird because in case 1, a code block is generated but looks different at the parser. Anyway, you mean your intention is a code block should be generated only when ``` starts at the beginning of a line, right?

    111
  2. That's good news! šŸ˜

  3. Maybe it is related to point 1, but Iā€™m not sure because it works differently from point 1. It generates an indented code block anyway. Below is a GIF of it. CleanShot 2022-06-15 at 18 40 28

erusev commented 2 years ago

Thanks for explaining!

Point 1. Here you can see that when there's no space between the paragraph and the code block and the code block is indented, the paragraph "eats" it -- that is, it is considered part of the paragraph.

image

Point 3. Looks like a bug. We'll look into it. Thanks for making the gif.