janet-lang / janet

A dynamic language and bytecode vm
https://janet-lang.org
MIT License
3.5k stars 226 forks source link

Add GitHub syntax highlighting to *.janet files #433

Closed elimisteve closed 4 years ago

elimisteve commented 4 years ago

Looks like this may be the easiest way to do that: https://github.com/github/linguist#using-gitattributes

bakpakin commented 4 years ago

There are already syntax highlighting files and an unmerged linguist PR, I’m closing this for now. The git attributes file was previously removed as I don’t think it is that important.

elimisteve commented 4 years ago

@bakpakin They closed that PR: https://github.com/github/linguist/pull/4674

Syntax highlighting helps those of us new to Janet read the code examples and makes Janet feel more "legit", but obviously it's up to you.

sogaiu commented 4 years ago

@elimisteve I believe others (including me!) would also like appropriate highlighting.

As you saw in that issue though, for whatever reason(s) the last attempt was not met favorably.

There was some discussion on the gitter channel about this topic and I believe one of the opinions that had some traction was to keep growing the various numbers until a subsequent attempt is made (or something like that).

FWIW, I think @katafrakt made this: https://isjanetthereyet.herokuapp.com/ (Not sure what went into it exactly.)

(Note that one of the entities that is influencing how "legit" something "feels" is none other than our hosts...)

elimisteve commented 4 years ago

@sogaiu That sounds like a good longer-term solution, but we can add syntax highlighting to the examples in this very repository by merging my one-line PR from earlier today: https://github.com/janet-lang/janet/pull/434

andrewchambers commented 4 years ago

clojure syntax highlighting falls flat for many real janet examples, they syntax have differences, so I would rather have none or a correct one.

elimisteve commented 4 years ago

I tried Scheme too and it didn't help much at all, but using Clojure's syntax highlighting looks pretty fantastic to me: https://github.com/elimisteve/janet/blob/master/examples/life.janet

pyrmont commented 4 years ago

This isn't in our power to make. GitHub has to accept the Linguist PR and they won't do that until there are more repos.

sogaiu commented 4 years ago

On a side note, it seems possible that if Janet support were added to Rouge, syntax highlighting might get working sooner at gitlab:

https://docs.gitlab.com/ee/user/project/highlighting.html https://rubygems.org/gems/rouge

...and there's already a lexer for Clojure.

https://github.com/rouge-ruby/rouge/blob/f31a5eeba00c2f7ed9ee9eb4cc3f06bf9161df53/lib/rouge/lexers/clojure.rb

elimisteve commented 4 years ago

@pyrmont Indeed, hence my creation of https://github.com/janet-lang/janet/pull/434 for the time being.

sogaiu commented 4 years ago

FYI, after consulting with pyrmont, I've started a rouge lexer for Janet based on the Clojure one: https://github.com/sogaiu/rouge/tree/janet

sogaiu commented 4 years ago

Thanks to @pyrmont's improvements and fixes, Rouge may gain support for Janet in its next release: https://github.com/rouge-ruby/rouge/pull/1558#issuecomment-653834852

We release new versions of Rouge on a monthly cadence. The next version will be v3.21.0 and is scheduled for Tuesday 14 July. Depending on how you're using it (e.g. GitHub Pages, GitLab), it can take a bit of time before those projects start using the latest gem.