npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

remark-gitlab

v1.1.7

Published

remark plugin to autolink references like in GitLab issues, MRs, and comments

Downloads

392

Readme

remark-gitlab

ci Coverage npm Size

remark plugin to automatically link references to commits, issues, merge-requests, and users, like in gitlab issues, MRs, and comments.

Install

npm install remark-gitlab

Use

Say we have the following file, example.md:

Some references:

*   Commit: f8083175fe890cbf14f41d0a06e7aa35d4989587
*   Commit (fork): foo@f8083175fe890cbf14f41d0a06e7aa35d4989587
*   Commit (repo): justjavac/remark-gitlab@e1aa9f6c02de18b9459b7d269712bcb50183ce89
*   Issue (`#`): #1
*   Issue (fork): foo#1
*   Issue (project): justjavac/remark-gitlab#1
*   Mention: @justjavac

Some links:

*   Commit: <https://gitlab.com/justjavac/remark-gitlab/commit/e1aa9f6c02de18b9459b7d269712bcb50183ce89>
*   Commit comment: <https://gitlab.com/justjavac/remark-gitlab/commit/ac63bc3abacf14cf08ca5e2d8f1f8e88a7b9015c#commitcomment-16372693>
*   Issue: <https://gitlab.com/justjavac/remark-gitlab/issues/182>
*   Issue: <https://gitlab.com/justjavac/remark-gitlab/issues/3#issue-151160339>
*   Mention: <https://gitlab.com/justjavac>

And our script, example.js, looks as follows:

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

remark()
  .use(gitlab)
  .process(vfile.readSync('example.md'), function (err, file) {
    if (err) throw err
    console.log(String(file))
  })

Now, running node example yields:

Some references:

*   Commit: [`f808317`](https://gitlab.com/justjavac/remark-gitlab/commit/f8083175fe890cbf14f41d0a06e7aa35d4989587)
*   Commit (fork): [foo@`f808317`](https://gitlab.com/justjavac/foo/commit/f8083175fe890cbf14f41d0a06e7aa35d4989587)
*   Commit (repo): [justjavac/remark-gitlab@`e1aa9f6`](https://gitlab.com/justjavac/remark-gitlab/commit/e1aa9f6c02de18b9459b7d269712bcb50183ce89)
*   Issue (`#`): [#1](https://gitlab.com/justjavac/remark-gitlab/issues/1)
*   Issue (fork): [foo#1](https://gitlab.com/justjavac/foo/issues/1)
*   Issue (project): [justjavac/remark-gitlab#1](https://gitlab.com/justjavac/remark-gitlab/issues/1)
*   Mention: [**@justjavac**](https://gitlab.com/justjavac)

Some links:

*   Commit: [justjavac/remark-gitlab@`e1aa9f6`](https://gitlab.com/justjavac/remark-gitlab/commit/e1aa9f6c02de18b9459b7d269712bcb50183ce89)
*   Commit comment: [justjavac/remark-gitlab@`ac63bc3` (comment)](https://gitlab.com/justjavac/remark-gitlab/commit/ac63bc3abacf14cf08ca5e2d8f1f8e88a7b9015c#commitcomment-16372693)
*   Issue: [justjavac/remark-gitlab#182](https://gitlab.com/justjavac/remark-gitlab/issues/182)
*   Issue comment: [#3 (comment)](https://gitlab.com/justjavac/remark-gitlab/issues/3#issue-151160339)
*   Mention: <https://gitlab.com/justjavac>

API

remark.use(gitlab[, options])

Automatically link references to commits, issues, merge-requests, and users, like in gitlab issues, PRs, and comments.

Conversion
Repository

These links are generated relative to a project. In Node this is detected automatically by loading package.json and looking for a repository field. In the browser, or when overwriting this, you can pass a repository in options. The value of repository should be a URL to a gitlab repository, such as 'https://gitlab.com/user/project.git', or only 'user/project'.

Mentions

By default, mentions are wrapped in strong nodes (that render to <strong> in HTML), to simulate the look of mentions on gitlab. However, this creates different HTML markup, as the gitlab site applies these styles using CSS. Pass mentionStrong: false to turn off this behavior.

License

remark-gitlab is released under the MIT License. See the bundled LICENSE file for details.