rouge-ruby / rouge

A pure Ruby code highlighter that is compatible with Pygments
https://rouge.jneen.net/
Other
3.32k stars 733 forks source link

GraphQL descriptions that are single-quoted, all on one line, or not at the top-level are not highlighted correctly #1765

Open xenomachina opened 2 years ago

xenomachina commented 2 years ago

Name of the lexer GraphQL

Code sample

"""
InputOne's description (works)
"""
input InputOne {
  """
  id's description (doesn't work)
  """
  id: Int!
}

"""InputTwo's description (doesn't work)"""
input InputTwo {
  """id's description (doesn't work)"""
  id: Int!
}

"InputThree's description (doesn't work)"
input InputThree {
  "id's description (doesn't work)"
  id: Int!
}

Additional context

It looks like the handling of GraphQL descriptions is too restrictive. The example above can be tried on the Rouge home page's GraphQL tester. All of the quoted descriptions should highlight as descriptions, but only one is correctly identified as a description. It looks like there are possibly 3 separate sub-issues: