{"id":13783945,"url":"https://github.com/remarkjs/remark-license","last_synced_at":"2025-06-10T21:19:30.517Z","repository":{"id":45322540,"uuid":"48794306","full_name":"remarkjs/remark-license","owner":"remarkjs","description":"plugin to generate a license section","archived":false,"fork":false,"pushed_at":"2023-09-23T12:48:20.000Z","size":162,"stargazers_count":19,"open_issues_count":0,"forks_count":8,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-06-03T15:10:54.185Z","etag":null,"topics":["license","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":{"funding":{"github":"unifiedjs","open_collective":"unified"},"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}},"created_at":"2015-12-30T09:53:00.000Z","updated_at":"2023-12-25T13:19:07.000Z","dependencies_parsed_at":"2024-01-17T03:14:34.039Z","dependency_job_id":"e7afa20a-4a51-4b0e-8260-19981792b301","html_url":"https://github.com/remarkjs/remark-license","commit_stats":{"total_commits":109,"total_committers":4,"mean_commits":27.25,"dds":0.03669724770642202,"last_synced_commit":"2af5f930f0b1f7a1c3b9e02b74205e64c0ac8e87"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkjs%2Fremark-license","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkjs%2Fremark-license/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkjs%2Fremark-license/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkjs%2Fremark-license/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remarkjs","download_url":"https://codeload.github.com/remarkjs/remark-license/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkjs%2Fremark-license/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258509672,"owners_count":22712722,"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":["license","markdown","remark","remark-plugin"],"created_at":"2024-08-03T19:00:33.475Z","updated_at":"2025-06-10T21:19:30.469Z","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-license\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 generate a license section.\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    *   [`unified().use(remarkLicense[, options])`](#unifieduseremarklicense-options)\n    *   [`Options`](#options)\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 generate a license section\nsuch as [the one at the bottom of this readme][license-section].\n\n## When should I use this?\n\nThis project is useful when you’re writing documentation for an open source\nproject, typically a Node.js package, that has one or more readmes and maybe\nsome other markdown files as well.\nYou want to show the author and license associated with the project.\nWhen this plugin is used, authors can add a certain heading (say, `## License`)\nto documents and this plugin will populate them.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install remark-license\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport remarkLicense from 'https://esm.sh/remark-license@7'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import remarkLicense from 'https://esm.sh/remark-license@7?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\nSay we have the following file `example.md` in this project:\n\n```markdown\n# Example\n\nSome text.\n\n## Use\n\n## API\n\n## License\n```\n\n…and a module `example.js`:\n\n```js\nimport {remark} from 'remark'\nimport remarkLicense from 'remark-license'\nimport {read} from 'to-vfile'\n\nconst file = await remark()\n  .use(remarkLicense)\n  .process(await read('example.md'))\n\nconsole.log(String(file))\n```\n\nNow running `node example.js` yields:\n\n```markdown\n# Example\n\nSome text.\n\n## Use\n\n## API\n\n## License\n\n[MIT](license) © [Titus Wormer](https://wooorm.com)\n```\n\n\u003e 👉 **Note**: This info is inferred from this project’s\n\u003e [`package.json`][file-package-json] and [`license`][file-license] file.\n\u003e Running this example in a different package will yield different results.\n\n## API\n\nThis package exports no identifiers.\nThe default export is [`remarkLicense`][api-remark-license].\n\n### `unified().use(remarkLicense[, options])`\n\nGenerate a license section.\n\n###### Parameters\n\n*   `options` ([`Options`][api-options], optional)\n    — configuration\n\n###### Returns\n\nTransform ([`Transformer`][unified-transformer]).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Fields\n\n*   `ignoreFinalDefinitions` (`boolean`, default: `true`)\n    — ignore definitions at the end of the license section\n*   `file` (`string`, optional)\n    — path to license file;\n    detected from the files in the directory of the `package.json` if there is\n    one, or the current working directory, in which case the first file\n    matching `/^licen[cs]e(?=$|\\.)/i` is used;\n    if there is no given or found license file, but `options.license` is a\n    known [SPDX][] identifier, the URL to the license on `spdx.org` is used\n*   `heading` (`RegExp | string`, default: `/^licen[cs]e$/i`)\n    — heading to look for\n*   `license` (`string`, optional, example: `'mit'`)\n    — [SPDX][] identifier;\n    detected from the `license` field in the `package.json` in the current\n    working directory;\n    throws when neither given nor detected\n*   `name` (`string`, optional)\n    — license holder;\n    detected from the `package.json` closest to the file supporting both\n    `object` and `string` format of `author`;\n    throws when neither given nor detected\n*   `url` (`string`, optional)\n    — URL to license holder;\n    detected from the `package.json` in the current working directory\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`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-license@^7`,\ncompatible with Node.js 16.\n\nThis plugin works with `unified` version 6+ and `remark` version 7+.\n\n## Security\n\n`options.url` (or `author.url` in `package.json`) is used and injected into the\ntree when it’s given or found.\nThis could open you up to a [cross-site scripting (XSS)][wiki-xss] attack if\nyou pass user provided content in or store user provided content in\n`package.json`.\n\nThis may become a problem if the markdown is later transformed to **[rehype][]**\n(**[hast][]**) or opened in an unsafe markdown viewer.\n\n## Related\n\n*   [`remark-collapse`](https://github.com/Rokt33r/remark-collapse)\n    – make some sections collapsible\n*   [`remark-contributors`](https://github.com/hughsk/remark-contributors)\n    – generate a contributors section\n*   [`remark-toc`](https://github.com/remarkjs/remark-toc)\n    — generate a table of contents\n*   [`remark-usage`](https://github.com/remarkjs/remark-usage)\n    — generate a usage example\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](https://wooorm.com)\n\n[build-badge]: https://github.com/remarkjs/remark-license/workflows/main/badge.svg\n\n[build]: https://github.com/remarkjs/remark-license/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-license.svg\n\n[coverage]: https://codecov.io/github/remarkjs/remark-license\n\n[downloads-badge]: https://img.shields.io/npm/dm/remark-license.svg\n\n[downloads]: https://www.npmjs.com/package/remark-license\n\n[size-badge]: https://img.shields.io/bundlejs/size/remark-license\n\n[size]: https://bundlejs.com/?q=remark-license\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[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[spdx]: https://spdx.org/licenses/\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[file-package-json]: package.json\n\n[file-license]: license\n\n[license-section]: #license\n\n[api-options]: #options\n\n[api-remark-license]: #unifieduseremarklicense-options\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremarkjs%2Fremark-license","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremarkjs%2Fremark-license","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremarkjs%2Fremark-license/lists"}