• Resolved Navjot Singh

    (@navjotjsingh)


    Example: [ redundant link removed, use the link field ]

    Single line code gets formatted differently (it picked my theme’s formatting) while multiple lines get formatted using Prism.

    In the editor, there is no difference between how I entered the text. Both are written like
    <pre><code class="language-bash"> the code in between </code></pre>
    but the output is still different.

    What to do?

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Hi @navjotjsingh, it looks like there may be an issue with Prism.js and single-line highlighting. The plugin basically only loads the required Prism.js scripts, so there is not a lot I can do for the actual script output/results. Best advice would be to ask the Prism.js support team for help. Here is the Github page for Prism issues.

    I hope this helps, let me know if I can provide any further infos.

    Stef

    (@serafinnyc)

    I think certain block editors, if not using Gutten, and even some themes strips the code formatting out. I struggled with it too Jeff and even after switching over to Highlight.js.

    I know for myself I’m using Visual Composer and it’s stripping the
    <php and the ?> Out of the page, both admin side and content side.

    Great plugin by the way.

    Plugin Author Jeff Starr

    (@specialk)

    Thanks Stef. For my own sites I disable all the block editor stuff and just use plain-text editor via my Disable Gutenberg plugin. That prevents interference and keeps the code display clean and proper. I know that’s not a possibility for all sites, but I am mentioning here just FYI. Also if you happen to discover any further clues as to what might be removing the code formatting, please let me know. I am glad to do anything possible (from the plugin side of things) for compatibility, etc.

    Stef

    (@serafinnyc)

    Welcome. I think it’s TinyMCE that’s stripping some of it. Certain characters. Not positive but leaning that way for now.

    I noticed that when I turn off TinyMCE

    add_filter( 'user_can_richedit' , '__return_false', 50 );

    Anything PHP plays nice. Turn it back on and it gets stripped. I’m also noticing that I can’t use Prism and can only use Highlight. Still trying to figure that one out when I have time.

    Plugin Author Jeff Starr

    (@specialk)

    Thanks for posting, @serafinnyc. Please keep me updated as to your findings.

    Stef

    (@serafinnyc)

    I’ve tracked it down to Visual Composer. However, I can use the Gutenberg Editor that I have inside VC and it won’t strip anything. That’s just too many steps to add code.

    I think I may write a module that gets added to VC that’s only for source code. Not sure yet.

    Plugin Author Jeff Starr

    (@specialk)

    Very interesting. If there is anything that can be added via Prismatic side of things, let me know.

    Stef

    (@serafinnyc)

    I will. For now I turned off VC inside Posts. It appears to work perfectly now. Something in VC is stripping the source code when you use:

    ->

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Single line code gets formatted differently’ is closed to new replies.