mugiwara85 / CodeblockCustomizer

Codeblock Customizer plugin for Obsidian
MIT License
147 stars 7 forks source link

Highlight bugs #86

Closed Kang-geophysics closed 2 weeks ago

Kang-geophysics commented 1 month ago

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.

mugiwara85 commented 1 month ago

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).

Kang-geophysics commented 1 month ago

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.

mugiwara85 commented 1 month ago

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\

Kang-geophysics commented 1 month ago

I am using "Minimal Theme"

This is my data.json file. data.json

Thanks

mugiwara85 commented 1 month ago

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 commented 1 month ago

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)

Kang-geophysics commented 1 month ago

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.

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!

mugiwara85 commented 1 month ago

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.

Kang-geophysics commented 1 month ago

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.

mugiwara85 commented 1 month ago

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

Kang-geophysics commented 1 month ago

I really appreciate your effort. Thank you very much.

mugiwara85 commented 2 weeks ago

Finally released. Available in version 1.2.7.