mugiwara85 / CodeblockCustomizer

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

[Bug]Version 1.2.1 cannot render code blocks #50

Closed YukiLx closed 9 months ago

YukiLx commented 10 months ago

It’s great to see the plugin updated again with support for the half-fold feature. But when I updated to the latest version 1.2.1, I found that the color theme and background color settings in the plugin did not take effect. (At first I thought it was because the code block background color style did not take effect, but later I found out that the plugin did not take effect) First of all, I recall some recent changes I made: I updated the Obsidian version to 1.4.5, updated the AnuPpuccin appearance theme to 1.4.4, and updated the plugin version to 1.2.1. At present, I am temporarily unable to determine what caused the problem, so I have some explorations and attempts as follows:

  1. First, I uninstalled the plugin and reinstalled version 1.2.1. Found the problem still exists
  2. Uninstall the 1.2.1 version of the plugin, manually install the 1.2.0 version of the plugin, no problem found
  3. According to some tips you gave me before, I also conducted the same test in Obsidian's Sandbox. I did not use third-party themes in this library, only the default theme. Installing versions 1.2.0 or 1.2.1 can render code blocks normally.

I'm not sure what is causing the plugin not to work, the latest version of the plugin works fine in Sandbox, but not in the library I use daily. I tried turning off other plugins one by one, with no real results. I don't see any related errors in the developer panel. Can you give me some tips or help? At present, I have rolled back the plugin version to 1.2.0. This version of the plugin can be used normally without any changes.

YukiLx commented 10 months ago

More details I can provide are:

In version 1.2.1 of the plug-in, in Obsidian's source code mode, whether it is the library I use daily or Obsidian's Sandbox library, the code blocks cannot be rendered normally, but when using real-time preview or reading view, everything returns to normal. .

I tested two versions of the plug-in, 1.2.0 and 1.2.1, in the Sandbox, ensuring that only the default theme was used in the Sandbox. When there was only one plug-in, I found that the 1.2.0 version worked both in source mode and reading view. It works normally, but version 1.2.1 cannot be rendered in source mode, but it is normal in reading view.

mugiwara85 commented 10 months ago

Can you send me a screenshot? Do you get an error in the console? What theme are you using?

YukiLx commented 10 months ago

I usually use the AnuPpuccin theme, but I think this problem has nothing to do with the theme and other plug-ins I use. It should be that there are some problems with this plug-in. Because I don't use any third-party themes in Obsidian's Sandbox, nor do I install other plug-ins, I still have this problem. Maybe you can also try to reproduce the problem in Sandbox

First install the latest 1.2.1 version of the plug-in in the Sandbox, then create a code block and fill in some code to observe the rendering effect of the code block.

The situation in version 1.2.1 is as follows https://github.com/mugiwara85/CodeblockCustomizer/assets/43459210/ff5f7301-933f-4a9d-a17e-ccab10ab47a3

An error message like this will appear in the console 图片

The situation in version 1.2.0 is as follows https://github.com/mugiwara85/CodeblockCustomizer/assets/43459210/9937a59a-d3cb-494f-8dc7-f8ec997c7b2d

I'm sorry that the video is not particularly clear, but it should be enough to show the problem.

mugiwara85 commented 10 months ago

Thanks for the info. I will look at this today

mugiwara85 commented 10 months ago

I can reproduce it. I will fix it tomorrow (and you'll also get some new feature :) )

mugiwara85 commented 10 months ago

Oh and I totally forgot. I made a change and thats why the plugin is not applied anymore in source mode. Only Live Previev and reading mode. Do you use it in source mode? I could make an option to enable/disable it in source mode.

YukiLx commented 10 months ago

It's good to be able to locate the problem Yes, I usually edit notes in source code mode, so that I can see the editing process more intuitively, and only use preview or reading mode when reviewing notes. Maybe you can add a switch to allow users to decide whether to disable it in source code mode. I think it is more appropriate to keep the function and style consistent in source mode, preview mode or read mode

mugiwara85 commented 10 months ago

I agree. I add a switch and then everyone can decide themselves.

mugiwara85 commented 9 months ago

The error should be fixed now, and the toggle for enabling/disabling the plugin in source mode is available in version 1.2.2. If there is any problem, just reply here.