0

I have been given the task of publishing our existing documentation to a Confluence wiki. I'm using node.js and jQuery to convert the html output from our doc tool to the Confluence format, and everything is going well, except when I try to display code. The problem has to do with CDATA. Confluence says this is how to create a code block:

<ac:structured-macro ac:name="code">
  <ac:plain-text-body>
    <![CDATA[Code to be displayed goes here.]]>
  </ac:plain-text-body>
</ac:structured-macro>

None of my attempts to create a CDATA node have worked, and I can't seem to find any doc anywhere on how to create a CDATA node in this context. Using jQuery's .html() makes the CDATA node into a comment, and .text() escapes the entities. Of course, this is exactly what the jQuery doc says they will do. So I'm stuck.

Maybe CDATA and jQuery just don't work this way? Admittedly I haven't studied CDATA much--it didn't occur to me that it would be an object of much study.

Am I totally doing this wrong? Is there a more "best practices" way of doing it?

SaganRitual
  • 3,143
  • 2
  • 24
  • 40

0 Answers0