EnlighterJS / Plugin.WordPress

:package: Official WordPress Plugin of EnlighterJS
http://wordpress.org/plugins/enlighter/
GNU General Public License v2.0
115 stars 17 forks source link

`&` in code will be parsed as `&` when post is displayed #314

Closed yuliu closed 3 years ago

yuliu commented 3 years ago

In WordPress 5.5.1, & in code will be parsed as & when post is displayed. Following is the plugin's info:

    Server
    PHP Version: 7.2.24
    PHP JSON Extension: available
    Server Software: Linux

    Components
    Enlighter Plugin: 4.4.1 CE
    EnlighterJS Version: 3.4.0
    TinyMCE Extension: 5.0.1
    Gutenberg Extension: 1.1.0
    Theme Customizer: 2.3.0
    WP-Skeleton Version: 0.27.0

    Environment
    Cache writeable: true
    Shortcode Processor: Enlighter low-level
AndiDittrich commented 3 years ago

Hi @yuliu

i need more informations to investigate the issue:

yuliu commented 3 years ago

Hi, thanks for responding. Requested info is as follows. Do you need anything else?

* which editor/editing method did you use

Block editor.

* your plugin debug config
{
    "translation-enabled": false,
    "enlighterjs-init": "inline",
    "enlighterjs-assets-js": true,
    "enlighterjs-assets-themes": true,
    "enlighterjs-assets-themes-external": true,
    "enlighterjs-selector-block": "pre.EnlighterJSRAW",
    "enlighterjs-selector-inline": "code.EnlighterJSRAW",
    "enlighterjs-indent": -1,
    "enlighterjs-ampersandcleanup": false,
    "enlighterjs-linehover": true,
    "enlighterjs-rawcodedbclick": false,
    "enlighterjs-textoverflow": "break",
    "enlighterjs-linenumbers": true,
    "enlighterjs-theme": "classic",
    "enlighterjs-retaincss": false,
    "enlighterjs-language": "generic",
    "toolbar-visibility": "default",
    "toolbar-button-raw": true,
    "toolbar-button-copy": true,
    "toolbar-button-window": true,
    "toolbar-button-enlighterjs": false,
    "tinymce-backend": true,
    "tinymce-frontend": false,
    "tinymce-formats": true,
    "tinymce-autowidth": false,
    "tinymce-tabindentation": false,
    "tinymce-keyboardshortcuts": false,
    "tinymce-font": "sourcecodepro",
    "tinymce-fontsize": "0.7em",
    "tinymce-lineheight": "1.4em",
    "tinymce-color": "#000000",
    "tinymce-bgcolor": "#f9f9f9",
    "gutenberg-backend": true,
    "quicktag-backend": true,
    "quicktag-frontend": false,
    "quicktag-mode": "html",
    "shortcode-mode": "disabled",
    "shortcode-inline": true,
    "shortcode-type-generic": true,
    "shortcode-type-language": true,
    "shortcode-type-group": false,
    "shortcode-filter-content": true,
    "shortcode-filter-excerpt": true,
    "shortcode-filter-widget": false,
    "shortcode-filter-comment": false,
    "shortcode-filter-commentexcerpt": false,
    "gfm-enabled": false,
    "gfm-inline": true,
    "gfm-language": "generic",
    "gfm-filter-content": true,
    "gfm-filter-excerpt": true,
    "gfm-filter-widget": false,
    "gfm-filter-comment": false,
    "gfm-filter-commentexcerpt": false,
    "compat-enabled": false,
    "compat-crayon": false,
    "compat-codecolorer": false,
    "compat-type1": false,
    "compat-type2": false,
    "compat-filter-content": true,
    "compat-filter-excerpt": true,
    "compat-filter-widget": false,
    "compat-filter-comment": false,
    "compat-filter-commentexcerpt": false,
    "cache-custom": false,
    "cache-path": "",
    "cache-url": "",
    "dynamic-resource-invocation": true,
    "ext-infinite-scroll": false,
    "jetpack-gfm-code": false,
    "ext-ajaxcomplete": false,
    "bbpress-shortcode": false,
    "bbpress-markdown": false
}
.enlighter-default{}
* example code
mkdir /boot/netboot && cd /boot/netboot

Source editor mode:

<!-- wp:enlighter/codeblock -->
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">mkdir /boot/netboot &amp;&amp; cd /boot/netboot</pre>
<!-- /wp:enlighter/codeblock -->
AndiDittrich commented 3 years ago

your example looks correct - the & characters needs to be escaped with &amp

yuliu commented 3 years ago

So what's wrong here?

AndiDittrich commented 3 years ago

nothing - the sourcecode you've posted is correct.

i didn't see any issues

yuliu commented 3 years ago

Hmm.. but it displays wrongly.

2020-10-29 204426

AndiDittrich commented 3 years ago

is "ampersand cleanup" enabled in your advanced EnlighterJS options ?

yuliu commented 3 years ago

Seems to be no according to the debug config:

"enlighterjs-ampersandcleanup": false,

and also checked the config, it's not enabled.

AndiDittrich commented 3 years ago

enable it... it's required and automatically enabled in v4

yuliu commented 3 years ago

Oh yes that resolves the problem. Sorry but I don't read that in the upgrade notice and I was coming from v3 btw.

AndiDittrich commented 3 years ago

thanks for that hint. the setting is an artifact of previous versions where EnlighterJS used another filter ordering