How to get DAML syntax highlighting on Github?

Many .daml files on Github don’t have any syntax highlighting.

There was already a question about this topic on this forum, with answers from @cocreature and @anthony, with the conclusion that we don’t have proper syntax highlighting for DAML files yet: Is there a way to configure syntax highlighting in topics?

Still, there are .daml files on Github which have proper syntax highlighting, eg this one: lib-finance/Types.daml at 07011cb70b7d8d95f54a30770b8307f0d9ccd5ba · digital-asset/lib-finance · GitHub

How so? How can I get this for my files?

2 Likes

Can you screenshot? This is showing in plain text for me.

Is it too early to get excited that GH may be rolling out syntax highlighting for DAML and it simply hasn’t hit all the servers yet? To give some background GH chooses to add syntax highlighting for a language when they see enough usage of it. I’m unaware of the exact criteria and process though.

1 Like

Not sure why it’s showing as plaintext for @anthony, it looks fine for me. However, this is not DAML syntax highlighting. We are just telling Github to use Haskell highlighting for .daml files. See lib-finance/.gitattributes at 07011cb70b7d8d95f54a30770b8307f0d9ccd5ba · digital-asset/lib-finance · GitHub

2 Likes

Hmm… loaded it again and now I have syntax highlighting too

Yes, thank you!

I couldn’t find any way to apply the same trick to Github gists.

A bit annoying that adding a .gitattributes file to a gist doesn’t work but you can use the modelines feature of linguist (the library github uses for highlighing. E.g., here’s a gist of a DAML file I wrote yesterday to demonstrate two failure modes of fetchByKey.

3 Likes

That’s great, thank you! Will use it myself.

Another way is to enter gist filenames as file.hs to get syntax highlighting.

1 Like

FYI we’re still trying to make GitHub accept DAML as a supported language, but that mostly boils down to having a certain number of repositories using it, so tell your friends and family to write more Daml. :smiley:

4 Likes

How’s this coming along? I looked at your link. Seems like the acceptance criteria is considered on a case-by-case basis.

1 Like