4

Having read What is syntax highlighting and how does it work?, I'm looking for a way to improve the syntax highlighting for XPath.

Currently, the highlighting language for the XPath tag is "default". This results in false-positive "comment" highlighting for lines that start with //, which is common in XPath.

Prettifier doesn't have support for XPath itself, but lang-xml would be better than the status quo. At least it doesn't treat lines starting with // as comments.

I tried editing the tag wiki for xpath, but the language setting didn't seem to be part of what was editable (maybe based on my rep).

Can the syntax highlighting language for the xpath tag be set to lang-xml? Or does anybody have a better idea?

Example:

I edited my answer at Calculate XPath of an html element without attributes so that the first two code samples use the default language setting, so they demonstrate the unwanted comment coloring. The remaining XPath samples are overridden to use lang-xml and don't have that problem.

7
  • 1
    Can you link to a question where this is a problem? I don't doubt that it is, I just want to see it before & after the change. Aug 28, 2014 at 17:06
  • @BilltheLizard: my answer at stackoverflow.com/questions/25549617/… had the problem, until I explicitly put in the !-- language: lang-xml override. I tried editing the above question but it seems that highlighting doesn't work the same way on meta. Maybe I'll edit the answer linked to in this comment so that the first XPath expression demonstrates the problem.
    – LarsH
    Aug 28, 2014 at 17:18
  • @BilltheLizard: updated my answer with the example.
    – LarsH
    Aug 28, 2014 at 17:25
  • 1
    Thanks, Lars. I updated the language highlighting for the [xpath] tag, and it looks like it works. Aug 28, 2014 at 18:08
  • I'm pretty sure the language setting for tags is available to us only, not regular users.
    – BoltClock
    Aug 28, 2014 at 18:36
  • @BilltheLizard: Looks good from here. Thanks!
    – LarsH
    Aug 28, 2014 at 20:53
  • 1
    status-completed then @Bill?
    – Ben
    Aug 28, 2014 at 21:04

0

You must log in to answer this question.