Search code examples
xmltextformattingcdatarichtext

How to put not parse some markup tags inside CDATA


How would I output something like this inside CDATA: <b>**bold text**</b>?

The following didn't work:

<![CDATA[&lt;b><b>bold text</b>&lt;/b>]]>

&lt; doesn't get converted to <, so it shows &lt;b>**bold text**&lt;/b>

Another line I tried is the following:

<![CDATA[<b><b>bold text</b></b>]]>

Unfortunately it didn't work either, just shows bold text.

The reason I need to do this is simply to include written CRDATA reference, or cheat sheet, into an application that supports CRDATA. I have since solved the issue as outlined in my answer to this question, I used a zero-width space to create fake formatting.


Solution

  • alright i found an answer I added a zero-width space to one of the <b> and </b> tags like this <*space*​b><b>bold text</*space*b></​b>, the output is this <​b>bold text</​b> as you can see it works copied it from here https://invisible-characters.com/