seed icon indicating copy to clipboard operation
seed copied to clipboard

Add syntax highlighting.

Open stebanos opened this issue 7 years ago • 9 comments

Currently it can be quite cumbersome to spot mistakes. Syntax highlighting will help a lot, but this depends on #19.

stebanos avatar Feb 19 '18 18:02 stebanos

I think CodeMirror has its own predefined syntax-highlighting for particular languages, and apart from that it only has a default mode, as can be seen here in runmode/colorize.js under the addons heading

kunal-mohta avatar Feb 19 '18 18:02 kunal-mohta

I read more and found out that we can provide CodeMirror a list of keywords that have a particular syntax highlighting.

kunal-mohta avatar Feb 20 '18 10:02 kunal-mohta

CodeMirror is now integrated but we need to write our own mode for the Seed syntax. Seed itself doesn't have very many keywords, it's more a base structure of a block identifier (ends with a colon), phrase (starts with - ), phrase continuation line (starts with " ")...

Inside of each phrase we could use a HTML mixed-mode highlighter that higlights HTML and inline CSS.

fdb avatar Feb 23 '18 16:02 fdb

Suggestion:

syntax

stebanos avatar Feb 24 '18 08:02 stebanos

Looking good! 👍

fdb avatar Feb 24 '18 12:02 fdb

Here's some info on writing a custom mode in CodeMirror:

http://codemirror.net/doc/manual.html#modeapi

fdb avatar Feb 24 '18 12:02 fdb

Perhaps the simple mode is enough: http://codemirror.net/demo/simplemode.html

fdb avatar Feb 24 '18 12:02 fdb

@fdb I would like to work.

dhruvramdev avatar Mar 13 '18 17:03 dhruvramdev

I was able to write a basic set of rules. But I couldn't find more colours to highlight text as described in picture even though they have different rules.

Screenshots screenshot_20180314_011521 screenshot_20180314_010934

dhruvramdev avatar Mar 13 '18 19:03 dhruvramdev