Skip to content
Discussions/App Development/How to get DAML syntax highlighting on Github?Forum ↗

How to get DAML syntax highlighting on Github?

App Development12 posts658 views14 likesLast activity Apr 2021
GY
gyorgybalazsiOP
Aug 2020

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?

AN
anthony
Aug 2020

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.

GY
gyorgybalazsi
Aug 2020

CO
cocreature
Aug 2020

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

AN
anthony
Aug 2020

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

GY
gyorgybalazsi
Aug 2020

Yes, thank you!

GY
gyorgybalazsi
Aug 2020

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

CO
cocreature
Aug 2020

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.

GY
gyorgybalazsi
Aug 2020

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

AN
anthony
Aug 2020

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

ST
stefanobaghino-da
Aug 2020

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:

LU
Luciano
Apr 2021

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

← Back to Discussions