Skip to content

Incorrect syntax highlighting around escaped quotes in HTML strings in Nunjucks #25

@nick-golding

Description

@nick-golding

I believe this extension is highlighting syntax incorrectly when I have an HTML string that contains escaped quotes \" inside a Nunjucks / javascript object.

For example, the code:

        rows: [
          [
            {
              text: "Lorem ipsum"
            },
            {
              html: "<a href=\"\">More information</a>"
            }
          ],
          [
            {
              text: "Dolor sit amet"
            },
            {
              html: "<a href=\"\">More information</a>"
            }
          ],

... highlights as per the attached image.

Image

There are two things that don't look right:

  • The opening bracket < of the <a> element is highlighted red, as if it were not closed correctly.
  • The second escaping backslash \ in each case is rendered white, as if it were standard code and not part of the quoted string.

The highlighting appears to be ignoring the escaping, and treating every quote mark " as if it were functional, in which case it would be correct about the two cases above. However, the code works as expected so I think this is an issue with the highlighting rather than with my syntax. Apologies if I'm missing something, though!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions