Reputation: 2031
Ok, so weird one. Is it possible to escape a </pre>
tag in a <pre>
block?
I have a project wiki in Redmine. It uses Coderay for syntax highlighting, like so:
<pre>
<code class="JavaScript">
//your JS code here
</code>
</pre>
I'm writing a wiki explaining to our users how to use Redmine. I need to document above... but this results in nested <pre>
tags:
<pre>
<pre>
<code class="JavaScript">
//your JS code here
</code>
</pre>
</pre>
Output:
<pre>
<code class="[LANGUAGE NAME]">
//your JS code here
</code>
The last </pre>
is missing as it closes the previous <pre>
tag. Is there any way I can escape the </pre>
so that it is displayed?
Desired Ouput:
<pre>
<code class="[LANGUAGE NAME]">
//your JS code here
</code>
</pre>
Upvotes: 1
Views: 1608
Reputation: 179284
If you want <
, >
, "
, and &
characters to be rendered as text in HTML you need to use their HTML entity counterparts:
<
becomes <
>
becomes >
"
becomes "
&
becomes &
<pre>
<pre>
foo bar baz
</pre>
</pre>
In some special cases you may want '
escaped, in which case you should use '
(or '
if you don't need to worry about old versions of IE).
Upvotes: 4