I am using Drupal as a blog for posts about programming. Naturally, I have to post code samples.
When I post the code samples, Drupal renders them as actual HTML. How can I stop this from happening?
Example,
<h1 style="font-style: italic; font-variant: small-caps; font-weight: normal; font-size: 13px; line-height: 150%; font-family:Arial, Helvetica, sans-serif; color: #000;">Thank You</h1>
^ This gets displayed as the words "Thank You" with the listed formatting in the inline style.
<!--[if gte mso 9]>
<style type="text/css">
.contact {
display:none;
}
</style>
<![endif]-->
^ This doesn't get displayed at all.
Steps I have taken
I have created a new input format and turned off all the filters.
I wrap the code in both <code>
and <pre>
tags.
I know Drupal has a filter called " Display any HTML as plain text". If I use this, then it works. But then all my formatting for the test of the post (e.g. paragraphs, links) get displayed as text making the post unreadable.