mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Prefer Markdown over GCC Machine Description (#3523)
* Add minimal Markdown sample * Heuristic defaults to Markdown on no match * Allow Linguist to detect empty blobs
This commit is contained in:
@@ -15,9 +15,9 @@ class << Linguist
|
||||
# see Linguist::LazyBlob and Linguist::FileBlob for examples
|
||||
#
|
||||
# Returns Language or nil.
|
||||
def detect(blob)
|
||||
def detect(blob, allow_empty: false)
|
||||
# Bail early if the blob is binary or empty.
|
||||
return nil if blob.likely_binary? || blob.binary? || blob.empty?
|
||||
return nil if blob.likely_binary? || blob.binary? || (!allow_empty && blob.empty?)
|
||||
|
||||
Linguist.instrument("linguist.detection", :blob => blob) do
|
||||
# Call each strategy until one candidate is returned.
|
||||
|
||||
Reference in New Issue
Block a user