XML Comments not highlighted
XML comments within <!-- --> tags are displayed in black text, while URLs appear to be identified as comments and given the green text style.
I am not a Java developer, but looked through the code and think it is simply a problem with the xmlComments pattern. Here is the code I jumped through:
Line 42 in the above file looks to set the rule for finding comments -
_regExpRuleList.add(new RegExpRule(RegExpRule.xmlComments, "comments")); // <!-- ... -->
I went from that line to find the code defining RegExpRule.xmlComments and found it in this file: RegExp Code
Line 65 of this file does not look like an expression that would find XML comments -
public static final Pattern xmlComments = Pattern.compile("\\w+:\\/\\/[\\w-.\\/?%&=:@;]*");
Comments (9)
-
repo owner -
reporter This block has several examples:
<?xml version="1.0" encoding="utf-8" ?> <!-- comments --> <rootNode> <childNodes> <childNode attribute = "value" namespace:attribute='value' attribute=/> <childNode /> <childNode /> <childNode /> <childNode attr1="value" attr2="10" attr3="hello" > value </childNode> <namespace:childNode> <![CDATA[ this is some CDATA content <!-- comments inside cdata --> <b alert='false'>tags inside cdata</b> ]]> value = "plain string outside" hello = world </namespace:childNode> </childNodes> </rootNode> <!-- -- Multiline comments <b>tag</b> --> <price> <!-- PR.24.49 Price type code = Testing inc tax --> <j148>02</j148> <!-- PR.24.50 Price type qualifier = Home or Away--> <j261>06</j261> <!-- PR.24.50 Price type description = Inside or Outside--> <j262>List price for testing in country</j262> <!-- PR.24.63 testing price --> <j151>19.99</j151> <!-- PR.24.64 Currency code --> <j152>AUD</j152> <!-- PR.24.65 Country code --> <b251>AU</b251> </price>
-
repo owner <!-- ... --> inside CDATA is not treated as comment, right?
-
reporter Correct. If you inspect the elements on the page with the example, you will see the class is set to "c" for the elements which are identified as comments.
-
repo owner - changed status to open
-
repo owner Bugfix see commit a1e44b0.
-
repo owner - changed milestone to 2.2.0
-
repo owner - changed status to resolved
-
reporter Thank you for resolving so quickly...brief check of the update and it looks good.
- Log in to comment
Thanks for reporting this bug! And great catch for root cause of this bug. The original code from 3.0.9 JavaScript SyntaxHighlighter is
Not sure about (<|<), if this is really needed here. But I will check. Can you provide a sample XML, which I can use a test case?