I have come quickly to loathe wordpress, but godaddy nuked the website code I wrote years ago when amex rejected the second of the double-debits they were sneaking on my account.
Anyway, I'm trying to paste code into wordpress, and it's been a disaster. Wordpress just plain eats pasted data between brackets, and any # sign in the first column. I've found out of date articles on using a code statement in brackets (much like here), but that just repeats the code statement. Similarly for sourcecode which seems to be an error in the post suggesting it, as it links to the code example.
I've also tried playing with pre, and that doesn't seem to do it either. I've even combined them in both orders.
I've tried to search through the plugins, but they all seem to want to do everything.
All I want or need is to do exactly what this site does with the code directive, but I'm failing. I could even sacrifice the scrolling . . .
At the moment, I'm having to manually type in all of the # and pointy bracket stuff, and I'm certain that I'll miss some.
Suggestions? Better search terms than I used ("code" overwhelms the results with code to do something!)
I don't know anything about Wordpress. The Arduino IDE does have a feature that might be useful to you: Edit > Copy as HTML. That will copy an HTML code representation of your sketch to the clipboard, from which you can paste it to your Wordpress.
Wordpress ought to have some sort of "verbatim quote" or "code" option shouldn't it? Most BBcode based websites do, I wonder f you could get your wordpress site to hold some BBcode in which the arduino code could be wrapped?
It has that, but it just doesn't seem to work correctly. I also found a "won't fix" bug for its munging of html comments, which seems similar. The "preformatted" paragraph format seems to largely work--except for stripping the # signs for comments! [hmm. Now that I think of it {from mentioning the # sign}, I was working with python for the pi today, not Arduino. Guess I'll have to try and see if it works tomorrow . . .)
I found another trick today (by inspiration, not documented or found on the web) of using my editor (vim) to add a space to the beginning of each line before copying. This seems to defeat the deletion off comment markers (but we'll see tomorrow if it works for // as well . . .)
Maybe I should take the three days to rewrite my own again . . . (it was eaten by godaddy after their double-billing error) . . . it might be less work . . . but then, that means either switching to a VPS to use Postgres like my main product, or facing mySQL that comes on the shared servers . . .