website/docgen/processors/add-links.js
function(str, doc) {
  var oldStr = null;
  while (str != oldStr) {
    oldStr = str;
    var matches = /{\s*@link[plain]*\s+([^]+?)\s*}/.exec(str);
    if (matches) {
      var str = str.replace(
          new RegExp('{\\s*@link[plain]*\\s+' +
              matches[1].replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '\\s*}'),
              toMarkdownLinkFormat(matches[1], doc,
                matches[0].indexOf('linkplain') == -1)
      );
    }
  }
  return str;
}
function(str, doc) {
  var oldStr = null;
  while (str != oldStr) {
    oldStr = str;
    var matches = /{\s*@link[plain]*\s+([^]+?)\s*}/.exec(str);
    if (matches) {
      var str = str.replace(
          new RegExp('{\\s*@link[plain]*\\s+' +
              matches[1].replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '\\s*}'),
              toMarkdownLinkFormat(matches[1], doc,
                matches[0].indexOf('linkplain') == -1)
      );
    }
  }
  return str;
}
function ( str , doc ) { var oldStr = null ; while ( str != oldStr ) { oldStr = str ; var matches = / {\s*@link[plain]*\s+([^]+?)\s*} / . exec ( str ) ; if ( matches ) { var str = str . replace ( new RegExp ( '{\\s*@link[plain]*\\s+' + matches [ 1 ] . replace ( / [-\/\\^$*+?.()|[\]{}] / g , '\\$&' ) + '\\s*}' ) , toMarkdownLinkFormat ( matches [ 1 ] , doc , matches [ 0 ] . indexOf ( 'linkplain' ) == - 1 ) ) ; } } return str ; }
Add links to @link annotations. For example: `{@link foo.bar}` will be
transformed into `[foo.bar](foo.bar)` and `{@link foo.bar FooBar Link}` will
be transfirned into `[FooBar Link](foo.bar)`
@param {string} str The string with the annotations.
@param {!Object} doc Current document.
@return {string} A link in markdown format.
Add links to