Define the text inside the <code> element as preformatted text (to preserve spaces and line breaks).
<p>Code example:</p>
@(5)<code>var person = {
firstName:"John",
lastName:"Doe"
}</code>@(6)
<p>Code example:</p>
<pre><code>var person = {
firstName:"John",
lastName:"Doe"
}</code></pre>