Posting code – WYSIWYG editor screws things up
-
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?
- The topic ‘Posting code – WYSIWYG editor screws things up’ is closed to new replies.