uiwjs / react-textarea-code-editor

A simple code editor with syntax highlighting.
https://uiwjs.github.io/react-textarea-code-editor/
MIT License
476 stars 22 forks source link

JSON Highlighting of Value the same as the Name when a string #148

Closed jkoufalas closed 1 year ago

jkoufalas commented 1 year ago

Hi

When highlighting JSON the name value pair is highlighting the same colour when the value is a string. Is it possible to define the value if it a string so that it can be given another colour.

{ "state": "initial" }

in this case both "state" and "initial" are the same colour. And for larger JSON objects it makes most of the object the same colour.

This way the colour scheme is more customisable through .w-tc-editor-var and I can match it to other outputs such as JSONPretty

jaywcjlove commented 1 year ago

You need to know how to use rehype-prism-plus.

@jkoufalas

import CodeEditor from '@uiw/react-textarea-code-editor';
import rehypePrism from 'rehype-prism-plus';

function App() {
  return (
    <CodeEditor
      plugins={[[rehypePrism, { ignoreMissing: true }]]}
    />
  );
}
jkoufalas commented 1 year ago

thanks, it opened up some more classes i could use for css. It also opened up the ability to use line numbers which is handy.

Thankyou