Support » Fixing WordPress » Posting code – WYSIWYG editor screws things up

  • JohnA

    (@johna)


    Using WordPress 2.1

    Trying to post code into a post is a nightmare.

    Here’s what I want to post:

    ‘download_html < – function(url) {
    download.file(url, “temp.html”);
    html_handle < – file(“temp.html”, “rt”);
    html_data <- readLines(html_handle);
    close(html_handle);
    unlink(“temp.html”);
    return(html_data);
    }
    url_escape < – function(string) {
    string <- gsub(” “, “%20”, string)
    string <- gsub(“#”, “%23”, string)
    string <- gsub(“&”, “%26”, string)
    string <- gsub(“=”, “%3D”, string)
    string <- gsub(“\\?”, “%3F”, string)
    return(string);
    }’

    and here’s what comes out:

    ‘download_html & lt; – function(url) {
    download.file(url, “temp.html”);
    html_handle & lt; – file(“temp.html”, “rt”);
    html_data & lt;- readLines(html_handle);
    close(html_handle);
    unlink(“temp.html”);
    return(html_data);
    }
    url_escape & lt; – function(string) {
    string & lt;- gsub(” “, “%20”, string)
    string & lt;- gsub(“#”, “%23”, string)
    string & lt;- gsub(“&”, “%26”, string)
    string & lt;- gsub(“=”, “%3D”, string)
    string & lt;- gsub(“\\?”, “%3F”, string)
    return(string);
    }’

    Now I’ve even tried installing the Code Markup plug-in but the problem is that the WYSIWYG editor renders the ‘<‘ as ‘& lt;’ and I get them all back!

    It’s a nightmare. How do I post code on WordPress and get the WYSIWYG editor to stop screwing it up?

Viewing 1 replies (of 1 total)
  • gayleard

    (@gayleard)

    This is far from an answer to your query – just a very newbie question that you can probably answer.

    You speak of “the WYSIWYG editor”, which seems to suggest that there are other editors than one can use. Is that so? And if so, where does one find and install such an editor?

    My problem is that my WP editor seems to have lost its WYSIWYG character, and now shows <p>, </p> and other tags all over the place.

Viewing 1 replies (of 1 total)
  • The topic ‘Posting code – WYSIWYG editor screws things up’ is closed to new replies.