sh4nks / sublime-text-plugin-autoclose

A simple Sublime Text Plugin that auto closes HTML tags right after '>'.
GNU General Public License v3.0
7 stars 1 forks source link

tags inside CDATA #1

Open billynoah opened 6 years ago

billynoah commented 6 years ago

Is there some way to get this to work inside CDATA sections? In beta version of Sublime it worked fine but after updating the main app (correctly?) does not parse tag elements inside CDATA sections so breaks tag closing in those areas.

michaelzoidl commented 6 years ago

+1

Same for JS/JSX files (e.g. react-components) Is there a way to enable the plugin for other file-types?

sh4nks commented 6 years ago

Could you post an example here that I could use?

michaelzoidl commented 6 years ago

Sure, here is some example where i want to use this plugin, i expect in the DOM part of the file the same behaviour like in normal HTML files.

Filename: hello-world.js Content:

export default () => (
  <div>
    <Text>Hello World!</Text>
    <Emoji fire />
  </div>
);
billynoah commented 6 years ago

@sh4nks, although yours is related, it might be considered a separate issue.

@michaelzoidl - Thanks for your reply. To address the original topic of tag completion inside CDATA - here is an example:

<?xml version="1.0" encoding="UTF-8"?>
<fruit>
    <name>Apple</name>
    <description><![CDATA[ <div>Best fruit ever</div> ]]></description>
</fruit>

You'll note the <div> tags inside the CDATA section will not complete. This is a frequent use issue for me adding html code inside vQmod xml files.

Also, I realize that in some scenarios parsing tags inside of CDATA could potentially be troublesome so if you are able to implement this feature it may be worth adding a preferences toggle of some sort.

sh4nks commented 4 years ago

Hi @billynoah

sorry for my very late. I'll take a look at this issue later this or next week.

What is the desired behavior? Should it complete the ]]> after writing <![CDATA[?

Nevermind. I just read the bug description again.