remarkjs / remark-github

remark plugin to link references to commits, issues, pull-requests, and users, like on GitHub

Home Page:https://remark.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support custom GitHub url

g12i opened this issue · comments

Subject of the feature

Hello! It would be nice to add a support for an Enterprise GitHub, by providing custom base URL.
If not provided, it could be read from package.json and default to https://github.com

The logic would be

  • if provided in options.baseUrl explicitly, use it
  • if provided full URL in options.repository, extract and use it
  • if provided full URL in package.json, extract and use it
  • if not provided default to https://github.com

Expected behaviour

var vfile = require('to-vfile')
var remark = require('remark')
var github = require('remark-github')

remark()
  .use(github, { baseUrl: 'https://whatever-entreprise-github.company' } )
  .process(vfile.readSync('example.md'), function(err, file) {
    if (err) throw err
    console.log(String(file))
  })

Alternatives

I see none.

I'm happy to create a PR, if that is something you find useful. I'd need an information, what's the minimum Node.js version we target, to see if I can use some built-in helpers.

commented

I’m up for that!
I don’t have access to GHE, so I can’t be of much help here. However, remark-validate-links also supports GH, GHE, Gitlab, Bitbucket, and such, so that may be of help.
For what we support: the code is written in basically ES3. I’d say make sure to follow the style of existing code, I can help with that by reviewing the PR!

Thanks @wooorm , here's the PR #24

I have a new PR to address this issue here. Please review when you have a chance.

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.