Afternoon all -
Displaying EE code in entries has always, for me anyway, caused issues. I don’t want to highlight code, I just want to display it without it being parsed, without it showing entities instead of brackets, and without it adding HTML formatting that I don’t want.
Looking in the EE blog they use the built in [ code ] highlighter but that seems to leave ugly empty paragraph tags before and after the codeblock.
If I just use an HTML code tag with my code inline like this:
This is some code <code>{embed="globals/_start"}I get this:
This is some code &# 123;embed=“globals/_start”&# 125; inline. (spaces added so we don’t all fall into an infinity loop).
Then I add a < pre > tag to really start confusing matters
<pre>
<code>
{cf_features_body}
<div id="red">
hello
</div>
{embed="globals/_start"}
</code></pre>
This ends up as:
{cf_features_body}
<div id="red">
hello
</div>
&# 123;embed="globals/start"&# 125;Why are the curly brackets in the embed being encoded but not the ones in the custom variable? Some EE security?
The fun really starts if any of the code has a line space in it. This:
<pre>
<code>
{embed="globals/start"}
{cf_features_body}
<div id="red">
hello
</div>
</code></pre>
Becomes this:
{embed=“globals/start”}
{cf_features_body}
helloNotice the embed brackets now display fine but the HTML div now actually used instead of just displayed.
I’m using Textile which may be confusing things by encoding what EE has already encoded but I promise you similar oddities are accuring when I just use the XHTML formatting.
Either way I’m slowly losing my mind over what should be a (fairly) simple task.
Anyone able to offer a solution? Or a large drink?
BTW, I’ve looked at the Geshi and code highlighter extensions and both seem to add more problems than solutions.