GitHub supports Monkey Syntax Highlighting

Monkey Archive Forums/Monkey Discussion/GitHub supports Monkey Syntax Highlighting

maverick69(Posted 2013) [#1]
Woohooo: GitHub supports Monkey Syntax Highlighting :)

Example:

https://github.com/JochenHeizmann/Horizon-for-Monkey/blob/master/starfield.monkey


AdamRedwoods(Posted 2013) [#2]
I *just* saw this, and had to do a double-take.

niiiiice! look out world!


Shinkiro1(Posted 2013) [#3]
Github is so awesome.
I accidentally deleted a repo where I thought I had a local copy.
So I wrote an email and guess what? Literally 5 minutes afterwards my repo was there again with a friendly email reply. What a service.


Difference(Posted 2013) [#4]
Way cool!


Shinkiro1(Posted 2013) [#5]
Don't forget you can use gist to be embedded into your blog/website:
https://github.com/blog/122-embedded-gists


tiresius(Posted 2013) [#6]
Is this something github did on their own or did someone from our side get this working? I have code on google code site it would be nice if that had syntax highlight as well!


Paul - Taiphoz(Posted 2013) [#7]
I sent an e-mail to them a a week or two ago asking them to support it, also sent one to google and that other site I think bitbucket didnt get a reply but maybe one of them got through to some one that liked the idea.

If I took the time to send a few e-mails you can be sure others did as well, they probably took notice with a few people mailing them about this crazy think called monkey and they checked it out, liked the idea and did it.


tinnet(Posted 2013) [#8]
Hej, finally the highlighting arrived in github, took 6 months from the first commit ;)

https://bitbucket.org/birkenfeld/pygments-main/pull-request/117/lexer-for-the-monkey-language/diff
&&
https://github.com/github/linguist/pull/388

Sadly, some bugs with the lexer already have been reported. I'm sure there are many more oddities that the lexer does not yet deal with, feel free to report them here or at bitbucket :) (but keep in mind, the lexer tries to target Strict monkey)

@tiresius: if google code uses pygments for highlighting, it will start working by itself, if they don't we'll have to find out what they use and write another lexer.


Rushino(Posted 2013) [#9]
Nice!


Nobuyuki(Posted 2013) [#10]
it's been working decently well over at bitbucket for a while. I just wish the colors weren't so crazy over there!


DruggedBunny(Posted 2013) [#11]
Don't suppose anyone out there has created a Monkey highlighter for the brilliant ACE web-based editor, by any chance? I found the syntax highlighting stuff completely impenetrable!


simonh(Posted 2013) [#12]
Have they removed the Monkey option from Gist now? Doesn't seem to appear in the drop-down box.


Nobuyuki(Posted 2013) [#13]
#Rem directive highlighting seems broken on Github..... maybe there were problems with the lexer...


Tibit(Posted 2013) [#14]
Just for reference, the [Crayon Syntax Highlighter] web-based editor has Monkey support.


samowitsch(Posted 2014) [#15]
Don't suppose anyone out there has created a Monkey highlighter for the brilliant ACE web-based editor, by any chance? I found the syntax highlighting stuff completely impenetrable!


This was a got question, any news on that? I have read the ACE Syntax Highlighters section and it was very confusing :D


samowitsch(Posted 2014) [#16]
So i made a monkey mode for the Ace Editor. This is a first shot. Maybe not perfect at this state. Feedback is welcome.

mode-monkey.js for Ace Editor

Possible todos:
- check if keywords are complete
- code folding


DruggedBunny(Posted 2014) [#17]
@samowitsch: Well done! However, I've been trying to get this to work, but I'm not sure how you're supposed to use it.

I've tried adding it to the src-no-conflict folder used by my installation (and added monkey to the modelist) but that didn't work; I've also tried rebuilding Ace with the monkey.js in the mode folder (and added to the ext/modelist), but neither way seems to do anything for me.

What exactly should I be doing with the mode-monkey.js file to get it to work?


samowitsch(Posted 2014) [#18]
@DruggedBunny: i send you an example via mail.
Monkey Ace Example zip.


DruggedBunny(Posted 2014) [#19]
Nice work -- and it works really well! I'll mess about with it over the next few days and try to figure out where I was going wrong.

Many thanks for doing that -- much appreciated.


DruggedBunny(Posted 2014) [#20]
@samowitsch: Hi Christian, do you have any idea what might be causing this?

The keyword Import highlights correctly, but as soon as you add a space it turns green, the same as strings:



I wondered if it was the editor failing to highlight the first keyword correctly, but this happens regardless of where you try to type Import...


samowitsch(Posted 2014) [#21]
Hi. Yes you are right. You can find my fork of the ACE Repo here https://github.com/samowitsch/ace.

My additions are in these files:
https://github.com/samowitsch/ace/blob/monkey/lib/ace/mode/monkey.js
https://github.com/samowitsch/ace/blob/monkey/lib/ace/mode/monkey_highlight_rules.js

It is really a regex nightmare :D Maybe you can fix this.


DruggedBunny(Posted 2014) [#22]
Thanks, Christian, will take a look. Regex isn't my area at all -- I just dumped your zipped version into my project and got it working and haven't touched it since!

It does seem to relate to these lines in mode-monkey.js, though:

                {
                    caseInsensitive: true,
                    token: 'string.unquoted.module.monkey',
                    regex: '\\b(import)\\s+((?:[a-zA-Z_]\\w*\\.?)+)\\b'
                },
                {
                    caseInsensitive: true,
                    token: 'string.quoted.double.monkey',
                    regex: '\\b(import)\\s+'
                },

If I change the 'import' in both lines (eg. to 'ximport'), it then highlights correctly, but then I don't know what those lines were actually doing!


DruggedBunny(Posted 2014) [#23]
Also just found a typo in mode-monkey.js and mode/monkey_highlight_rules.js -- there are references to 'opeator' instead of 'operator'. This doesn't relate to the problem (I've tried correcting to 'operator'), and possibly doesn't even matter -- I really don't know what I'm looking at with this stuff -- but I thought I should mention it!

EDIT: Oops, another typo in mode-monkey.js! Again, no idea if it matters...

        var keywordMapper = this.createKeywordMapper({
            "variable.language": "this",
            "keyword.other.commands.monkey": keywords,
            "keyword.control": keywordsControl,
            "keyword.operator": keywordsOperator,
            "constant.language.joy.monkey": constantsJoy,
            "constant.language.key.monkey": constantsKey,
            "constant.language.mouse.monkey": constantsMouse,
            "constant.langauge.touch.monkey": constantsTouch
        }, "identifier");


(There is also a reference in monkey_highlight_rules.js to 'langauge'.)