Forum
Ace Editor code snippet html tag escape
I have opted to use the Ace Editor for blog posts as it seemed to be the best way to keep code clean & add classes (editor="ace" html="true"). Now I'm trying to incorporate code snippets in a potential post. I'm having trouble with html tag escaping.
<pre><code>
<h1>This is an h1 element!</h1>
</code></pre>
When I put this into the ace textarea and save, the bracket codes turn into the actual brackets "<" and ">". At the moment it seems to render out on the actual web post correctly but if I go back and save the post again, it will output an actual h1 element. I've looked into the Ace page a bit, and asked the internet but I can't readily find an option to tell Ace to NOT to format html special charaters or does this happen to be a Perch interaction?
Conversely, is there a textarea option that will add no extra html and not effect what is written in the text area?
Have you set
html="true"
on the template tag?Yessir
Are you outputting the post using the same template?
Oh sorry, yes.
Make sure you have the
type
attribute set.Okie dokie.
This doesn't affect my output. It's the admin area that is changing "<" to "<". I'm not sure if it's an interaction of the js editor or Perch.
I just tried removing the
editor="ace"
option to use the default editor and the problem persists.Which version are you running?
Here's an excerpt of diagnostics
Looks fine to me. Does the same happen with a new post now that Ace has been taken out of the equation?
Yep, same behavior.
I'll see if I can reproduce this here.
Any luck?
For better or worse I can work around the problem like this: