<p>I'm trying to write a blog post which includes a code segment inside a <code>&lt;pre&gt;</code> tag. The code segment includes a generic type and uses <code>&lt;&gt;</code> to define that type. This is what the segment looks like:</p>

<pre><code>&lt;pre&gt;
    PrimeCalc calc = new PrimeCalc();
    Func&lt;int, int&gt; del = calc.GetNextPrime;
&lt;/pre&gt;
</code></pre>

<p>The resulting HTML removes the <code>&lt;&gt;</code> and ends up like this:</p>

<pre><code>PrimeCalc calc = new PrimeCalc();
Func del = calc.GetNextPrime;
</code></pre>

<p>How do I escape the <code>&lt;&gt;</code> so they show up in the HTML?</p>

[{'answer_id': 42189, 'author': 'OwenP', 'author_id': 2547, 'author_profile': 'https://Stackoverflow.com/users/2547', 'pm_score': -1, 'selected': False, 'text': "<p>It's probably something specific to your blog software, but you might want to give the following strings a try (remove the underscore character):\n&amp;_lt; &amp;_gt;</p>\n"}, {'answer_id': 42191, 'author': 'toolkit', 'author_id': 3295, 'author_profile': 'https://Stackoverflow.com/users/3295', 'pm_score': 3, 'selected': False, 'text': '<p>How about:</p>\n\n<pre><code>&amp;lt; and &amp;gt;\n</code></pre>\n\n<p>Hope this helps?</p>\n'}, {'answer_id': 42192, 'author': 'ckpwong', 'author_id': 2551, 'author_profile': 'https://Stackoverflow.com/users/2551', 'pm_score': 3, 'selected': False, 'text': '<p><code>&amp;lt;</code> and <code>&amp;gt;</code> respectively</p>\n'}, {'answer_id': 42193, 'author': 'crashmstr', 'author_id': 1441, 'author_profile': 'https://Stackoverflow.com/users/1441', 'pm_score': 4, 'selected': False, 'text': '<p>Use <code>&amp;lt;</code> and <code>&amp;gt;</code> to do <code>&lt;</code> and <code>&gt;</code> inside html.</p>\n'}, {'answer_id': 42194, 'author': 'Chris Marasti-Georg', 'author_id': 96, 'author_profile': 'https://Stackoverflow.com/users/96', 'pm_score': 5, 'selected': False, 'text': '<pre class="lang-html prettyprint-override"><code>&lt;pre&gt;&amp;gt;&lt;/pre&gt;\n</code></pre>\n\n<p>renders as:</p>\n\n<pre>&gt;\n</pre>\n\n<p>So you want:</p>\n\n<pre><code>&lt;pre&gt;\n    PrimeCalc calc = new PrimeCalc();\n    Func&amp;lt;int, int&amp;gt; del = calc.GetNextPrime;\n&lt;/pre&gt;\n</code></pre>\n\n<p>which turns out like:</p>\n\n<pre>\n    PrimeCalc calc = new PrimeCalc();\n    Func&lt;int, int&gt; del = calc.GetNextPrime;\n</pre>\n'}, {'answer_id': 42195, 'author': 'John Sheehan', 'author_id': 1786, 'author_profile': 'https://Stackoverflow.com/users/1786', 'pm_score': 8, 'selected': True, 'text': '<pre><code>&lt;pre&gt;\n    PrimeCalc calc = new PrimeCalc();\n    Func&amp;lt;int, int&amp;gt; del = calc.GetNextPrime;\n&lt;/pre&gt;\n</code></pre>\n'}, {'answer_id': 42201, 'author': 'akdom', 'author_id': 145, 'author_profile': 'https://Stackoverflow.com/users/145', 'pm_score': 2, 'selected': False, 'text': '<p>What <a href="https://stackoverflow.com/questions/42182/how-to-escape-and-inside-pre-tags#42186">rp said</a>, just replace the greater-than(>) and less-than(&lt;) symbols with their html entity equivalent. Here\'s an example:</p>\n\n<pre><code>&lt;pre&gt;\n    PrimeCalc calc = new PrimeCalc();\n    Func&amp;lt;int, int&amp;gt; del = calc.GetNextPrime;\n&lt;/pre&gt;\n</code></pre>\n\n<p>This should appear as (this time using exactly the same without the prepended spaces for markdown):</p>\n\n<pre>\n    PrimeCalc calc = new PrimeCalc();\n    Func&lt;int, int&gt; del = calc.GetNextPrime;\n</pre>\n'}, {'answer_id': 27536517, 'author': 'PanicBus', 'author_id': 2526710, 'author_profile': 'https://Stackoverflow.com/users/2526710', 'pm_score': -1, 'selected': False, 'text': "<p>A better way to do is not to have to worry about the character codes at all. Just wrap all your code inside the <code>&lt;pre&gt;</code> tags with the following</p>\n\n<pre><code>&lt;pre&gt;\n${fn:escapeXml('\n  &lt;!-- all your code --&gt;\n')};\n&lt;/pre&gt;\n</code></pre>\n\n<p>You'll need to have jQuery enabled for it to work, tho.</p>\n"}]
['https://Stackoverflow.com/questions/42182', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/373/']