CodeblockCustomizer icon indicating copy to clipboard operation
CodeblockCustomizer copied to clipboard

Highlight bugs

Open Kang-geophysics opened this issue 1 year ago • 2 comments

image image

Hi, I really love this plugin. Btw, I found a simple bug.

The highlight command seems to have order dependency. As you can see in Figure 1, the highlight works well. But, in Figure 2, the default command "hl" doesn't work.

I found that the command "h" aligned after customized hl command doesn't work.

Thanks.

Kang-geophysics avatar May 23 '24 10:05 Kang-geophysics

Hi! Thanks! Unfortunately, I can't reproduce this issue: image

Is it possible that you have editor active line highlight or codeblock active line highlight enabled, and you clicked in the second line on the second screenshot? Active line highlight takes precedence over any highlight, because otherwise you wouldn't see in which line the cursor is in. But other than that, it should not matter in which order you specified the highlight parameters (as long as they are not overlapping).

mugiwara85 avatar May 23 '24 20:05 mugiwara85

image image

It's strange; I didn't click on the second line. I attempted it once more, yet it still fails to work. By the way, it's not important. Thank you for your effort. There seems to be a problem, but I'm not sure what it is yet. If I discover anything else, I'll inform you.

Kang-geophysics avatar May 24 '24 01:05 Kang-geophysics

Interesting. Well if it's a bug, I will gladly fix it, I just have to reproduce it :) What Obsidian Theme are you using? Also could you send me your data.json file? It can be found in your Vaultfolder.obsidian\plugins\codeblock-customizer\

mugiwara85 avatar May 24 '24 07:05 mugiwara85

I am using "Minimal Theme"

This is my data.json file. data.json

Thanks

Kang-geophysics avatar May 24 '24 08:05 Kang-geophysics

And you are right! Now I can reproduce it. It really doesn't work. Very interesting. I check it, and get back to you.

mugiwara85 avatar May 24 '24 08:05 mugiwara85

I rewrote the parameter parsing part, and it should work now, but please test it. Maybe you find something else :) This was a very good find! You can just take the main.js and overwrite yours with it (until it is released)

mugiwara85 avatar May 24 '24 13:05 mugiwara85

Thank you for your efforts! I truly appreciate the improvements. It functions well in live view mode, as you can observe. image

By the way, I found related error.

  • source mode image
  • live mode image
  • reading mode image

I created three code blocks. In the first block, lines 3 and 4 are highlighted with "hl" and lines 1 and 6 with "ghl". In the second block, line 1 is highlighted with "ghl", lines 2 and 6 with "yhl", and lines 3 and 4 with "hl". In the third block, lines 3 and 4 are highlighted with "hl" and line 5 with "yhl". However, when I switch to reading view, the "ghl" and "yhl" highlights disappear in the second block.

Thank you!

Kang-geophysics avatar May 24 '24 16:05 Kang-geophysics

Hi! This probably a refresh problem, because it is working for me.

Source mode: image

Reading mode: image

One thing I can think when something like this happens is when you are editing the document, then switch to reading mode, then back to edit mode, make some changes (like adding the last highlighting to the second code block which didn't work), and then back to reading mode again. Could you please test it, if this is the case? If yes, then just switch to another document in reading mode, and switch back to this one. That should solve it.

mugiwara85 avatar May 24 '24 20:05 mugiwara85

Yes, that's correct. The issue arose after making a few changes to the code block. However, when I switch to a different note, the problem resolves. I had anticipated that the changes would also affect the reading mode directly.

Kang-geophysics avatar May 25 '24 14:05 Kang-geophysics

Well they do....sort of. Not all the changes have immediate effect. It is complicated. I am working on it.

mugiwara85 avatar May 25 '24 14:05 mugiwara85

I really appreciate your effort. Thank you very much.

Kang-geophysics avatar May 25 '24 15:05 Kang-geophysics

Finally released. Available in version 1.2.7.

mugiwara85 avatar Jun 13 '24 21:06 mugiwara85