• Resolved geovvanysuarez

    (@geovvanysuarez)


    Hello,

    First off, thanks for your plugin. It’s quite useful and great. Secondly, I have an issue with <br> tags. When I insert something like this in my editor

    <pre class="EnlighterJSRAW" data-enlighter-language="python">a = 20
    print(a)</pr>

    The automatically generated <br> tag is added to the frontend too, please see the following image:

    https://jmp.sh/qLgSlbk

    It also happens when I actually use the <br> tag like this

    <pre class="EnlighterJSRAW" data-enlighter-language="python">a = 20<br>print(a)</pr>

    Not sure if I’m missing something. Would you please lend me a hand on this?

    I would only like to keep the line break, but not the <br> actual tag.

    Thanks a lot in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Andi Dittrich

    (@andi-dittrich)

    using HTML markup within an Enlighter codeblock is not supported – everything within a target codeblock is threatened as the “target language”

    just add normal linebreak in the editor and use the visual editing modes of TinyMCE or Gutenberg

    Thread Starter geovvanysuarez

    (@geovvanysuarez)

    Hi Andi,

    Thanks SO much for your reply. I’m not inserting the <br> inside the editor. The editor automatically inserts it, this is how I have my code currently

    https://jmp.sh/zH1dlNB

    Not sure if there is a way to avoid the br tag from displaying

    https://jmp.sh/qLgSlbk

    Thanks again for your help.

    Plugin Author Andi Dittrich

    (@andi-dittrich)

    this doesn’t looks like any supported WordPress standard editor…

    Thread Starter geovvanysuarez

    (@geovvanysuarez)

    Hi Andi,

    It’s not any WordPress standard edition. Sorry for not clarifying earlier. I’m trying to insert

    <pre class="EnlighterJSRAW" data-enlighter-language="python">a = 20
    print(a)</pr>

    Inside a text area field, not an editor. Here is where the <br> is generated automatically and it’s displayed in the frontend.

    Not sure if there is something to avoid displaying the <br> tag.

    Thank you a lot for your help in advance.

    Plugin Author Andi Dittrich

    (@andi-dittrich)

    again: you cannot use html markup for styling within a codeblock

    normally pre tags as well as shortcodes are “immutable” in WordPress and no modifications (like nl2br in your case) are applied to such kind of content.

    your thirdparty plugin (not Enlighter) violates these rules and just replaces each linebreak \n with <br/> tags (php function nl2br). therefore it’s required to change this behaviour in your third party plugin (e.g. remove the filter function or use a complex filter which takes care of pre tags and shortcodes).

    if your external plugin provides filter-hooks around the automatic linebreaks it’s possible to add some code to use the Enlighter shortcode feature – it makes the shortcodes temporary immutable for such filters.

    Thread Starter geovvanysuarez

    (@geovvanysuarez)

    Thanks for your reply. I’ll take a look.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Issue with br tags’ is closed to new replies.