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

Possibly shown user errors in inserted code #130

Open HardCoreQual opened 2 years ago

HardCoreQual commented 2 years ago

think will be great to add the possibility send errors props with the format

type Errors = {
   startAt: number; // start position in string
   endAt: number; // end position in string
   message: string; // message by hover
}[]

startAt, endAt will use to add a red underline for the respective code the message will show by hovering over the error line, but it is harder to implement

jaywcjlove commented 2 years ago

@HardCoreQual Maybe your idea can be implemented with plugins + css.

  /**
   * rehypePlugins (Array.<Plugin>, default: `[[rehypePrism, { ignoreMissing: true }]]`)  
   * List of [rehype plugins](https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins) to use. See the next section for examples on how to pass options
   */
  rehypePlugins?: PluggableList;