rainbow icon indicating copy to clipboard operation
rainbow copied to clipboard

Rainbow inserting non-existent closing tags (XML)

Open exside opened this issue 11 years ago • 2 comments

First of all, thanks for that great plugin, love it =)!

I just copy/pasted the html markup extension, renamed it to xml and changed the "extend" part in the js file to xml because I have an xml file I want to highlight...actually this has nothing to do with the following problem (as far as I can tell), because it also happens when I'm using generic or html or whatever highlighting...

my XML file contains something like

<field key="songid" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />

this is also like that in the source code of the page where it's included, but when rainbow "goes over it" it replaces all the whitespace (multiple spaces between the attributes, also stripped out here =D) and inserting a </field> tag instead of just leaving my markup as it is...

I couldn't find out where or why this is done, I think in some cases this additional processing of input code is good, but we should be able to not use it if not desired and have the code just show up "as it is"...can this be done somehow?

thanks for your great work, keep it up!

exside avatar Mar 18 '13 10:03 exside

Okay so a couple things. First of all I would just set the language to html for xml to get the highlighting cause as far as the syntax highlighting goes they should be the same.

Second, I believe the problem is from putting actual markup in the pre tag. If you replace all < with &lt; and all > with &gt; it should work correctly.

You have to remember the browser is trying to render the markup if it sees it as markup. This is something you don't have to worry about with server side syntax highlighting libraries.

ccampbell avatar Mar 18 '13 21:03 ccampbell

I have an actual XML highlighting language file =_= see this is why you should support this.

nijikokun avatar Mar 19 '13 02:03 nijikokun