code: function findFirstMatchingConfig (link, configs) {
    var i, config
    var href = link.attrs[link.attrIndex('href')][1]
  
    for (i = 0; i < configs.length; ++i) {
      config = configs[i]
  
      // if there is no pattern, config matches for all links
      // otherwise, only return config if href matches the pattern set
      if (!config.pattern || new RegExp(config.pattern).test(href)) {
        return config
      }
    }
  }
docs: Adapted from https://github.com/markdown-it/markdown-it/blob/fbc6b0fed563ba7c00557ab638fd19752f8e759d/docs/architecture.md