{"id":13483568,"url":"https://github.com/remarkjs/remark-github","last_synced_at":"2025-12-12T05:50:02.897Z","repository":{"id":28798513,"uuid":"32321475","full_name":"remarkjs/remark-github","owner":"remarkjs","description":"remark plugin to link references to commits, issues, pull-requests, and users, like on GitHub","archived":false,"fork":false,"pushed_at":"2024-08-17T13:33:28.000Z","size":344,"stargazers_count":181,"open_issues_count":0,"forks_count":22,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-01-29T01:52:48.956Z","etag":null,"topics":["gfm","github","markdown","remark","remark-plugin"],"latest_commit_sha":null,"homepage":"https://remark.js.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remarkjs.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"unifiedjs","open_collective":"unified"}},"created_at":"2015-03-16T11:50:35.000Z","updated_at":"2025-01-16T14:35:44.000Z","dependencies_parsed_at":"2024-06-18T12:39:21.926Z","dependency_job_id":"1f267ec9-54aa-4286-b96a-57afc49c674a","html_url":"https://github.com/remarkjs/remark-github","commit_stats":{"total_commits":220,"total_committers":10,"mean_commits":22.0,"dds":"0.050000000000000044","last_synced_commit":"9cd4e9d8fa6cd3520d11aa922462a0089e1204c5"},"previous_names":["wooorm/mdast-github"],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkjs%2Fremark-github","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkjs%2Fremark-github/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkjs%2Fremark-github/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkjs%2Fremark-github/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remarkjs","download_url":"https://codeload.github.com/remarkjs/remark-github/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237651098,"owners_count":19344667,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gfm","github","markdown","remark","remark-plugin"],"created_at":"2024-07-31T17:01:12.836Z","updated_at":"2025-12-12T05:49:57.850Z","avatar_url":"https://github.com/remarkjs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":["JavaScript","Plugins"],"sub_categories":[],"readme":"# remark-github\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n**[remark][]** plugin to link references to commits, issues, and users, in the\nsame way that GitHub does in comments, issues, PRs, and releases (see [Writing\non GitHub][github-writing]).\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`defaultBuildUrl(values)`](#defaultbuildurlvalues)\n    *   [`unified().use(remarkGithub[, options])`](#unifieduseremarkgithub-options)\n    *   [`BuildUrl`](#buildurl)\n    *   [`BuildUrlCommitValues`](#buildurlcommitvalues)\n    *   [`BuildUrlCompareValues`](#buildurlcomparevalues)\n    *   [`BuildUrlIssueValues`](#buildurlissuevalues)\n    *   [`BuildUrlMentionValues`](#buildurlmentionvalues)\n    *   [`BuildUrlValues`](#buildurlvalues)\n    *   [`Options`](#options)\n*   [Examples](#examples)\n    *   [Example: `buildUrl`](#example-buildurl)\n*   [Syntax](#syntax)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Security](#security)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package is a [unified][] ([remark][]) plugin to link references to commits,\nissues, and users: `@wooorm` -\u003e `[**@wooorm**](https://github.com/wooorm)`.\n\n## When should I use this?\n\nThis project is useful if you want to emulate how markdown would work in GitHub\ncomments, issues, PRs, or releases, but it’s actually displayed somewhere else\n(on a website, or in other places on GitHub which don’t link references, such as\nmarkdown in a repo or Gist).\nThis plugin does not support other platforms such as GitLab or Bitbucket and\ntheir custom features.\n\nA different plugin, [`remark-gfm`][remark-gfm], adds support for GFM (GitHub\nFlavored Markdown).\nGFM is a set of extensions (autolink literals, footnotes, strikethrough, tables,\nand tasklists) to markdown that are supported everywhere on GitHub.\n\nAnother plugin, [`remark-breaks`][remark-breaks], turns soft line endings\n(enters) into hard breaks (`\u003cbr\u003e`s).\nGitHub does this in a few places (comments, issues, PRs, and releases), but it’s\nnot semantic according to HTML and not compliant to markdown.\n\nYet another plugin, [`remark-frontmatter`][remark-frontmatter], adds support\nfor YAML frontmatter.\nGitHub supports frontmatter for files in Gists and repos.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install remark-github\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport remarkGithub, {defaultBuildUrl} from 'https://esm.sh/remark-github@12'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import remarkGithub, {defaultBuildUrl} from 'https://esm.sh/remark-github@12?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\nSay we have the following file `example.md`:\n\n```markdown\nSome references:\n\n*   Commit: f8083175fe890cbf14f41d0a06e7aa35d4989587\n*   Commit (fork): foo@f8083175fe890cbf14f41d0a06e7aa35d4989587\n*   Commit (repo): remarkjs/remark@e1aa9f6c02de18b9459b7d269712bcb50183ce89\n*   Issue or PR (`#`): #1\n*   Issue or PR (`GH-`): GH-1\n*   Issue or PR (fork): foo#1\n*   Issue or PR (project): remarkjs/remark#1\n*   Mention: @wooorm\n\nSome links:\n\n*   Commit: \u003chttps://github.com/remarkjs/remark/commit/e1aa9f6c02de18b9459b7d269712bcb50183ce89\u003e\n*   Commit comment: \u003chttps://github.com/remarkjs/remark/commit/ac63bc3abacf14cf08ca5e2d8f1f8e88a7b9015c#commitcomment-16372693\u003e\n*   Issue or PR: \u003chttps://github.com/remarkjs/remark/issues/182\u003e\n*   Issue or PR comment: \u003chttps://github.com/remarkjs/remark-github/issues/3#issue-151160339\u003e\n*   Mention: \u003chttps://github.com/ben-eb\u003e\n```\n\n…and a module `example.js`:\n\n```js\nimport {remark} from 'remark'\nimport remarkGfm from 'remark-gfm'\nimport remarkGithub from 'remark-github'\nimport {read} from 'to-vfile'\n\nconst file = await remark()\n  .use(remarkGfm)\n  .use(remarkGithub)\n  .process(await read('example.md'))\n\nconsole.log(String(file))\n```\n\n…then running `node example.js` yields:\n\n```markdown\nSome references:\n\n* Commit: [`f808317`](https://github.com/remarkjs/remark-github/commit/f8083175fe890cbf14f41d0a06e7aa35d4989587)\n* Commit (fork): [foo@`f808317`](https://github.com/foo/remark-github/commit/f8083175fe890cbf14f41d0a06e7aa35d4989587)\n* Commit (repo): [remarkjs/remark@`e1aa9f6`](https://github.com/remarkjs/remark/commit/e1aa9f6c02de18b9459b7d269712bcb50183ce89)\n* Issue or PR (`#`): [#1](https://github.com/remarkjs/remark-github/issues/1)\n* Issue or PR (`GH-`): [GH-1](https://github.com/remarkjs/remark-github/issues/1)\n* Issue or PR (fork): [foo#1](https://github.com/foo/remark-github/issues/1)\n* Issue or PR (project): [remarkjs/remark#1](https://github.com/remarkjs/remark/issues/1)\n* Mention: [**@wooorm**](https://github.com/wooorm)\n\nSome links:\n\n* Commit: [remarkjs/remark@`e1aa9f6`](https://github.com/remarkjs/remark/commit/e1aa9f6c02de18b9459b7d269712bcb50183ce89)\n* Commit comment: [remarkjs/remark@`ac63bc3` (comment)](https://github.com/remarkjs/remark/commit/ac63bc3abacf14cf08ca5e2d8f1f8e88a7b9015c#commitcomment-16372693)\n* Issue or PR: [remarkjs/remark#182](https://github.com/remarkjs/remark/issues/182)\n* Issue or PR comment: [#3 (comment)](https://github.com/remarkjs/remark-github/issues/3#issue-151160339)\n* Mention: \u003chttps://github.com/ben-eb\u003e\n```\n\n## API\n\nThis package exports the identifier [`defaultBuildUrl`][api-default-build-url].\nThe default export is [`remarkGithub`][api-remark-github].\n\n### `defaultBuildUrl(values)`\n\nCreate a URL to GH.\n\n###### Parameters\n\n*   `values` ([`BuildUrlValues`][api-build-url-values])\n    — info on the link to build\n\n###### Returns\n\nURL to use (`string`).\n\n### `unified().use(remarkGithub[, options])`\n\nLink references to users, commits, and issues, in the same way that GitHub does\nin comments, issues, PRs, and releases.\n\n###### Parameters\n\n*   `options` ([`Options`][api-options], optional)\n    — configuration\n\n###### Returns\n\nTransform ([`Transformer`][unified-transformer]).\n\n### `BuildUrl`\n\nCreate a URL (TypeScript type).\n\n###### Parameters\n\n*   `values` ([`BuildUrlValues`][api-build-url-values])\n    — info on the link to build\n\n###### Returns\n\nURL to use or `false` to not link (`string | false`).\n\n### `BuildUrlCommitValues`\n\nInfo for commit hash (TypeScript type).\n\n###### Fields\n\n*   `hash` (`string`)\n    — commit hash value\n*   `project` (`string`)\n    — project name\n*   `type` (`'commit'`)\n    — kind\n*   `user` (`string`)\n    — owner of repo\n\n### `BuildUrlCompareValues`\n\nInfo for commit hash ranges (TypeScript type).\n\n###### Fields\n\n*   `base` (`string`)\n    — SHA of the range start\n*   `compare` (`string`)\n    — SHA of the range end\n*   `project` (`string`)\n    — project name\n*   `type` (`'compare'`)\n    — kind\n*   `user` (`string`)\n    — owner of repo\n\n### `BuildUrlIssueValues`\n\nInfo for issues (TypeScript type).\n\n###### Fields\n\n*   `no` (`string`)\n    — issue number\n*   `project` (`string`)\n    — project name\n*   `type` (`'issue'`)\n    — kind\n*   `user` (`string`)\n    — owner of repo\n\n### `BuildUrlMentionValues`\n\nInfo for mentions (TypeScript type).\n\n###### Fields\n\n*   `type` (`'mention'`)\n    — kind\n*   `user` (`string`)\n    — user name\n\n### `BuildUrlValues`\n\nInfo (TypeScript type).\n\n###### Type\n\n```ts\ntype BuildUrlValues =\n  | BuildUrlCommitValues\n  | BuildUrlCompareValues\n  | BuildUrlIssueValues\n  | BuildUrlMentionValues\n```\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Fields\n\n*   `buildUrl` ([`BuildUrl`][api-build-url], default:\n    [`defaultBuildUrl`][api-default-build-url])\n    — change how things are linked\n*   `mentionStrong` (`boolean`, default: `true`)\n    — wrap mentions in `strong`;\n    this makes them render more like how GitHub styles them, but GH itself\n    uses CSS instead of `strong`\n*   `repository` (`string`, default: `repository` from `packag.json` in CWD in\n    Node, otherwise required)\n    — repository to link against;\n    should point to a GitHub repository (such as `'user/project'`)\n\n## Examples\n\n### Example: `buildUrl`\n\nA `buildUrl` can be passed to not link mentions.\nFor example, by changing `example.js` from before like so:\n\n```diff\n@@ -1,11 +1,15 @@\n import {remark} from 'remark'\n import remarkGfm from 'remark-gfm'\n-import remarkGithub from 'remark-github'\n+import remarkGithub, {defaultBuildUrl} from 'remark-github'\n import {read} from 'to-vfile'\n\n const file = await remark()\n   .use(remarkGfm)\n-  .use(remarkGithub)\n+  .use(remarkGithub, {\n+    buildUrl(values) {\n+      return values.type === 'mention' ? false : defaultBuildUrl(values)\n+    }\n+  })\n   .process(await read('example.md'))\n\n console.log(String(file))\n```\n\nTo instead point mentions to a different place, change `example.js` like so:\n\n```diff\n@@ -1,11 +1,17 @@\n import {remark} from 'remark'\n import remarkGfm from 'remark-gfm'\n-import remarkGithub from 'remark-github'\n+import remarkGithub, {defaultBuildUrl} from 'remark-github'\n import {read} from 'to-vfile'\n\n const file = await remark()\n   .use(remarkGfm)\n-  .use(remarkGithub)\n+  .use(remarkGithub, {\n+    buildUrl(values) {\n+      return values.type === 'mention'\n+        ? `https://yourwebsite.com/${values.user}/`\n+        : defaultBuildUrl(values)\n+    }\n+  })\n   .process(await read('example.md'))\n\n console.log(String(file))\n```\n\n## Syntax\n\nThe following references are supported:\n\n*   Commits:\n    `1f2a4fb` →\n    [`1f2a4fb`][github-sha]\n*   Commits across forks:\n    `remarkjs@1f2a4fb` →\n    [remarkjs@`1f2a4fb`][github-sha]\n*   Commits across projects:\n    `remarkjs/remark-github@1f2a4fb` →\n    [remarkjs/remark-github@`1f2a4fb`][github-sha]\n*   Compare ranges:\n    `e2acebc...2aa9311` →\n    [`e2acebc...2aa9311`][github-sha-range]\n*   Compare ranges across forks:\n    `remarkjs@e2acebc...2aa9311` →\n    [remarkjs/remark-github@`e2acebc...2aa9311`][github-sha-range]\n*   Compare ranges across projects:\n    `remarkjs/remark-github@e2acebc...2aa9311` →\n    [remarkjs/remark-github@`e2acebc...2aa9311`][github-sha-range]\n*   Prefix issues:\n    `GH-1` →\n    [GH-1][github-issue]\n*   Hash issues:\n    `#1` →\n    [#1][github-issue]\n*   Issues across forks:\n    `remarkjs#1` →\n    [remarkjs#1][github-issue]\n*   Issues across projects:\n    `remarkjs/remark-github#1` →\n    [remarkjs/remark-github#1][github-issue]\n*   At-mentions:\n    `@wooorm` →\n    [**@wooorm**][github-mention]\n\nAutolinks to these references are also transformed:\n`https://github.com/wooorm` -\u003e `[**@wooorm**](https://github.com/wooorm)`\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional types\n[`BuildUrl`][api-build-url],\n[`BuildUrlCommitValues`][api-build-url-commit-values],\n[`BuildUrlCompareValues`][api-build-url-compare-values],\n[`BuildUrlIssueValues`][api-build-url-issue-values],\n[`BuildUrlMentionValues`][api-build-url-mention-values],\n[`BuildUrlValues`][api-build-url-values],\n[`DefaultBuildUrl`][api-default-build-url],\n[`Options`][api-options].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `remark-github@^12`,\ncompatible with Node.js 16.\n\nThis plugin works with `unified` version 6+ and `remark` version 7+.\n\n## Security\n\nUse of `remark-github` does not involve **[rehype][]** (**[hast][]**).\nIt does inject links based on user content, but those links only go to GitHub.\nThere are no openings for [cross-site scripting (XSS)][wiki-xss] attacks.\n\n## Related\n\n*   [`remark-gfm`][remark-gfm]\n    — support GFM (autolink literals, footnotes, strikethrough, tables,\n    tasklists)\n*   [`remark-breaks`][remark-breaks]\n    — support breaks without needing spaces or escapes (enters to `\u003cbr\u003e`)\n*   [`remark-frontmatter`][remark-frontmatter]\n    — support frontmatter (YAML, TOML, and more)\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways\nto get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/remarkjs/remark-github/workflows/main/badge.svg\n\n[build]: https://github.com/remarkjs/remark-github/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-github.svg\n\n[coverage]: https://codecov.io/github/remarkjs/remark-github\n\n[downloads-badge]: https://img.shields.io/npm/dm/remark-github.svg\n\n[downloads]: https://www.npmjs.com/package/remark-github\n\n[size-badge]: https://img.shields.io/bundlejs/size/remark-github\n\n[size]: https://bundlejs.com/?q=remark-github\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/remarkjs/remark/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[health]: https://github.com/remarkjs/.github\n\n[contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md\n\n[support]: https://github.com/remarkjs/.github/blob/main/support.md\n\n[coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[github-issue]: https://github.com/remarkjs/remark-github/issues/1\n\n[github-mention]: https://github.com/wooorm\n\n[github-sha]: https://github.com/remarkjs/remark-github/commit/1f2a4fb8f88a0a98ea9d0c0522cd538a9898f921\n\n[github-sha-range]: https://github.com/wooorm/remark/compare/e2acebc...2aa9311\n\n[github-writing]: https://docs.github.com/en/github/writing-on-github#references\n\n[hast]: https://github.com/syntax-tree/hast\n\n[rehype]: https://github.com/rehypejs/rehype\n\n[remark]: https://github.com/remarkjs/remark\n\n[remark-gfm]: https://github.com/remarkjs/remark-gfm\n\n[remark-breaks]: https://github.com/remarkjs/remark-breaks\n\n[remark-frontmatter]: https://github.com/remarkjs/remark-frontmatter\n\n[typescript]: https://www.typescriptlang.org\n\n[unified]: https://github.com/unifiedjs/unified\n\n[unified-transformer]: https://github.com/unifiedjs/unified#transformer\n\n[wiki-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n[api-options]: #options\n\n[api-remark-github]: #unifieduseremarkgithub-options\n\n[api-build-url]: #buildurl\n\n[api-build-url-commit-values]: #buildurlcommitvalues\n\n[api-build-url-compare-values]: #buildurlcomparevalues\n\n[api-build-url-issue-values]: #buildurlissuevalues\n\n[api-build-url-mention-values]: #buildurlmentionvalues\n\n[api-build-url-values]: #buildurlvalues\n\n[api-default-build-url]: #\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremarkjs%2Fremark-github","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremarkjs%2Fremark-github","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremarkjs%2Fremark-github/lists"}