text: 'use strict';
  
  var path = require('path');
  var findGit = require('./git/find_git');
  var getGithubURLPrefix = require('./git/url_prefix');
  
  /**
   * Attempts to link code to its place on GitHub.
   *
   * @name linkGitHub
   * @param {Object} comment parsed comment
   * @returns {Object} comment with github inferred
   */
  module.exports = function (comment) {
    var repoPath = findGit(comment.context.file);
    var root = repoPath ? path.dirname(repoPath) : '.';
    var urlPrefix = getGithubURLPrefix(root);
    var fileRelativePath = comment.context.file.replace(root + path.sep, '').split(path.sep).join('/');
  
    if (urlPrefix) {
      var startLine = void 0;
      var endLine = void 0;
  
      if (comment.kind == 'typedef') {
        startLine = comment.loc.start.line;
        endLine = comment.loc.end.line;
      } else {
        startLine = comment.context.loc.start.line;
        endLine = comment.context.loc.end.line;
      }
  
      comment.context.github = {
        url: urlPrefix + fileRelativePath + '#L' + startLine + '-' + 'L' + endLine,
        path: fileRelativePath
      };
    }
    return comment;
  };