README code fencing

This commit is contained in:
Ted Nyman
2013-01-08 17:11:16 -08:00
parent 3edd765076
commit 75072ae5cc

View File

@@ -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.
```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.
```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.
```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).