deathau / cm-editor-syntax-highlight-obsidian

A plugin for [Obsidian](https://obsidian.md) which allows syntax highlighting for code blocks in the editor.
499 stars 37 forks source link

Support for React syntax #64

Open aliktb opened 1 year ago

aliktb commented 1 year ago

Currently React highlighting through javascript doesn't appear to handle html tags properly. Closing tags appear to be highlighted a different color to the opening tag. It would be nice if opening and closing tags had matching colors. E.g. in the example below, if the <div> and </div> had their own color and <article> and </article> were matching. Example code paraphrased from react documentation

function Comment(props) {
  return (
    <div className="Comment">
      <article className="UserInfo">
        <img className="Avatar"
          src={props.author.avatarUrl}
          alt={props.author.name}
        />
        <div className="UserInfo-name">
          {props.author.name}
        </div>
      </article>
      <div className="Comment-text">
        {props.text}
      </div>
      <div className="Comment-date">
        {formatDate(props.date)}
      </div>
    </div>
  );
}