WordPress.org

Ready to get started?Download WordPress

Forums

WP SyntaxHighlighter
code collapses to one line (12 posts)

  1. Theo F
    Member
    Posted 2 years ago #

    When I insert several lines of html or css code it collapses and is shown on only one (too long) line. How can I avoid/correct this?

    http://wordpress.org/extend/plugins/wp-syntaxhighlighter/

  2. redcocker
    Member
    Plugin Author

    Posted 2 years ago #

    HI, Theo F san,

    I have some questions.

    1. Let me know your OS, browser and version.
    2. Are you using "code" button or "pre" button in the Visual editor?
    3. Go to Settings -> WP SyntaxHighlighter in the setting panel, you can find the sample code in the "7. Your Current Theme". Does it be shown correctly?
    4. Does any code cause this issue?

  3. Theo F
    Member
    Posted 2 years ago #

    Hello Redcocker san,

    I am using Windows Vista (with all updates) and browsers: IE 9.0.3, Firefox 8.0.
    I am using the code button and then choose either HTML of CSS (depending on the code that I want to insert).
    In the Settings panel of WP Syntaxhighlighter the Current Theme is showing correctly (28 lines of HTML code).
    I do not think that the code that I inserted causes this problem. It's very basic CSS (e.g.: color and background-color for body-tag) or HTML code written on several lines with the CoffeeCup HTML-editor and then copied/pasted in the code panel of WPSyntaxHighlighter.
    The strange thing is that the problem is not consistent. While writing this reply I again checked what happens if I insert some CSS code with WPSyntaxHighlighter. I did this in the same post that I used yesterday and created just for this purpose. When I inserted a new bit of CSS code (before and after each example of code I inserted a line of text enclosed in p-tags) not only did the new code stay show on several lines (as it is supposed to be because I inserted it that way) but also the other bits of code in the post changed from a rendering on one line to a rendering on several lines. I do not understand how this can happen. I checked and each code-example is enclosed in the pre-tags created by WPSyntaxHighlighter when you use the code-button. And I did not change any settings in WPSyntaxHighlighter either.

  4. redcocker
    Member
    Plugin Author

    Posted 2 years ago #

    HI, Theo F san,

    Thank you for your reply.

    When I inserted a new bit of CSS code (before and after each example of code I inserted a line of text enclosed in p-tags) not only did the new code stay show on several lines (as it is supposed to be because I inserted it that way) but also the other bits of code in the post changed from a rendering on one line to a rendering on several lines.

    Indeed, it is strange.

    I'll try to find the cause of the problem.

  5. redcocker
    Member
    Plugin Author

    Posted 2 years ago #

    HI, Theo F san,

    Did you get this issue when you saved your post as a draft and previewed it.

    If you are using plugins(more than one) that covert line feed to <br /> or stop automatic formatting(wpautop), They may cause this issue after you saved your post as a draft.

    e.g.
    PS Disable Auto Formatting
    brBrbr

  6. Theo F
    Member
    Posted 2 years ago #

    Hello Redcocker San,

    no I did not save the post as a draft and previewed it.

    By the way: I discovered afterwards that if I copy/paste a bit of CSS code which is shown on several lines by SyntaxHighlighter the code was written on one line by the CoffeeCup HTML editor. Do not know if this is relevant but thought I should mention it. Apperently it works both ways: copy/paste from HTML editor to SyntaxHighlighter insert-form can result in collapsing from several lines of code to one line of code and visa versa.

  7. redcocker
    Member
    Plugin Author

    Posted 2 years ago #

    Hi, Theo F san

    I discovered afterwards that if I copy/paste a bit of CSS code which is shown on several lines by SyntaxHighlighter the code was written on one line by the CoffeeCup HTML editor.

    Maybe, because CoffeeCup HTML editor supports only CR/LF.
    Wnen the code is pasted to Windows Notepad also, line feed will be lost.

    I want to test with CoffeeCup HTML editor.
    Where can I get CoffeeCup HTML editor?

    Here?
    http://www.coffeecup.com/free-editor/

  8. Theo F
    Member
    Posted 2 years ago #

    Hi Redcocker san,

    yes you can find the editor there. I am using the free editor as well.

    I will check if using Dreamweaver makes a difference.

  9. Theo F
    Member
    Posted 2 years ago #

    Hello Redcocker san,

    No need to try CoffeeCup editor. The problem also happens with Dreamweaver CS5.5. I just now inserted two simple lines of CSS code in the SyntaxHighlighter that were written in Dreamweaver on two seperate lines and they collapsed to one line directly after using Update.

  10. redcocker
    Member
    Plugin Author

    Posted 2 years ago #

    Hi, Theo F san,

    When all plugins are disabled except WP SyntaxHighligter, How does it work?

    I think installed plugins cause this isuue.
    If you are using plugins that covert line feed to <br /> or stop automatic formatting, WP SyntaxHighligter can't work correctly.

    If you are using "TinyMCE Advanced" plugin, don't enable "Stop removing the <p> and <br /> tags when saving and show them in the HTML editor".

  11. Theo F
    Member
    Posted 2 years ago #

    Hi redcocker san,

    I have changed this setting in Tiny and it does have the desired effect with SyntaxHighlighter. I used this setting in Tiny because of other problems I had with posts but cannot remember what they were.

    Thanks anyway

    Theo

  12. redcocker
    Member
    Plugin Author

    Posted 2 years ago #

    Hi, Theo F san,

    If "Stop removing the <p> and <br /> tags when saving and show them in the HTML editor" is enabled, "TinyMCE Advanced" adds extra <br /> into the text wrapped in <pre> tag.

    Maybe SyntaxHighlighter Evolved works in your settings correctly, because it supports not <pre> tag but shortcode.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic