Square brackets in code snippets converted to unicode

Hi,

I am trying to put square brackets in a classic code snippet in cornerstone, but sadly in my post they show up in unicode format, I guess because they are converted by wordpress for shortcodes? So I see &#-91;(ngModel)&#-93;=" without the dashes instead of [(ngModel)]="…Is there a way to escape the shortcode brackets so in the code snippets they don’t get converted?
Thanks!

Hello @harpduck,

Thanks for asking. :slight_smile:

Please try adding adding the code in Classic Raw Content element or V2 test element. Also can you please let us know or share the code you are trying to add?

Thanks.

Hi, the problem is that I want to put html in the code snippet.

It should be [(ngModel)]=“ibanValue”
Basically, if I put it in the Raw content or text element, what happens is that I don’t see the HTML markup, but the input element itselt shows on the screen, and I basically just want to see the html text behind the controls.

All in all, I can just make an image and put it, but like that, people can’t copy/paste the html and it’s not that user friendly… Or put it in an iframe and link a codesnippet site, but I hoped there would be an easier solution.

Hi there,

Are you using the updated version of X and Cornerstone? I tried adding some square brackets in a code snippet element and it seems to save fine as it is.

In case you are still having an issue, kindly update your theme and Cornerstone version.

Another thing you can try is to use a text element but wrap the code in:

<pre class="x-code" style="font-size:13px;">
    <code>
        <!-- Place the code here -->
    </code>
</pre>

Hope this helps.

Hi, I was not using the updated version. I updated the theme, but I still did not get the result. But when testing, I saw that it only displays it wrong when it is used as an attribute.

But I got it working with the pre and code tags when I first escape < and &.

Thank you for the alternative!

You’re welcome. Glad we could help.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.