From c5799244853d1461cf6d30a5fa6abe06f695c4c2 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Sun, 16 Nov 2014 14:25:11 +0100 Subject: [PATCH] DOCS --- README.md | 14 ++++++++++++++ script/download-grammars | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2841eaa4..8308b71f 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,20 @@ Linguist::FileBlob.new("bin/linguist").language.name #=> "Ruby" See [lib/linguist/language.rb](https://github.com/github/linguist/blob/master/lib/linguist/language.rb) and [lib/linguist/languages.yml](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml). +### Syntax Highlighting + +Syntax highlighting in GitHub is performed using TextMate-compatible grammars. These are the same grammars that TextMate, Sublime Text and Atom use. + +Every language in `languages.yml` is mapped to its corresponding TM `scope`. This scope will be used when picking up a grammar for highlighting. **When adding a new language to Linguist, please add its corrsponding scope too (assuming there's an existing TextMate bundle) so syntax highlighting works for it**. + +#### I found a bug! + +The `grammars.yml` contains the list of all the repositories where we fetch TextMate grammars for highlighting. If you find a bug in the highlighting for any given language, please consult this Grammars list to find the source of the grammar, and submit the bug report upstream. + +You can also try to fix the bug yourself and submit a Pull Request. [This piece from TextMate's documentation](http://manual.macromates.com/en/language_grammars) offers a good introduction on how to work with TextMate-compatible grammars. + +Once the bug has been fixed upstream, please let us know and we'll pick it up for GitHub. + ### Stats The Language stats bar that you see on every repository is built by aggregating the languages of each file in that repository. The top language in the graph determines the project's primary language. diff --git a/script/download-grammars b/script/download-grammars index e0dfe10c..c07ad8e7 100755 --- a/script/download-grammars +++ b/script/download-grammars @@ -8,7 +8,7 @@ require 'tmpdir' require 'uri' require 'yaml' -GRAMMARS_PATH = File.expand_path("../../grammars", __FILE__) +GRAMMARS_PATH = File.expand_path("../../../prettylights/grammars", __FILE__) SOURCES_FILE = File.expand_path("../../grammars.yml", __FILE__) CSONC = File.expand_path("../../node_modules/.bin/csonc", __FILE__)