mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Override languages being included by language statistics (#3807)
* Add detectable key to languages This key allows to override the language being included in the language stats of a repository. * Make detectable override-able using .gitattributes * Mention `linguist-detectable` in README * Remove detectable key from languages Reverts changes in 0f7c0df5. * Update commit hash to the one that was merged PR #3806 changed the commit hash. The original commit was not actually merged into the test/attributes branch. * Fix check to ensure detectable is defined * Add include in language stats tests when detectable set * Ignore detectable when vendored, documentation or overridden * Add documentation on detectable override in README * Improve documentation on detectable override in README
This commit is contained in:
committed by
Colin Seymour
parent
fef7a12c85
commit
8da6ddf9d9
15
README.md
15
README.md
@@ -124,7 +124,7 @@ Linguist supports a number of different custom override strategies for language
|
||||
|
||||
### Using gitattributes
|
||||
|
||||
Add a `.gitattributes` file to your project and use standard git-style path matchers for the files you want to override using the `linguist-documentation`, `linguist-language`, `linguist-vendored`, and `linguist-generated` attributes. `.gitattributes` will be used to determine language statistics and will be used to syntax highlight files. You can also manually set syntax highlighting using [Vim or Emacs modelines](#using-emacs-or-vim-modelines).
|
||||
Add a `.gitattributes` file to your project and use standard git-style path matchers for the files you want to override using the `linguist-documentation`, `linguist-language`, `linguist-vendored`, `linguist-generated` and `linguist-detectable` attributes. `.gitattributes` will be used to determine language statistics and will be used to syntax highlight files. You can also manually set syntax highlighting using [Vim or Emacs modelines](#using-emacs-or-vim-modelines).
|
||||
|
||||
```
|
||||
$ cat .gitattributes
|
||||
@@ -166,6 +166,19 @@ $ cat .gitattributes
|
||||
Api.elm linguist-generated=true
|
||||
```
|
||||
|
||||
#### Detectable
|
||||
|
||||
Only programming languages are included in the language statistics. Languages of a different type (as defined in [`languages.yml`](/lib/linguist/languages.yml)) are not "detectable" causing them not to be included in the language statistics.
|
||||
|
||||
Use the `linguist-detectable` attribute to mark or unmark paths as detectable.
|
||||
|
||||
```
|
||||
$ cat .gitattributes
|
||||
*.kicad_pcb linguist-detectable=true
|
||||
*.sch linguist-detectable=true
|
||||
tools/export_bom.py linguist-detectable=false
|
||||
```
|
||||
|
||||
### Using Emacs or Vim modelines
|
||||
|
||||
If you do not want to use `.gitattributes` to override the syntax highlighting used on GitHub.com, you can use Vim or Emacs style modelines to set the language for a single file. Modelines can be placed anywhere within a file and are respected when determining how to syntax-highlight a file on GitHub.com
|
||||
|
||||
Reference in New Issue
Block a user