• MarvelThang

    (@snoopydmt)


    I use Evernote to send posts.
    This sample post send to my debug email exported into HTML:

    .....
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <meta http-equiv="Content-Type" content="text/html; " />
      <style type="text/css" media="screen">
    ...
      </style>
    </head>
    <body style="font-size:12px;color:#262626;line-height:1.3;font-family:Arial, Helvetica, sans-serif;background-color:#fff;">
    <div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="ennote"><div><div style="font-size: 15px;"><div><div>The double arrow operator, “=>”, is used as an access mechanism for arrays.</div><div>
    ...
    </div><div><br/></div><pre xml:space="preserve"><code><?php
    $myArray = array(
     0 => 'Hello',
     1 => 'world',
     2 => 'SnoOpy'
     );
     ?>
    </code></pre>
    .....

    The code portion display as my intend, but when send to Jetpack address and become WordPress post:

    .....
    The double arrow operator, “=>”, is used as an access mechanism for arrays.
    ...
    The index can be associative (string based) or numeric.
    
    <pre><code><?php $myArray = array( 0 => 'Hello', 1 => 'world', 2 => 'SnoOpy' ); ?> </code></pre>
    .....

    Code no longer have line breaks, tabs cause long code very very hard to read.

    So I catch post content before it save to database to verify WordPress not drive it wrong way:

    function SnoOpy_Debug( $content ) {
    	$fh = fopen("snoopy-evernote.log","a");
    	fwrite( $fh, $content );
    	fclose( $fh );
    }
    add_filter( 'content_save_pre' , 'SnoOpy_Debug' , 1, 1 );
    .....
    The double arrow operator, “=>”, is used as an access mechanism for arrays.
    ...
    The index can be associative (string based) or numeric.
    
    <pre><code><?php $myArray = array( 0 => \'Hello\', 1 => \'world\', 2 => \'SnoOpy\' ); ?> </code></pre>
    .....

    How to fix this problem, Jeremy?

    Site: MinhThang’ Blog

Viewing 1 replies (of 1 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    I’m afraid you won’t be able to fix this issue. Jetpack’s Post By Email module filters all content that is sent via email, and will indeed remove some of the formatting in your email, to avoid breaking the post layout.

    While that’s useful when posting text, it becomes an issue when posting code snippets.

    I’m afraid I don’t have a work around to fix that problem. You’ll need to edit your posts manually in your dashboard, and there currently isn’t a way to disable the automatic formatting done by Jetpack’s Post By Email module.

    Sorry not to be able to help you more.

Viewing 1 replies (of 1 total)
  • The topic ‘Post by email cause my code display incorrectly!’ is closed to new replies.