Is it possible to define own syntax on a GitHub repository?
Asked Answered
S

3

15

I'm writing a small DSL, and I'm curious if it's possible to somehow show it in a language bar above the repository source where all languages are listed by percentage of using or GitHub administration needs to allow that language?

For example, I'm writing a Ruby project with the DSL called Puppy, and I want to show the percentage of all files with the .puppy extension beside other languages.

Shiva answered 29/7, 2016 at 21:53 Comment(0)
B
11

Looks like you need add your language to Linguist library (https://github.com/github/linguist) which GitHub utilize to recognize source code languages.

according to: https://help.github.com/articles/my-repository-is-marked-as-the-wrong-language/

Bathometer answered 29/7, 2016 at 22:0 Comment(0)
L
9

GitHub uses github/linguist to recognize languages, including to display which languages the project is made up of in the navigation bar.

For your .puppy files to be recognized by GitHub (and put in the language list), you would need to contribute to that repository.

Lack answered 29/7, 2016 at 22:0 Comment(0)
S
1

As Rafail Akhmetshin and intboolstring wrote, you'd need to add support for your language in the open source project Linguist if you want to use it in your repository. There's however a requirements on in-the-wild usage across github.com. See the guidelines for more information.

The custom language feature (being able to define a syntax without having to first add support for it in Linguist) has been requested twice on the Linguist repository: #2627 and #2598. There are, however, some technical and legal concerns to address before this could be implemented (see #2627 in particular).

Sibelle answered 14/8, 2017 at 20:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.