Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I'm trying to paste some example XML snippets into a blog post on blogger, but everytime I save or preview the post, blogger seems to remove my XML tags and just display the parameters. I can't find a way of retaining code, there is no "code" button on the WYSIWYG editor

For example,

<MyTag>
 <myValue>some value</myValue>
</MyTag>

Becomes

some value

I've tried to surround it with the pre tag but that doesn't work either

Any ideas? I'd rather not have to screenshot code as that rules out copy/pasting in the future

share|improve this question

migrated from superuser.com May 13 '11 at 23:55

This question came from our site for computer enthusiasts and power users.

add comment

4 Answers 4

You can also paste your code to gist and a pretty link is available to display gist code in your blog, for example :

<script src="https://gist.github.com/Ameausoone/4714699.js"></script>
share|improve this answer
add comment

I've been using tohtml to format code for a while, and I just tested its output with blogger and it works. It will even give you syntax highlighting.

share|improve this answer
add comment

Copy and paste sourcecode onto : http://formatmysourcecode.blogspot.com/

It replaces any non-alphanumeric characters in your text, so you can then copy/paste it into your blog

share|improve this answer
add comment

&lt; and &gt should go in place of the angle brackets.

This isn't an issue with blogger, rather your web browser interpreting the <>s as tags, and so not displaying them. &lt; and &gt; mean < and >, respectively, to your web browser.

share|improve this answer
    
Thanks Phoshi, I was considering using that but didn't like the idea of doing that over a 50+ line snippet of code ;) –  James.Elsey Nov 8 '09 at 21:31
    
Ouch! You could try a find&replace, I suppose? :P –  Phoshi Nov 8 '09 at 21:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.