Yes, i have found other questions to this topic, but no have the same topic exactly and no solution for my problem.

If you include code inside the html-tab and you switch to the visual mode, then format WP the code to a block, remove all breaks and leave lines, see the screenshots. I think this easier to understand as my bad english.

my example in html-tab enter image description here

the same example after switch to visual enter image description here

My tests for an solution. i have test this to stop WP for this with the follow test plugin, also readable in this Gist 1663554

add_filter( 'tiny_mce_before_init', 'fb_tinymce', 9 );

function fb_tinymce( $init ) {

    $init['fix_list_elements'] = FALSE;
    $init['wpautop'] = FALSE;
    $init['remove_linebreaks'] = FALSE;
    $init['apply_source_formatting'] = TRUE;
    $init['extended_valid_elements'] .= ',pre[*],code[*]';

    return $init;
}

Maybe an other reader has an solution for this topic.

link|improve this question

50% accept rate
Did I understand this right? You want to stop the editor to remove line breaks inside code? – kaiser Feb 7 at 4:05
yes, if you include code on the html-editor and switch to the visual mode, WP remove all breaks, paragraph. This works with the editor.js and i dont fond an filter for this; maybe is hard coded and my only goal is to replace this js; but its not very fine; i will deactivate this once feature. – bueltge Feb 7 at 8:35
feedback

1 Answer

I think the easiest solution for what you're describing is a plugin like: http://wordpress.org/extend/plugins/wp-no-format/

However, you might also want to look at syntax highlighting plugins... there is even one for embedding gists by id.

link|improve this answer
I think, this it's not an solution, this plugin filter only the_content-Hook. This hook is only on frontend to get the content, not inside the editor. – bueltge May 9 at 11:43
Sorry. That is correct, this does not prevent the visual editor switch from reformatting the code.... It's been a long time since id actually used it and looking now at the old site I used it in conjunction with Disable Visual Editor. – jb510 May 9 at 17:16
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.