geshi-1.0 icon indicating copy to clipboard operation
geshi-1.0 copied to clipboard

Support Json format

Open ngtrian opened this issue 7 years ago • 10 comments

working with xml, yaml, please add json support

ngtrian avatar Sep 24 '18 08:09 ngtrian

What's your code that is not working?

cweiske avatar Sep 24 '18 08:09 cweiske

This is my code

{
  "short_name": "Maps",
  "name": "Google Maps",
  "icons": [
    {
      "src": "/images/icons-192.png",
      "type": "image/png",
      "sizes": "192x192"
    },
    {
      "src": "/images/icons-512.png",
      "type": "image/png",
      "sizes": "512x512"
    }
  ],
  "start_url": "/maps/?source=pwa",
  "background_color": "#3367D6",
  "display": "standalone",
  "scope": "/maps/",
  "theme_color": "#3367D6"
}

ngtrian avatar Sep 26 '18 12:09 ngtrian

I mean your PHP code.

cweiske avatar Sep 26 '18 12:09 cweiske

Json also not list support on homepage GeSHi

ngtrian avatar Sep 27 '18 03:09 ngtrian

JSON is a subset of javascript, so JSON is supported. Either show the actual PHP code instructing geshi to render JSON that does not work, or stop.

cweiske avatar Sep 27 '18 06:09 cweiske

No, if set syntax javascript for json, result in same color. I'm trying in http://qbnz.com.

image

Why quickly closed this issue? Instead of discussing further!

ngtrian avatar Sep 27 '18 09:09 ngtrian

It should highlight as: image

ngtrian avatar Sep 27 '18 09:09 ngtrian

So your problem is that keys and values in a JSON document are highlighted with the same color?

cweiske avatar Sep 27 '18 09:09 cweiske

So your problem is that keys and values in a JSON document are highlighted with the same color?

yes

ngtrian avatar Sep 27 '18 09:09 ngtrian

With enough hackery using COMMENT_REGEXP you could match the string preceeding the colon and matching the string except for the colon (which should be covered by a lookahead only, not as the actual match).

BenBE avatar Oct 01 '18 23:10 BenBE