exercism / meta

Experimenting with a repo to manage the project-wide, meta todos.
7 stars 2 forks source link

Syntax highlighting for tracks #90

Closed iHiD closed 6 years ago

iHiD commented 7 years ago

Hi @exercism/track-maintainers

I'm trying to work out syntax highlighting for the solution viewing page on Nextercism. I'm doing this in two ways: 1) Each track has a default language that all files are rendered in (e.g. any files on the Ruby track will be highlighted as Ruby by default) 2) Having a mapping of filetypes to languages (e.g. if someone submits a markdown file as part of their solution, we understand to parse this as markdown, not Ruby)

All of the mapping for (1) is done. However, I am only just getting started on (2) and I need to crowd-source it to people that know languages. Could you please post below any files extensions that occur on your tracks, and the correct mapping. e.g.

The following are the languages that the syntax highlighter currently supports (ie, the RHS of the = in your comments).

Thank you all đź’™

ErikSchierboom commented 7 years ago

cs = csharp csx = csharp fs = fsharp fsx = fsharp

Theodus commented 7 years ago

pony = pony

ilya-khadykin commented 7 years ago

py = python java = java groovy = groovy

petertseng commented 7 years ago

hs = haskell rs = rust yaml = yaml yml = yaml

masters3d commented 7 years ago

typescript = ts swift = swift objective-c = .h, .m

iHiD commented 7 years ago

@Theodus Pony isn't in my list and Prism doesn't seem to have a syntax highlighter for it. Is there something that would be close? @masters3d I imagine .h and .m will be pretty controversial as they're used in multiple. I think I might leave these out and presume if you submit them then you should default to the language of the track you're on. Seem reasonable?

masters3d commented 7 years ago

Sounds good. Basic C highlighting should be fine. Objective-C is weird.

jonmcalder commented 7 years ago

R = r r = r

rpottsoh commented 7 years ago

Delphi is not listed as one of the languages, but Pascal is, perhaps Delphi can be aliased in a similar fashion as it was in exercism/exercism.io#3451 if necessary

For the sake of item 2: pas = Delphi dfm = Delphi

These are the only file extensions I am expecting for submitted files.

ozan commented 7 years ago

None of these are likely to do a good job for MIPS. On the other hand, MIPS code really doesn't need syntax highlighting :)

ricemery commented 7 years ago

scala = Scala

On Thu, Aug 24, 2017 at 11:24 AM Ozan Onay notifications@github.com wrote:

None of these are likely to do a good job for MIPS. On the other hand, MIPS code really doesn't need syntax highlighting :)

— You are receiving this because you are on a team that was mentioned. Reply to this email directly, view it on GitHub https://github.com/exercism/meta/issues/90#issuecomment-324717097, or mute the thread https://github.com/notifications/unsubscribe-auth/ABeHGynYn2aO_l7MvEwfjFu3V3TgAQSuks5sbb_ZgaJpZM4PBrrN .

mcmillhj commented 7 years ago

SML is also missing from the list of supported languages, but using the Ocaml highlighting would be better than nothing: https://github.com/exercism/exercism.io/pull/3451/files

fun = sml sig = sml sml = sml

Theodus commented 7 years ago

@iHiD Scala would probably be the closest thing to Pony syntax

NobbZ commented 7 years ago
ending language comment
*.erl erlang main ending for erlang code
*.hrl erlang unlikely to get submitted but has a chance to
*.config erlang when in an erlang context at least; maybe similar to the problem with *.h in C, C++ and Obj-C? Shouldn't get submitted though
*.app.src erlang Shouldn't get submitted
*.app erlang
*.idr (Idris) Haskell is sufficient as fallback though
*.ex elixir
*.exs elixir
*.rs rust
*.go go

That are those that I have to deal with on a more or less daily basis…

SaschaMann commented 7 years ago

.jl Julia

2017-08-24 21:36 GMT+02:00 Norbert Melzer notifications@github.com:

ending language comment .erl erlang main ending .hrl erlang unlikely to get submitted but has a chance to .config erlang when in an erlang context at least; maybe similar to the problem with .h in C, C++ and Obj-C? Shouldn't get submitted though .app.src erlang Shouldn't get submitted .app erlang .idr Idris Haskell is sufficient as fallback though .ex elixir .exs elixir .rs rust *.go go

That are those that I have to deal with on a more or less daily basis…

— You are receiving this because you are on a team that was mentioned. Reply to this email directly, view it on GitHub https://github.com/exercism/meta/issues/90#issuecomment-324735335, or mute the thread https://github.com/notifications/unsubscribe-auth/AT5mySvrJ11-tke-qxYKythNKhXmi0eLks5sbdC9gaJpZM4PBrrN .

stevejb71 commented 7 years ago

ml, mli = ocaml

stkent commented 7 years ago

kt = kotlin

sdavids13 commented 7 years ago

kts = kotlin script

stkent commented 7 years ago

kts = kotlin script

which should map to kotlin in the supported languages list afaik!

SuperPaintman commented 7 years ago

dart = dart

ryanplusplus commented 7 years ago

.c, .h -> c *.lua -> lua

marnen commented 7 years ago

APL: .apl, .tc .tc files are GNU APL test cases. They're essentially interactive interpreter session logs, and should probably be highlighted as APL.

Dyalog APL (a popular proprietary interpreter) uses .dyalog, so perhaps we should support that for APL syntax highlighting too.

Doesn't the syntax highlighting library already have a list like this that we can use?

NobbZ commented 7 years ago

Doesn't the syntax highlighting library already have a list like this that we can use?

Nope, Prism is a syntax highlighting framework for the browser written in JavaScript, therefore it doesn't even know about a files ending.

marnen commented 7 years ago

@NobbZ Except when it does, apparently: http://prismjs.com/plugins/file-highlight/

I don't know if that would be useful to us, but I thought I'd at least point it out.

NobbZ commented 7 years ago

Oh, in general thats a nice one, but it does create additional requests to the server, which needs to be handled as well and therefore create further load. I do think, that predetermining the type and generating appropriate markup is easier for the server than to wait for a roundtrip and do routing, authentication, authorisation and filepicking again.

marnen commented 7 years ago

@NobbZ Yeah, probably the extra round trip is best avoided, but that plugin presumably contains a list of extension>language mappings...perhaps we could use just that bit from the plugin, instead of essentially reinventing the same list?

iHiD commented 7 years ago

@marnen Thanks for pointing that out. It seems to only have the following though:

        var Extensions = {
            'js': 'javascript',
            'py': 'python',
            'rb': 'ruby',
            'ps1': 'powershell',
            'psm1': 'powershell',
            'sh': 'bash',
            'bat': 'batch',
            'h': 'c',
            'tex': 'latex'
        };
marnen commented 7 years ago

@iHiD Oh well. It was worth a shot. :)

verdammelt commented 7 years ago

.lisp needs Lisp syntax highlighting. The current display seems OK - but I don't see it in the originally posted list above.

NobbZ commented 7 years ago

In v1 there is a different highlighter used than in v2. We are currently collecting a list of filename mappings for v2.

But you are right, I can't find lisp in the above list as well. But there are scheme and clojure in the list, so one of those could be used?

verdammelt commented 7 years ago

RE: could scheme or clojure be used?

They might work - but it depends on whether the highlighter knows keywords in the language. For example in Common Lisp you define a function with defun but it is define in Scheme and defn in Clojure. The basics of the syntax is the same however.

bzz commented 7 years ago

@iHiD I'm sure you already know about these, but just in case it might help - there are two project that are relevant for programming language identification:

linguist/languages.yml also has extensive information on file extension mapping.

iHiD commented 6 years ago

Hello everyone. Thank you all for your great work on this.

There are a few outstanding languages. It might be that there is no good choice but I need to put something by them. There are also a few new options here on Prism since we started this process. I would really appreciate it if people could help get this one over the line. @kytrinyx @jackhughesweb - maybe one of you could use your magic tools to open issues on these tracks' maintainers for this too?

Thank you! đź’™

stevejb71 commented 6 years ago

Reason track was started recently.

re = reason

LegalizeAdulthood commented 6 years ago

.h, .hpp, .hxx, .cpp, .cxx are common extensions for C++.

lpil commented 6 years ago

@stevejb71 Reason also uses the .rei extension

@iHiD Purescript uses the .purs extension. LFE uses the .lfe extension.

iHiD commented 6 years ago

@lpil Thank you :) Do you know which Prism language syntaxes they should use from this list?

NobbZ commented 6 years ago

@iHiD for LFE => "lisp" should be safe, as well as PureScript => Haskell. Reason has its own highlighter in that list.

bencoman commented 6 years ago

For Pharo... .st = Smalltalk

bdw429s commented 6 years ago

For the CFML track:

cfm = XML or HTML cfc = javascript

I don't see XML or HTML above, but surely HTML is something most highlighters support. If not, I wouldn't worry too much about it since I expect most code to be in a CFC and using the script syntax. (CFC's can contain tags, but since these exercises didn't template HTML, it wouldn't make much sense).

petertseng commented 6 years ago

Greetings. I come bearing news of the Ceylon track.

The only relevant file extension is ceylon

ceylon = ???

Okay so what am I going to put in the ???. I don't know. You could try, in rough order of likelihood to work, (most likely) Kotlin, Scala, Java, C#, C-like, anything else I didn't list (least likely)

Please accept my deep apologies that I cannot offer the time to actually test out any of my proposals; they are utterly wild speculation, worth what you paid for them.

iHiD commented 6 years ago

@bencoman Thanks for helping :) Is the file-extension for pharo files .st? Just checking I've understood that correctly :)

bencoman commented 6 years ago

@iHiD, Correct. More broadly, its common to all flavours of Smalltalk, derived from the first two letters of that word. Here is an example... https://github.com/pharo-project/pharo/blob/development/src/Balloon/BalloonEdgeData.class.st

mhinz commented 6 years ago

vim = vim

catb0t commented 6 years ago

factor = factor

Linguist information about syntax highlighting for Factor is here https://github.com/github/linguist/blob/master/lib/linguist/languages.yml#L1303

The TextMate bundle (used by Linguist) is https://github.com/factor/factor/blob/master/misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage

jackhughesweb commented 6 years ago

v = coq rkt = racket

kytrinyx commented 6 years ago

It looks like we've sorted what we can here. We also have an open issue to manage this in a slightly more practical way: https://github.com/exercism/exercism/issues/4385