How do I quote source code?
-
I have a blog where I talk about programming. I’ve been trying to use the HTML editor to quote program source in my blog, but there appear to be two problems. First, the style sheet keeps forcing my PRE blocks to use a proportional font. Second, the HTML editor keeps munging all the whitespace in the HTML making the source code unreadable and messing up all the indentation.
I don’t have total control over the wordpress installation either, but I can request support changes to it.
How can I get wordpress to show my source code without changing it?
-
I think the <CODE>This is code</CODE> tags would do it.
Best to use the non-visual editor for this section of your post. -
“WordPress installation?” I think you probably need to read the Read Me First sticky at the head of the forums; you could be at the wrong place. The answers will be different depending on whether you’re hosted at WP.com or not.
-
CODE isn’t enough, because it strips out the leading indentation and doesn’t honor end-of-line. CODE is fine for an isolated fixed-font word in the middle of a paragraph, but it isn’t sufficient for quoting code. Honestly, PRE works just fine for this in regular HTML, but WordPress messes it all up.
-
I refer you back to my point: is this a WordPress.com blog we’re talking about here, or one hosted elsewhere using WordPress software, because the answers are different.
- The topic ‘How do I quote source code?’ is closed to new replies.