Pre

Preformatted

i.e. preserve whitespace

No br tags needed.

Code

<pre>Hello
World!</pre>

Result

Hello
World!

Code

Display code, using monospace. No syntax highlighting will be used.

Code

<code>
  console.log("Hello, World!");
</code>

Result

console.log("Hello, World!");

You probably want to use pre as well to preserve whitespace. Just remember to take out the whitespace around the code tags to avoid rendering those.


Code

<pre><code>console.log("Hello, World!");</code></pre>

<pre><code>console.log("Hello, World!");
console.log("Line 2")</code></pre>

Result

console.log("Hello, World!");
console.log("Hello, World!");
console.log("Line 2")

You can use a library for syntax highlighting, or use Markdown with backtick codeblocks.

Code

```html
<p>Hello, World!</p>
```

Samp

Sample output from a computer. It will be using monospace.

Code

<samp>
  Hello, World!
</samp>

Result

Hello, World!