diff --git a/README.md b/README.md index 64638909..5bbc00ca 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,12 @@ For disambiguating between files with common extensions, we use a [bayesian clas In the actual GitHub app we deal with `Grit::Blob` objects. For testing, there is a simple `FileBlob` API. - Linguist::FileBlob.new("lib/linguist.rb").language.name #=> "Ruby" +```ruby - Linguist::FileBlob.new("bin/linguist").language.name #=> "Ruby" +Linguist::FileBlob.new("lib/linguist.rb").language.name #=> "Ruby" + +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). @@ -47,7 +50,9 @@ These stats are also printed out by the binary. Try running `linguist` on itself Checking other code into your git repo is a common practice. But this often inflates your project's language stats and may even cause your project to be labeled as another language. We are able to identify some of these files and directories and exclude them. - Linguist::FileBlob.new("vendor/plugins/foo.rb").vendored? # => true +```ruby +Linguist::FileBlob.new("vendor/plugins/foo.rb").vendored? # => true +``` See [Linguist::BlobHelper#vendored?](https://github.com/github/linguist/blob/master/lib/linguist/blob_helper.rb) and [lib/linguist/vendor.yml](https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml). @@ -55,7 +60,9 @@ See [Linguist::BlobHelper#vendored?](https://github.com/github/linguist/blob/mas Not all plain text files are true source files. Generated files like minified js and compiled CoffeeScript can be detected and excluded from language stats. As an extra bonus, these files are suppressed in Diffs. - Linguist::FileBlob.new("underscore.min.js").generated? # => true +```ruby +Linguist::FileBlob.new("underscore.min.js").generated? # => true +``` See [Linguist::BlobHelper#generated?](https://github.com/github/linguist/blob/master/lib/linguist/blob_helper.rb).