Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax Highlighting no longer works on my site #22

Closed
paynterf opened this issue Sep 14, 2020 · 40 comments
Closed

Syntax Highlighting no longer works on my site #22

paynterf opened this issue Sep 14, 2020 · 40 comments

Comments

@paynterf
Copy link

I have been using syntax highlighting for several years now, but recently moved from Classic Editor to Gutenberg Blocks. Now I can't get syntax highlighting block to work - it just displays plain text with no formatting. See this post and this post (towards the bottom of the post) for examples

What am I doing wrong here?

@urvanov-ru
Copy link
Owner

@paynterf

  1. Do you have any errors in PHP log? I think, you should have it. As I see, PHP code didn't work in your site. It did't mark crayon tags in program codes. Maybe, some old PHP version?
  2. Do you use special Urvanov Syntax Highlighter block? Don't try to use standard Code block from Gutenberg. Use Urvanov Syntax Highlighter block
  3. Can you try Urvanov Syntax Highlighter in fresh WordPress install in the same hosting, like yours. Does it work?

@urvanov-ru
Copy link
Owner

Or it maybe some kind of conflict with some other plugin? What other plugins do you use?

Actually, In your site PHP code for highlighting didn't work and didn't mark the code as it expected.

@paynterf
Copy link
Author

paynterf commented Sep 15, 2020 via email

@paynterf
Copy link
Author

paynterf commented Sep 15, 2020 via email

@paynterf
Copy link
Author

paynterf commented Sep 15, 2020 via email

@urvanov-ru
Copy link
Owner

@paynterf /home4/gfpbridg/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php

crayon-syntax-highlighter/crayon_langs.class.php
This is not my forked plugin.

You should completely remove old Crayon plugin and then install My forked version. Old Crayon plugin does not work anymore.

@urvanov-ru
Copy link
Owner

And don't use standard Code block in Gutenberg. Use Urvanov Syntax Highlighter block.

@paynterf
Copy link
Author

paynterf commented Sep 16, 2020 via email

@urvanov-ru
Copy link
Owner

@paynterf Old posts don't use old plugin. My forked version is the same as old crayon plugin for them.

I only adapted it to the new version of PHP. And I added Gutenberg block Urvanov Syntax Highlighter.

Check your plugins directory in wordpress. I think, It has crayon-syntax-highlighter inside it, because I see it in your log. Do you stil have this lines:

failed: invalid range in character class at offset 4 in
/home4/gfpbridg/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php
on line 340

About https://www.fpaynter.com/2020/09/test-post-2/ .
How did you create this post? Is this special Urvanov Syntax Highlighter block in Gutenberg? If this is paragraph block, then button in this block can only add inline code. For multiline code, like you expected, you should use special block, not paragraph block.

Look here
See highlighted block of code? They are not inside paragraph block. They are separated special blocks.

If you old posts work, then new posts should work too. Mostly they use the same functionality.

@paynterf
Copy link
Author

paynterf commented Sep 16, 2020 via email

@urvanov-ru
Copy link
Owner

Sorry, but I don't see any screenshots in your comment.

@urvanov-ru
Copy link
Owner

And I have an idea. The plugin have setting named "Capture inline tags". Can you check it, please? It should be enabled. It is in Plugins -> Installed -> Urvanov Syntax Highlighter -> Settings window.

@paynterf
Copy link
Author

paynterf commented Sep 17, 2020 via email

@paynterf
Copy link
Author

paynterf commented Sep 17, 2020 via email

@urvanov-ru
Copy link
Owner

Sorry, I don't know how you attach images, but I still cannot see them

@paynterf
Copy link
Author

paynterf commented Sep 17, 2020 via email

@paynterf
Copy link
Author

paynterf commented Sep 17, 2020 via email

@urvanov-ru
Copy link
Owner

If it will help, I can add you as a user on my site

I think it can help.

@paynterf
Copy link
Author

paynterf commented Sep 18, 2020 via email

@paynterf
Copy link
Author

paynterf commented Sep 19, 2020 via email

@urvanov-ru
Copy link
Owner

Looks like we really have some problem. It works in Twenty Fifteen theme, but does not work in Twenty Twenty theme.

New posts don't highlight. As workaround it looks like after you press "Save" all posts created before that pressing start to work. Really strange. But don't worry. I will fix it.

@urvanov-ru
Copy link
Owner

Looks like save_posts hook does not work:
// For marking a post as containing a Crayon add_action('update_post', 'Urvanov_Syntax_Highlighter_Plugin::save_post', 10, 2); add_action('save_post', 'Urvanov_Syntax_Highlighter_Plugin::save_post', 10, 2); add_filter('wp_insert_post_data', 'Urvanov_Syntax_Highlighter_Plugin::filter_post_data', '99', 2);
So the code does not mark as containing crayon. So, we don't see the markup. Strange. Why it is only in Twenty Twenty. Do we have it in other themes...

@urvanov-ru
Copy link
Owner

Looks like method is_admin returns empty for "Update" button when you save the post. Strange. It should return true for all wp-admin urls.

@paynterf
Copy link
Author

paynterf commented Sep 19, 2020 via email

@paynterf
Copy link
Author

paynterf commented Sep 19, 2020 via email

@urvanov-ru
Copy link
Owner

I found a problem. It is not with the theme. Crayon uses is_admin() to check if it is admin panel. But Gutenber uses REST API to save posts. So is_admin does not work. Strange that it worked before. I found the solution and I will make and update tomorrow.

@urvanov-ru
Copy link
Owner

WordPress/gutenberg#11138
It is link for me. Just for history.

@paynterf
Copy link
Author

paynterf commented Sep 19, 2020 via email

@urvanov-ru
Copy link
Owner

I fixed it.

@paynterf
Copy link
Author

paynterf commented Sep 20, 2020 via email

@paynterf
Copy link
Author

paynterf commented Sep 20, 2020 via email

@urvanov-ru
Copy link
Owner

Fedor, See this post https://www.fpaynter.com/2020/09/test-post-3/. A newly created post where I attempted to insert a Urvanov Syntax Highlighter block Frank

On Sun, Sep 20, 2020 at 9:23 AM Frank Paynter @.> wrote: Fedor, I see where it appears to display properly on the Test2 post, but it still doesn't display properly on my latest robot post. To test, I removed and then re-added the second code snippet from the top, and then added a completely new one at the bottom. Neither snippet displayed properly. See this post https://www.fpaynter.com/2020/09/replacing-wall-e2s-l298n-motor-drivers-with-adafruit-drv8871/ for the results. Frank On Sun, Sep 20, 2020 at 9:04 AM urvanov.ru @.> wrote: > I fixed it. > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <#22 (comment)>, > or unsubscribe > https://github.com/notifications/unsubscribe-auth/AA6T32Z42DHDYMIWZ35YWQLSGX4U7ANCNFSM4RLXVHSA > . > -- G.Frank Paynter, PhD OSU ESL Research Scientist (ret) EM Workbench LLC 614 638-6749 (cell)
-- G.Frank Paynter, PhD OSU ESL Research Scientist (ret) EM Workbench LLC 614 638-6749 (cell)

Sorry, but you used paragraph block not special block.

There two types of code:

  1. inline
  2. block

Inline highlighting is made by pressing button in the toolbar of paragraph block

Block code is made by adding special block like in the picture:
urvanov-syntax-highlighter-block.png

I think I should write some article about it. Or maybe I should write somewhere in the plugin description..

@urvanov-ru
Copy link
Owner

I updated the post. https://www.fpaynter.com/2020/09/test-post-3/

Use it as example..

I really think, that a lot of people need explanation about this two types. I will definitely write about.

@paynterf
Copy link
Author

paynterf commented Sep 20, 2020 via email

@urvanov-ru
Copy link
Owner

@paynterf You should use button in the toolbar of the new special block to open the dialog:
https://freeimage.host/i/2uKUQ9
Yes, You are right. That thing need some tutorial.

@paynterf
Copy link
Author

paynterf commented Sep 21, 2020 via email

@urvanov-ru
Copy link
Owner

@paynterf I sent you e-mail with video.

@paynterf
Copy link
Author

paynterf commented Sep 21, 2020 via email

@urvanov-ru
Copy link
Owner

@paynterf Sorry, but you didn't attach anything to your previous comment on github.

@urvanov-ru
Copy link
Owner

We fixed the bug and we created some tutorial video in the description page:
https://wordpress.org/plugins/urvanov-syntax-highlighter/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants