WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Codecolorer] Be smart about stripping leading whitespace (3 posts)

  1. FeepingCreature
    Member
    Posted 5 years ago #

    Remove leading and trailing empty lines, without removing leading whitespace on the first actual line.

    $ diff codecolorer.php.old codecolorer.php
    220c220,221
    < $text = trim($text);
    ---
    > $text = preg_replace('/^( *\r?\n)+/', '', $text);
    > $text = preg_replace('/\r?\n *$/', '', $text);

  2. kpumuk
    Member
    Posted 4 years ago #

    Thank you for your suggestion. Implemented in version 0.8.3. Could you send me a link to add it to changelog near your name? (and also your name, if FeepingCreature is not meet your requirements).

  3. Francis Crossen
    Member
    Posted 4 years ago #

    Great plugin thanks...

    I'm having a problem with whitespace.

    I used [ ccenl_PHP][/ccenl_PHP] and copied some code in. However if I switch from the 'Visual' editor to 'HTML' and back to 'Visual' the leading whitespace in front of each line is removed.

    This is affecting my indentation.

    Is it me, a feature or a bug?

Topic Closed

This topic has been closed to new replies.

About this Topic