gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

There is a inconvenient function in Gutenberg when transfer classical html code

Open a2d8a4v opened this issue 7 years ago • 4 comments

Describe the bug

Hello, Gutenberg team. I found Gutenberg will change my html code even if in classical blocks. And the most inconvenient part is that, it will change the [code] blocks like some functions or command of the special characters, which we do not make changes.

For instance, " will be change to ;quote, && will be changed to && which is useless for our articles, and make us put more unnecessary strength on modifying our articles, some please fix this bug!

Thank you for your reading.

To Reproduce

  1. Edit the page which wasn't edited by Gutenberg before.
  2. Just save it.
  3. Special characters will be change to other

Expected behavior Just transfer the code blocks to "insert code blocks" blocks but not change any words especially some command lines or function words in articles.

Screenshot bugs_gutenberg

Desktop (please complete the following information):

  • OS : OSX
  • Browser : safari
  • Version : Gutenberg 4.6.1, WordPress 4.9.8

a2d8a4v avatar Dec 07 '18 01:12 a2d8a4v

I tested this but was not able to replicate the issue.

The steps I took were:

  1. Created a new post in WP 4.9.8
  2. Added the code displayed in the above gif between html <code> tags.
  3. Activated Gutenberg 4.6.1 plugin
  4. Opened the post editor and updated the post.

Sample code:

echo "net.core.somaxconn= 1024" > /etc/sysctl.conf
echo "vm.overcommit_memory=1" > /etc/sysctl.conf
echo never > /sys/kernel/mm/transparent_hugepage/enabled sysctl -p

Can you provide some more information so that we can replicate the issue? I'm not sure if it's relevant but it may be helpful to know:

  • Do you happen to use a plugin for syntax highlighting that may have a conflict?
  • Language setting of your site

Tested in Chrome 70.0.3538.110 macOS Mojave 10.14.1

starxedsteph-zz avatar Dec 09 '18 20:12 starxedsteph-zz

Hello @starxedsteph , thank you for testing the problem for me. Sorry for not prepared more detail about this bug. I am now update my website to 5.0, also syntax highlighting released a update and I tried yesterday. I'm not sure whether Gutenberg have a conflict with syntax highlighting plugin or not.

The steps I just took were like that:

  1. Update to WordPress 5.0 or install Gutenberg 4.6.1 in WordPress 4.9.8
  2. Open a old post, which has "[code]" tag in classical editing block in article. ( And the " > " or " & " were changed when I just open the old post. )
  3. Click "Save" button to update the post.

And the sample code in old post was like:

[code language="bash"] echo "net.core.somaxconn= 1024" > /etc/sysctl.conf echo "vm.overcommit_memory=1" > /etc/sysctl.conf echo never > /sys/kernel/mm/transparent_hugepage/enabled sysctl -p [/code]

It tested in Sarafi 12.0.1 macOS Mojave 10.14.1 Thank you for your reading

a2d8a4v avatar Dec 09 '18 22:12 a2d8a4v

Hi there @a2d8a4v,

Thanks for taking the time to update this issue. I cannot reproduce it with a clean install of the latest WP/Gutenberg, so this is likely related to the syntax highlighting plugin you are using. Perhaps you can report it to the plugin developers? I'm closing this issue for now but feel free to reopen it if you verify the issue is still occurring with no plugins enabled.

tellthemachines avatar Oct 17 '19 06:10 tellthemachines

Looks like there's a fix here for the syntax highlighter plugin - https://github.com/Automattic/syntaxhighlighter/pull/3

Definitely seems as though this isn't a Gutenberg bug, and more an issue with that plugin, so closing is the right action.

talldan avatar Oct 18 '19 00:10 talldan