urvanov-ru / crayon-syntax-highlighter

Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text.
https://wordpress.org/plugins/urvanov-syntax-highlighter/
GNU General Public License v3.0
60 stars 11 forks source link

highlighter inconsistently highlights #9

Open dyslexicanaboko opened 4 years ago

dyslexicanaboko commented 4 years ago

Hi,

I am not sure what to provide you exactly so I am hoping to converse with you in the comments or via email if you'd prefer. I have used the crayon syntax highlighter for a long time, I upgraded to this highlighter and it is half working. Thank you for picking up the project.

Bizarre behavior

Examples

If you view the page source you can clearly see that these pages are doing different things:

I checked the header of both pages and the urvanov CDN declarations are present.

Could you please help me figure out what I am doing wrong or maybe there is a bug?

urvanov-ru commented 4 years ago

In my forked version you should use special block named "Urvanov Syntax Highlighter". I don't sure about "Code Block" and it is strange that it worked for you.

urvanov-ru commented 4 years ago

@dyslexicanaboko Maybe you have some messages in log file inside plugin directory? Check if logging is enabled in the plugin and try to see what is in the log file. The log works the same as it worked for Crayon.

urvanov-ru commented 4 years ago

And I will try to check your code examples from the page were the plugin does not work. Maybe I will find some solutions.

dyslexicanaboko commented 4 years ago

Hello - my apologies for not getting back to you sooner. Ever since the pandemic started things have been absolutely horrible for me at work. I work in the medical industry so we got hit hard.

I have been toying around again and I can't say I have gotten much better progress. I wanted to share with you one observation I have made. When I first post something with code in it I don't see any highlighting. However, when I press the "Refresh" button on the syntax highlighter page it seems to fix the highlighting I don't understand why.

Here is the output of the log:

[Crayon Syntax Highlighter Log Entry - 2:27:54 AM - 28 Jul 2020]

 [SYSTEM LOG] 'Updated from 2.8.9 to 2.8.12'

[Crayon Syntax Highlighter Log Entry - 4:11:28 AM - 28 Jul 2020]

 [SYSTEM LOG] 'Upload directory is empty:  cannot load languages.'
 [SYSTEM LOG] 'The resource directory is missing, should be at \'\'.'
 [UrvanovSyntaxHighlighterUtil::lines()] 'Cannot read lines at \'default/default.txt\'.'

[Crayon Syntax Highlighter Log Entry - 2:25:26 AM - 01 Aug 2020]

 [SYSTEM LOG] 'Upload directory is empty:  cannot load languages.'
 [SYSTEM LOG] 'The resource directory is missing, should be at \'\'.'
 [UrvanovSyntaxHighlighterUtil::lines()] 'Cannot read lines at \'default/default.txt\'.'

[Crayon Syntax Highlighter Log Entry - 2:27:36 AM - 01 Aug 2020]

 [SYSTEM LOG] 'Upload directory is empty:  cannot load languages.'
 [SYSTEM LOG] 'The resource directory is missing, should be at \'\'.'
 [UrvanovSyntaxHighlighterUtil::lines()] 'Cannot read lines at \'default/default.txt\'.'

[Crayon Syntax Highlighter Log Entry - 2:31:56 AM - 01 Aug 2020]

 [SYSTEM LOG] 'Upload directory is empty:  cannot load languages.'
 [SYSTEM LOG] 'The resource directory is missing, should be at \'\'.'
 [UrvanovSyntaxHighlighterUtil::lines()] 'Cannot read lines at \'default/default.txt\'.'

[Crayon Syntax Highlighter Log Entry - 2:43:50 AM - 01 Aug 2020]

 [SYSTEM LOG] 'Upload directory is empty:  cannot load languages.'
 [SYSTEM LOG] 'The resource directory is missing, should be at \'\'.'
 [UrvanovSyntaxHighlighterUtil::lines()] 'Cannot read lines at \'default/default.txt\'.'

I am going to try to keep debugging and get back to you.

I have tried using the "Urvanov Syntax Highlighter" block and it just smashes the code together. It's very odd.

dyslexicanaboko commented 4 years ago

I had a chance to make a post again and I have confirmed that the only way the syntax highlighter is working for me is to do the following:

  1. Use the "Urvanov Syntax Highlighter" block directly.
    1. Don't convert from any other block first this will screw it up.
  2. Click on the block's title "Urvanov Syntax Highlighter" and wait for the editor to appear
  3. Enter code
  4. Publish post
    1. At this point the syntax will not be highlighted
  5. Go to "~/wp-admin/options-general.php?page=urvanov_syntax_highlighter_settings"
  6. Press the "Refresh" button located in the "Posts" section of the page
  7. Refresh your post's page and you will see syntax highlighting

If I don't follow these steps it doesn't work. This is more progress than before so that's good. At least now I can make it work, before nothing worked.

urvanov-ru commented 4 years ago
  1. Yes, you must use this block. I never tried to check convertion from any other block. I will fix it in future, but for now it is not sever error. I think.

Steps 6-7 looks strange for me, because in my site I don't do them. Maybe after some time I will find out what is wrong.