function highlightAuto(value, options) {
  var settings = options || {}
  var subset = settings.subset || high.listLanguages()
  var prefix = settings.prefix
  var length = subset.length
  var index = -1
  var result
  var secondBest
  var current
  var name

  if (prefix === null || prefix === undefined) {
    prefix = defaultPrefix
  }

  if (typeof value !== 'string') {
    throw fault('Expected `string` for value, got `%s`', value)
  }

  secondBest = {relevance: 0, language: null, value: []}
  result = {relevance: 0, language: null, value: []}

  while (++index < length) {
    name = subset[index]

    if (!high.getLanguage(name)) {
      continue
    }

    current = highlight(name, value, options)
    current.language = name

    if (current.relevance > secondBest.relevance) {
      secondBest = current
    }

    if (current.relevance > result.relevance) {
      secondBest = result
      result = current
    }
  }

  if (secondBest.language) {
    result.secondBest = secondBest
  }

  return result
}
Creates a deep copy of the language with the given id and appends the given tokens.

If a token in `redef` also appears in the copied language, then the existing token in the copied language
will be overwritten at its original position.

## Best practices

Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
understand the language definition because, normally, the order of tokens matters in Prism grammars.

Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
Furthermore, all non-overwriting tokens should be placed after the overwriting ones.

@param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
@param {Grammar} redef The new tokens to append.
@returns {Grammar} The new language created.
@public
@example
Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
    // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
    // at its original position
    'comment': { ... },
    // CSS doesn't have a 'color' token, so this token will be appended
    'color': /\b(?:red|green|blue)\b/
});