I have XML Documents with html and javascript code written between CDATA. for example:
<element active='yes' type='Html' instance='LOGO'>
<body>
<![CDATA[
<div class="logos" id="logos">
<img class="float_right" src='mylogo.png' />
</div>
]]>
</body>
</element>
Another example:
<element active="yes" type="Html" >
<![CDATA[
<script>
//Some javascript code
</script>]]>
</element>
I want my IDE (Visual Studio or VSCode) to recognize my text between CDATA as HTML/Javascript code, and format the code. Do you know any solution for this? I tried to find some extention that do it, but couldent find anything.
I have found the solution:
Change <!\[CDATA\[ to <!\[CDAT A\[ in file
C:\Users\USERNAME\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\xml\syntaxes\xml.tmLanguage.json
Now XML wouldn't find <![CDATA[ :)
I also made similar changes in Emmet config:
C:\Users\USERNAME\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\emmet\dist\node\emmetNodeMain.js
Make this files 'Read only' in Properties to have no problems after the next VS update.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With