├── .remarkignore ├── .prettierignore ├── test ├── fixtures │ ├── file-licence │ │ ├── LICENCE │ │ ├── readme.md │ │ ├── output.md │ │ └── package.json │ ├── file-license │ │ ├── LICENSE │ │ ├── readme.md │ │ ├── output.md │ │ └── package.json │ ├── file-license-md │ │ ├── license.md │ │ ├── readme.md │ │ ├── package.json │ │ └── output.md │ ├── settings │ │ ├── package.json │ │ ├── readme.md │ │ ├── output.md │ │ └── config.json │ ├── file-license-deep │ │ ├── licenses │ │ │ ├── license-csi │ │ │ └── license-mix │ │ ├── readme.md │ │ ├── output.md │ │ └── config.json │ ├── no-heading │ │ ├── output.md │ │ ├── readme.md │ │ └── package.json │ ├── normal-url │ │ ├── readme.md │ │ ├── output.md │ │ └── package.json │ ├── normal │ │ ├── readme.md │ │ ├── output.md │ │ └── package.json │ ├── normal-licence │ │ ├── readme.md │ │ ├── output.md │ │ └── package.json │ ├── match-heading-regex │ │ ├── readme.md │ │ ├── output.md │ │ └── config.js │ ├── match-heading-string │ │ ├── readme.md │ │ ├── output.md │ │ └── config.json │ ├── normal-author-object │ │ ├── readme.md │ │ ├── output.md │ │ └── package.json │ ├── normal-licence-spdx │ │ ├── readme.md │ │ ├── package.json │ │ └── output.md │ ├── normal-url-and-email │ │ ├── readme.md │ │ ├── output.md │ │ └── package.json │ ├── settings-precedence │ │ ├── readme.md │ │ ├── package.json │ │ ├── output.md │ │ └── config.json │ ├── normal-url-author-object │ │ ├── readme.md │ │ ├── output.md │ │ └── package.json │ ├── normal-url-no-protocol │ │ ├── readme.md │ │ ├── output.md │ │ └── package.json │ ├── fail-missing-required-name-in │ │ ├── readme.md │ │ └── package.json │ ├── fail-unexpected-end-of-json │ │ └── readme.md │ ├── fail-missing-required-name │ │ ├── package.json │ │ └── readme.md │ ├── image-with-alt │ │ ├── readme.md │ │ ├── package.json │ │ └── output.md │ ├── other-headings │ │ ├── readme.md │ │ ├── package.json │ │ └── output.md │ ├── fail-missing-required-name-in-settings │ │ ├── readme.md │ │ └── package.json │ ├── link-with-title │ │ ├── output.md │ │ ├── readme.md │ │ └── package.json │ ├── multiple-headings │ │ ├── readme.md │ │ ├── package.json │ │ └── output.md │ ├── fail-missing-required-license-in-settings │ │ └── readme.md │ ├── fail-missing-required-license │ │ ├── package.json │ │ └── readme.md │ ├── definitions-ignore-false │ │ ├── config.json │ │ ├── output.md │ │ ├── package.json │ │ └── readme.md │ ├── definitions │ │ ├── package.json │ │ ├── readme.md │ │ └── output.md │ └── license-file-with-license-heading │ │ ├── config.json │ │ ├── output.md │ │ └── readme.md └── index.js ├── .npmrc ├── lib ├── find-license.default.js ├── find-nearest-package.default.js ├── find-license.node.js ├── find-nearest-package.node.js └── index.js ├── .gitignore ├── index.js ├── .editorconfig ├── .github └── workflows │ ├── bb.yml │ └── main.yml ├── tsconfig.json ├── license ├── package.json └── readme.md /.remarkignore: -------------------------------------------------------------------------------- 1 | /test/fixtures/ 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | coverage/ 2 | *.md 3 | -------------------------------------------------------------------------------- /test/fixtures/file-licence/LICENCE: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/file-license/LICENSE: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/file-license-md/license.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/settings/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | ignore-scripts=true 2 | package-lock=false 3 | -------------------------------------------------------------------------------- /test/fixtures/file-license-deep/licenses/license-csi: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/file-license-deep/licenses/license-mix: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/no-heading/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## Foo 4 | -------------------------------------------------------------------------------- /test/fixtures/no-heading/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## Foo 4 | -------------------------------------------------------------------------------- /test/fixtures/normal-url/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/normal/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/settings/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/file-licence/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/file-license-md/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/file-license/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/normal-licence/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## Licence 4 | -------------------------------------------------------------------------------- /lib/find-license.default.js: -------------------------------------------------------------------------------- 1 | export async function findLicense() {} 2 | -------------------------------------------------------------------------------- /test/fixtures/file-license-deep/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/match-heading-regex/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## Lizenz 4 | -------------------------------------------------------------------------------- /test/fixtures/match-heading-string/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## Lizenz 4 | -------------------------------------------------------------------------------- /test/fixtures/normal-author-object/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/normal-licence-spdx/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## Licence 4 | -------------------------------------------------------------------------------- /test/fixtures/normal-url-and-email/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/settings-precedence/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/normal-url-author-object/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/normal-url-no-protocol/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/fail-missing-required-name-in/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/fail-unexpected-end-of-json/readme.md: -------------------------------------------------------------------------------- 1 | # Pi 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /lib/find-nearest-package.default.js: -------------------------------------------------------------------------------- 1 | export async function findNearestPackage() {} 2 | -------------------------------------------------------------------------------- /test/fixtures/fail-missing-required-name/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/image-with-alt/readme.md: -------------------------------------------------------------------------------- 1 | # Pi 2 | 3 | ## ![License](some-image.svg) 4 | -------------------------------------------------------------------------------- /test/fixtures/normal/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | MIX © Alpha Bravo 6 | -------------------------------------------------------------------------------- /test/fixtures/other-headings/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | ## Other 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | coverage/ 2 | node_modules/ 3 | .DS_Store 4 | *.d.ts 5 | *.log 6 | yarn.lock 7 | -------------------------------------------------------------------------------- /test/fixtures/fail-missing-required-name-in-settings/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/link-with-title/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## [](some-image.svg "License") 4 | -------------------------------------------------------------------------------- /test/fixtures/link-with-title/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## [](some-image.svg "License") 4 | -------------------------------------------------------------------------------- /test/fixtures/multiple-headings/readme.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | # License 6 | -------------------------------------------------------------------------------- /test/fixtures/fail-missing-required-license-in-settings/readme.md: -------------------------------------------------------------------------------- 1 | # Pi 2 | 3 | ## License 4 | -------------------------------------------------------------------------------- /test/fixtures/fail-missing-required-license/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Alpha Bravo" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/fail-missing-required-name/readme.md: -------------------------------------------------------------------------------- 1 | # Pi 2 | 3 | ## ![License](some-image.svg) 4 | -------------------------------------------------------------------------------- /test/fixtures/match-heading-regex/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## Lizenz 4 | 5 | MIX © Alpha Bravo 6 | -------------------------------------------------------------------------------- /test/fixtures/normal-licence/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## Licence 4 | 5 | MIX © Alpha Bravo 6 | -------------------------------------------------------------------------------- /test/fixtures/definitions-ignore-false/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignoreFinalDefinitions": false 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/fail-missing-required-license/readme.md: -------------------------------------------------------------------------------- 1 | # Pi 2 | 3 | ## ![License](some-image.svg) 4 | -------------------------------------------------------------------------------- /test/fixtures/file-licence/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | [MIX](LICENCE) © Alpha Bravo 6 | -------------------------------------------------------------------------------- /test/fixtures/file-license/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | [MIT](LICENSE) © Alpha Bravo 6 | -------------------------------------------------------------------------------- /test/fixtures/match-heading-string/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## Lizenz 4 | 5 | MIX © Alpha Bravo 6 | -------------------------------------------------------------------------------- /test/fixtures/no-heading/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/normal-author-object/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | MIX © Alpha Bravo 6 | -------------------------------------------------------------------------------- /test/fixtures/normal/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/definitions-ignore-false/output.md: -------------------------------------------------------------------------------- 1 | # [PI][] 2 | 3 | ## License 4 | 5 | MIX © Alpha Bravo 6 | -------------------------------------------------------------------------------- /test/fixtures/definitions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/file-licence/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/file-license-md/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/file-license/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIT", 3 | "author": "Alpha Bravo" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/image-with-alt/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/link-with-title/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/normal-licence/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/other-headings/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/fail-missing-required-name-in/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/file-license-md/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | [MIX](license.md) © Alpha Bravo 6 | -------------------------------------------------------------------------------- /test/fixtures/image-with-alt/output.md: -------------------------------------------------------------------------------- 1 | # Pi 2 | 3 | ## ![License](some-image.svg) 4 | 5 | MIX © Alpha Bravo 6 | -------------------------------------------------------------------------------- /test/fixtures/multiple-headings/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/normal-licence-spdx/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIT", 3 | "author": "Alpha Bravo" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/normal-url/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | MIX © [Alpha Bravo](https://example.com) 6 | -------------------------------------------------------------------------------- /test/fixtures/other-headings/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | MIX © Alpha Bravo 6 | 7 | ## Other 8 | -------------------------------------------------------------------------------- /test/fixtures/definitions-ignore-false/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/definitions/readme.md: -------------------------------------------------------------------------------- 1 | # [PI][] 2 | 3 | ## License 4 | 5 | [pi]: https://en.wikipedia.org/wiki/Pi 6 | -------------------------------------------------------------------------------- /test/fixtures/multiple-headings/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | MIX © Alpha Bravo 6 | 7 | # License 8 | -------------------------------------------------------------------------------- /test/fixtures/fail-missing-required-name-in-settings/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": {} 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/file-license-deep/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | [MIX](licenses/license-mix) © Alpha Bravo 6 | -------------------------------------------------------------------------------- /test/fixtures/normal-url-and-email/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | MIX © [Alpha Bravo](https://example.com) 6 | -------------------------------------------------------------------------------- /test/fixtures/normal-url-author-object/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | MIX © [Alpha Bravo](https://example.com) 6 | -------------------------------------------------------------------------------- /test/fixtures/normal-url-no-protocol/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | MIX © [Alpha Bravo](http://example.com) 6 | -------------------------------------------------------------------------------- /test/fixtures/normal-url/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo (https://example.com)" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/settings-precedence/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Charlie Delta (echo.com)" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/settings/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | [CSI](LICENSE-CSI) © [Alpha Bravo](http://example.com) 6 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @typedef {import('./lib/index.js').Options} Options 3 | */ 4 | 5 | export {default} from './lib/index.js' 6 | -------------------------------------------------------------------------------- /test/fixtures/definitions-ignore-false/readme.md: -------------------------------------------------------------------------------- 1 | # [PI][] 2 | 3 | ## License 4 | 5 | [pi]: https://en.wikipedia.org/wiki/Pi 6 | -------------------------------------------------------------------------------- /test/fixtures/normal-url-no-protocol/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo (example.com)" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/match-heading-string/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "name": "Alpha Bravo", 4 | "heading": "lizenz" 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/normal-licence-spdx/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## Licence 4 | 5 | [MIT](https://opensource.org/licenses/MIT) © Alpha Bravo 6 | -------------------------------------------------------------------------------- /test/fixtures/settings-precedence/output.md: -------------------------------------------------------------------------------- 1 | # PI 2 | 3 | ## License 4 | 5 | [CSI](LICENSE-CSI) © [Alpha Bravo](http://example.com) 6 | -------------------------------------------------------------------------------- /test/fixtures/definitions/output.md: -------------------------------------------------------------------------------- 1 | # [PI][] 2 | 3 | ## License 4 | 5 | MIX © Alpha Bravo 6 | 7 | [pi]: https://en.wikipedia.org/wiki/Pi 8 | -------------------------------------------------------------------------------- /test/fixtures/normal-author-object/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": { 4 | "name": "Alpha Bravo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/file-license-deep/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "file": "licenses/license-mix", 3 | "license": "MIX", 4 | "name": "Alpha Bravo" 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/license-file-with-license-heading/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Alpha Bravo", 3 | "license": "MIX", 4 | "file": "readme.md" 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/settings/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Alpha Bravo", 3 | "license": "CSI", 4 | "file": "LICENSE-CSI", 5 | "url": "example.com" 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/normal-url-and-email/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": "Alpha Bravo (https://example.com)" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/settings-precedence/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Alpha Bravo", 3 | "license": "CSI", 4 | "file": "LICENSE-CSI", 5 | "url": "example.com" 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/license-file-with-license-heading/output.md: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | This is the license file, so even if it has a `license`, heading, it’s not 4 | replaced. 5 | -------------------------------------------------------------------------------- /test/fixtures/license-file-with-license-heading/readme.md: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | This is the license file, so even if it has a `license`, heading, it’s not 4 | replaced. 5 | -------------------------------------------------------------------------------- /test/fixtures/match-heading-regex/config.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | license: 'MIX', 3 | name: 'Alpha Bravo', 4 | heading: /^lizenz$/i 5 | } 6 | 7 | export default config 8 | -------------------------------------------------------------------------------- /test/fixtures/normal-url-author-object/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "license": "MIX", 3 | "author": { 4 | "name": "Alpha Bravo", 5 | "url": "https://example.com" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | -------------------------------------------------------------------------------- /.github/workflows/bb.yml: -------------------------------------------------------------------------------- 1 | name: bb 2 | on: 3 | issues: 4 | types: [opened, reopened, edited, closed, labeled, unlabeled] 5 | pull_request_target: 6 | types: [opened, reopened, edited, closed, labeled, unlabeled] 7 | jobs: 8 | main: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: unifiedjs/beep-boop-beta@main 12 | with: 13 | repo-token: ${{secrets.GITHUB_TOKEN}} 14 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "checkJs": true, 4 | "customConditions": ["development"], 5 | "declaration": true, 6 | "emitDeclarationOnly": true, 7 | "exactOptionalPropertyTypes": true, 8 | "lib": ["es2022"], 9 | "module": "node16", 10 | "strict": true, 11 | "target": "es2022" 12 | }, 13 | "exclude": ["coverage/", "node_modules/"], 14 | "include": ["**/*.js"] 15 | } 16 | -------------------------------------------------------------------------------- /lib/find-license.node.js: -------------------------------------------------------------------------------- 1 | import fs from 'node:fs/promises' 2 | 3 | const licenseRegexp = /^licen[cs]e(?=$|\.)/i 4 | 5 | /** 6 | * @param {string} base 7 | * Folder. 8 | * @returns {Promise} 9 | * Basename of license file. 10 | */ 11 | export async function findLicense(base) { 12 | const files = await fs.readdir(base) 13 | let index = -1 14 | 15 | while (++index < files.length) { 16 | if (licenseRegexp.test(files[index])) { 17 | return files[index] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: main 2 | on: 3 | - pull_request 4 | - push 5 | jobs: 6 | main: 7 | name: ${{matrix.node}} 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v3 11 | - uses: actions/setup-node@v3 12 | with: 13 | node-version: ${{matrix.node}} 14 | - run: npm install 15 | - run: npm test 16 | - uses: codecov/codecov-action@v3 17 | strategy: 18 | matrix: 19 | node: 20 | - lts/gallium 21 | - node 22 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2015 Titus Wormer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /lib/find-nearest-package.node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @typedef {import('vfile').VFile} VFile 3 | */ 4 | 5 | /** 6 | * @typedef Info 7 | * Info. 8 | * @property {string} folder 9 | * Path to folder with `package.json`. 10 | * @property {string | undefined} license 11 | * SPDX identifier. 12 | * @property {string | undefined} name 13 | * Name of author. 14 | * @property {string | undefined} url 15 | * URL for author. 16 | */ 17 | 18 | import fs from 'node:fs/promises' 19 | import path from 'node:path' 20 | import parse from 'parse-author' 21 | import {findUp} from 'vfile-find-up' 22 | 23 | /** 24 | * @param {VFile} from 25 | * File to resolve from. 26 | * @returns {Promise} 27 | * Info. 28 | */ 29 | export async function findNearestPackage(from) { 30 | /* c8 ignore next -- else is for stdin, typically not used. */ 31 | const base = from.dirname ? path.resolve(from.cwd, from.dirname) : from.cwd 32 | const file = await findUp('package.json', base) 33 | 34 | if (file) { 35 | file.value = await fs.readFile(file.path) 36 | /** @type {import('type-fest').PackageJson} */ 37 | const json = JSON.parse(String(file)) 38 | const author = 39 | typeof json.author === 'string' ? parse(json.author) : json.author || {} 40 | 41 | return { 42 | /* c8 ignore next -- always defined. */ 43 | folder: file.dirname ? path.resolve(file.cwd, file.dirname) : file.cwd, 44 | license: json.license, 45 | name: author.name, 46 | url: author.url 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @typedef {import('remark-license').Options} Options 3 | */ 4 | 5 | import assert from 'node:assert/strict' 6 | import fs from 'node:fs/promises' 7 | import process from 'node:process' 8 | import test from 'node:test' 9 | import {fileURLToPath} from 'node:url' 10 | import {remark} from 'remark' 11 | import license from 'remark-license' 12 | import semver from 'semver' 13 | 14 | test('remark-license', async function (t) { 15 | await t.test('should expose the public api', async function () { 16 | assert.deepEqual(Object.keys(await import('remark-license')).sort(), [ 17 | 'default' 18 | ]) 19 | }) 20 | }) 21 | 22 | test('fixtures', async function (t) { 23 | // Prepapre. 24 | const root = new URL('fixtures/', import.meta.url) 25 | const packageUrl = new URL('../package.json', import.meta.url) 26 | const packageBackUrl = new URL('../package.json.bak', import.meta.url) 27 | const brokenPackageUrl = new URL( 28 | 'fail-unexpected-end-of-json/package.json', 29 | root 30 | ) 31 | 32 | await fs.writeFile(brokenPackageUrl, '{\n') 33 | await fs.rename(packageUrl, packageBackUrl) 34 | 35 | // Test. 36 | const fixtures = await fs.readdir(root) 37 | let index = -1 38 | 39 | while (++index < fixtures.length) { 40 | const folder = fixtures[index] 41 | 42 | if (folder.startsWith('.')) continue 43 | 44 | await t.test(folder, async function () { 45 | const folderUrl = new URL(folder + '/', root) 46 | const inputUrl = new URL('readme.md', folderUrl) 47 | const outputUrl = new URL('output.md', folderUrl) 48 | const configUrl = new URL('config.json', folderUrl) 49 | const configJsUrl = new URL('config.js', folderUrl) 50 | 51 | /** @type {Options | undefined} */ 52 | let config 53 | /** @type {string} */ 54 | let output 55 | 56 | try { 57 | config = JSON.parse(String(await fs.readFile(configUrl))) 58 | } catch { 59 | try { 60 | const configMod = await import(String(configJsUrl)) 61 | config = configMod.default 62 | } catch {} 63 | } 64 | 65 | try { 66 | output = String(await fs.readFile(outputUrl)) 67 | } catch { 68 | output = '' 69 | } 70 | 71 | try { 72 | const file = await remark() 73 | .use(license, config) 74 | .process({ 75 | value: await fs.readFile(inputUrl), 76 | cwd: fileURLToPath(folderUrl), 77 | path: 'readme.md' 78 | }) 79 | 80 | assert.equal(String(file), output) 81 | } catch (error) { 82 | if (folder.indexOf('fail-') !== 0) { 83 | throw error 84 | } 85 | 86 | let message = folder.slice(5).replace(/-/g, ' ') 87 | 88 | // Node 20 has a different error message. 89 | if ( 90 | message === 'unexpected end of json' && 91 | semver.satisfies(process.version, '>=20') 92 | ) { 93 | message = 'expected property name or' 94 | } 95 | 96 | assert.match(String(error).replace(/`/g, ''), new RegExp(message, 'i')) 97 | } 98 | }) 99 | } 100 | 101 | // Clean. 102 | await fs.unlink(brokenPackageUrl) 103 | await fs.rename(packageBackUrl, packageUrl) 104 | }) 105 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "remark-license", 3 | "version": "7.0.0", 4 | "description": "remark plugin to generate a license section", 5 | "license": "MIT", 6 | "keywords": [ 7 | "license", 8 | "markdown", 9 | "mdast", 10 | "plain", 11 | "plugin", 12 | "readme", 13 | "remark", 14 | "remark-plugin", 15 | "spdx", 16 | "text", 17 | "text", 18 | "unified" 19 | ], 20 | "repository": "remarkjs/remark-license", 21 | "bugs": "https://github.com/remarkjs/remark-license/issues", 22 | "funding": { 23 | "type": "opencollective", 24 | "url": "https://opencollective.com/unified" 25 | }, 26 | "author": "Titus Wormer (https://wooorm.com)", 27 | "contributors": [ 28 | "Titus Wormer (https://wooorm.com)", 29 | "Ben Briggs (http://beneb.info)" 30 | ], 31 | "sideEffects": false, 32 | "type": "module", 33 | "exports": "./index.js", 34 | "imports": { 35 | "#find-license": { 36 | "node": "./lib/find-license.node.js", 37 | "default": "./lib/find-license.default.js" 38 | }, 39 | "#find-nearest-package": { 40 | "node": "./lib/find-nearest-package.node.js", 41 | "default": "./lib/find-nearest-package.default.js" 42 | } 43 | }, 44 | "files": [ 45 | "lib/", 46 | "index.d.ts", 47 | "index.js" 48 | ], 49 | "dependencies": { 50 | "@types/mdast": "^4.0.0", 51 | "mdast-util-heading-range": "^4.0.0", 52 | "parse-author": "^2.0.0", 53 | "spdx-license-list": "^6.0.0", 54 | "vfile": "^6.0.0", 55 | "vfile-find-up": "^7.0.0" 56 | }, 57 | "devDependencies": { 58 | "@types/node": "^20.0.0", 59 | "@types/parse-author": "^2.0.0", 60 | "c8": "^8.0.0", 61 | "prettier": "^3.0.0", 62 | "remark": "^15.0.0", 63 | "remark-cli": "^11.0.0", 64 | "remark-preset-wooorm": "^9.0.0", 65 | "semver": "^7.0.0", 66 | "type-coverage": "^2.0.0", 67 | "type-fest": "^4.0.0", 68 | "typescript": "^5.0.0", 69 | "xo": "^0.56.0" 70 | }, 71 | "scripts": { 72 | "build": "tsc --build --clean && tsc --build && type-coverage", 73 | "format": "remark . --frail --output --quiet && prettier . --log-level warn --write && xo --fix", 74 | "prepack": "npm run build && npm run format", 75 | "test": "npm run build && npm run format && npm run test-coverage", 76 | "test-api": "node --conditions development test/index.js", 77 | "test-coverage": "c8 --100 --reporter lcov npm run test-api" 78 | }, 79 | "prettier": { 80 | "bracketSpacing": false, 81 | "singleQuote": true, 82 | "semi": false, 83 | "tabWidth": 2, 84 | "trailingComma": "none", 85 | "useTabs": false 86 | }, 87 | "remarkConfig": { 88 | "plugins": [ 89 | "remark-preset-wooorm", 90 | "./index.js" 91 | ] 92 | }, 93 | "typeCoverage": { 94 | "atLeast": 100, 95 | "detail": true, 96 | "ignoreCatch": true, 97 | "strict": true 98 | }, 99 | "xo": { 100 | "overrides": [ 101 | { 102 | "files": [ 103 | "test/**/*.js" 104 | ], 105 | "rules": { 106 | "no-await-in-loop": "off" 107 | } 108 | } 109 | ], 110 | "prettier": true, 111 | "rules": { 112 | "unicorn/prefer-string-replace-all": "off" 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @typedef {import('mdast').Link} Link 3 | * @typedef {import('mdast').Paragraph} Paragraph 4 | * @typedef {import('mdast').PhrasingContent} PhrasingContent 5 | * @typedef {import('mdast').Root} Root 6 | * 7 | * @typedef {import('vfile').VFile} VFile 8 | */ 9 | 10 | /** 11 | * @typedef Options 12 | * Configuration (optional). 13 | * @property {boolean | null | undefined} [ignoreFinalDefinitions=true] 14 | * Ignore definitions at the end of the license section (default: `true`). 15 | * @property {string | null | undefined} [file] 16 | * Path to license file (optional); 17 | * detected from the files in the directory of the `package.json` if there is 18 | * one, or the current working directory, in which case the first file 19 | * matching `/^licen[cs]e(?=$|\.)/i` is used; 20 | * if there is no given or found license file, but `options.license` is a 21 | * known SPDX identifier, the URL to the license on `spdx.org` is used. 22 | * @property {RegExp | string | null | undefined} [heading] 23 | * Heading to look for (default: `/^licen[cs]e$/i`). 24 | * @property {string | null | undefined} [license] 25 | * SPDX identifier (optional, example: `'mit'`); 26 | * detected from the `license` field in the `package.json` in the current 27 | * working directory; 28 | * throws when neither given nor detected. 29 | * @property {string | null | undefined} [name] 30 | * License holder (optional); 31 | * detected from the `package.json` closest to the file supporting both 32 | * `object` and `string` format of `author`; 33 | * throws when neither given nor detected. 34 | * @property {string | null | undefined} [url] 35 | * URL to license holder (optional); 36 | * detected from the `package.json` in the current working directory. 37 | */ 38 | 39 | import {headingRange} from 'mdast-util-heading-range' 40 | import spdx from 'spdx-license-list' 41 | import {findLicense} from '#find-license' 42 | import {findNearestPackage} from '#find-nearest-package' 43 | 44 | const http = 'http://' 45 | const https = 'https://' 46 | const licenseHeadingRegexp = /^licen[cs]e$/i 47 | 48 | /** @type {Readonly} */ 49 | const emptyOptions = {} 50 | 51 | /** 52 | * Generate a license section. 53 | * 54 | * @param {Readonly | null | undefined} [options] 55 | * Configuration (optional). 56 | * @returns 57 | * Transform. 58 | */ 59 | export default function remarkLicense(options) { 60 | const settings = options || emptyOptions 61 | const ignoreFinalDefinitions = settings.ignoreFinalDefinitions !== false 62 | const test = settings.heading || licenseHeadingRegexp 63 | 64 | /** 65 | * Transform. 66 | * 67 | * @param {Root} tree 68 | * Tree. 69 | * @param {VFile} file 70 | * File. 71 | * @returns {Promise} 72 | * Nothing. 73 | */ 74 | return async function (tree, file) { 75 | const info = 76 | !settings.url || !settings.name || !settings.license || !settings.file 77 | ? await findNearestPackage(file) 78 | : undefined 79 | const url = settings.url || (info ? info.url : undefined) 80 | const name = settings.name || (info ? info.name : undefined) 81 | const license = settings.license || (info ? info.license : undefined) 82 | let licenseFile = 83 | settings.file || 84 | (await findLicense((info ? info.folder : undefined) || file.cwd)) 85 | 86 | // Ignore the license file itself. 87 | if (licenseFile && file.path === licenseFile) { 88 | return 89 | } 90 | 91 | if (!license) { 92 | throw new Error( 93 | 'Missing required `license` in settings.\n' + 94 | 'Either add a `license` to a `package.json` file\n' + 95 | 'or pass it into `remark-license`' 96 | ) 97 | } 98 | 99 | if (!name) { 100 | throw new Error( 101 | 'Missing required `name` in settings.\n' + 102 | 'Either add an `author` to a `package.json` file\n' + 103 | 'or pass it into `remark-license`' 104 | ) 105 | } 106 | 107 | if (!licenseFile && license in spdx) { 108 | licenseFile = spdx[license].url 109 | } 110 | 111 | headingRange( 112 | tree, 113 | {ignoreFinalDefinitions, test}, 114 | function (start, _, end) { 115 | /** @type {Array} */ 116 | const children = [] 117 | /** @type {Paragraph} */ 118 | const node = {type: 'paragraph', children} 119 | /** @type {Link | Paragraph} */ 120 | let parent 121 | 122 | if (licenseFile) { 123 | parent = {type: 'link', title: null, url: licenseFile, children: []} 124 | children.push(parent) 125 | } else { 126 | parent = node 127 | } 128 | 129 | parent.children.push({type: 'text', value: license}) 130 | children.push({type: 'text', value: ' © '}) 131 | 132 | if (url) { 133 | parent = { 134 | type: 'link', 135 | title: null, 136 | url: 137 | url.slice(0, http.length) !== http && 138 | url.slice(0, https.length) !== https 139 | ? http + url 140 | : url, 141 | children: [] 142 | } 143 | children.push(parent) 144 | } else { 145 | parent = node 146 | } 147 | 148 | parent.children.push({type: 'text', value: name}) 149 | 150 | return [start, node, end] 151 | } 152 | ) 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # remark-license 2 | 3 | [![Build][build-badge]][build] 4 | [![Coverage][coverage-badge]][coverage] 5 | [![Downloads][downloads-badge]][downloads] 6 | [![Size][size-badge]][size] 7 | [![Sponsors][sponsors-badge]][collective] 8 | [![Backers][backers-badge]][collective] 9 | [![Chat][chat-badge]][chat] 10 | 11 | **[remark][]** plugin to generate a license section. 12 | 13 | ## Contents 14 | 15 | * [What is this?](#what-is-this) 16 | * [When should I use this?](#when-should-i-use-this) 17 | * [Install](#install) 18 | * [Use](#use) 19 | * [API](#api) 20 | * [`unified().use(remarkLicense[, options])`](#unifieduseremarklicense-options) 21 | * [`Options`](#options) 22 | * [Types](#types) 23 | * [Compatibility](#compatibility) 24 | * [Security](#security) 25 | * [Related](#related) 26 | * [Contribute](#contribute) 27 | * [License](#license) 28 | 29 | ## What is this? 30 | 31 | This package is a [unified][] ([remark][]) plugin to generate a license section 32 | such as [the one at the bottom of this readme][license-section]. 33 | 34 | ## When should I use this? 35 | 36 | This project is useful when you’re writing documentation for an open source 37 | project, typically a Node.js package, that has one or more readmes and maybe 38 | some other markdown files as well. 39 | You want to show the author and license associated with the project. 40 | When this plugin is used, authors can add a certain heading (say, `## License`) 41 | to documents and this plugin will populate them. 42 | 43 | ## Install 44 | 45 | This package is [ESM only][esm]. 46 | In Node.js (version 16+), install with [npm][]: 47 | 48 | ```sh 49 | npm install remark-license 50 | ``` 51 | 52 | In Deno with [`esm.sh`][esmsh]: 53 | 54 | ```js 55 | import remarkLicense from 'https://esm.sh/remark-license@7' 56 | ``` 57 | 58 | In browsers with [`esm.sh`][esmsh]: 59 | 60 | ```html 61 | 64 | ``` 65 | 66 | ## Use 67 | 68 | Say we have the following file `example.md` in this project: 69 | 70 | ```markdown 71 | # Example 72 | 73 | Some text. 74 | 75 | ## Use 76 | 77 | ## API 78 | 79 | ## License 80 | ``` 81 | 82 | …and a module `example.js`: 83 | 84 | ```js 85 | import {remark} from 'remark' 86 | import remarkLicense from 'remark-license' 87 | import {read} from 'to-vfile' 88 | 89 | const file = await remark() 90 | .use(remarkLicense) 91 | .process(await read('example.md')) 92 | 93 | console.log(String(file)) 94 | ``` 95 | 96 | Now running `node example.js` yields: 97 | 98 | ```markdown 99 | # Example 100 | 101 | Some text. 102 | 103 | ## Use 104 | 105 | ## API 106 | 107 | ## License 108 | 109 | [MIT](license) © [Titus Wormer](https://wooorm.com) 110 | ``` 111 | 112 | > 👉 **Note**: This info is inferred from this project’s 113 | > [`package.json`][file-package-json] and [`license`][file-license] file. 114 | > Running this example in a different package will yield different results. 115 | 116 | ## API 117 | 118 | This package exports no identifiers. 119 | The default export is [`remarkLicense`][api-remark-license]. 120 | 121 | ### `unified().use(remarkLicense[, options])` 122 | 123 | Generate a license section. 124 | 125 | ###### Parameters 126 | 127 | * `options` ([`Options`][api-options], optional) 128 | — configuration 129 | 130 | ###### Returns 131 | 132 | Transform ([`Transformer`][unified-transformer]). 133 | 134 | ### `Options` 135 | 136 | Configuration (TypeScript type). 137 | 138 | ###### Fields 139 | 140 | * `ignoreFinalDefinitions` (`boolean`, default: `true`) 141 | — ignore definitions at the end of the license section 142 | * `file` (`string`, optional) 143 | — path to license file; 144 | detected from the files in the directory of the `package.json` if there is 145 | one, or the current working directory, in which case the first file 146 | matching `/^licen[cs]e(?=$|\.)/i` is used; 147 | if there is no given or found license file, but `options.license` is a 148 | known [SPDX][] identifier, the URL to the license on `spdx.org` is used 149 | * `heading` (`RegExp | string`, default: `/^licen[cs]e$/i`) 150 | — heading to look for 151 | * `license` (`string`, optional, example: `'mit'`) 152 | — [SPDX][] identifier; 153 | detected from the `license` field in the `package.json` in the current 154 | working directory; 155 | throws when neither given nor detected 156 | * `name` (`string`, optional) 157 | — license holder; 158 | detected from the `package.json` closest to the file supporting both 159 | `object` and `string` format of `author`; 160 | throws when neither given nor detected 161 | * `url` (`string`, optional) 162 | — URL to license holder; 163 | detected from the `package.json` in the current working directory 164 | 165 | ## Types 166 | 167 | This package is fully typed with [TypeScript][]. 168 | It exports the additional type [`Options`][api-options]. 169 | 170 | ## Compatibility 171 | 172 | Projects maintained by the unified collective are compatible with maintained 173 | versions of Node.js. 174 | 175 | When we cut a new major release, we drop support for unmaintained versions of 176 | Node. 177 | This means we try to keep the current release line, `remark-license@^7`, 178 | compatible with Node.js 16. 179 | 180 | This plugin works with `unified` version 6+ and `remark` version 7+. 181 | 182 | ## Security 183 | 184 | `options.url` (or `author.url` in `package.json`) is used and injected into the 185 | tree when it’s given or found. 186 | This could open you up to a [cross-site scripting (XSS)][wiki-xss] attack if 187 | you pass user provided content in or store user provided content in 188 | `package.json`. 189 | 190 | This may become a problem if the markdown is later transformed to **[rehype][]** 191 | (**[hast][]**) or opened in an unsafe markdown viewer. 192 | 193 | ## Related 194 | 195 | * [`remark-collapse`](https://github.com/Rokt33r/remark-collapse) 196 | – make some sections collapsible 197 | * [`remark-contributors`](https://github.com/hughsk/remark-contributors) 198 | – generate a contributors section 199 | * [`remark-toc`](https://github.com/remarkjs/remark-toc) 200 | — generate a table of contents 201 | * [`remark-usage`](https://github.com/remarkjs/remark-usage) 202 | — generate a usage example 203 | 204 | ## Contribute 205 | 206 | See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways 207 | to get started. 208 | See [`support.md`][support] for ways to get help. 209 | 210 | This project has a [code of conduct][coc]. 211 | By interacting with this repository, organization, or community you agree to 212 | abide by its terms. 213 | 214 | ## License 215 | 216 | [MIT](license) © [Titus Wormer](https://wooorm.com) 217 | 218 | [build-badge]: https://github.com/remarkjs/remark-license/workflows/main/badge.svg 219 | 220 | [build]: https://github.com/remarkjs/remark-license/actions 221 | 222 | [coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-license.svg 223 | 224 | [coverage]: https://codecov.io/github/remarkjs/remark-license 225 | 226 | [downloads-badge]: https://img.shields.io/npm/dm/remark-license.svg 227 | 228 | [downloads]: https://www.npmjs.com/package/remark-license 229 | 230 | [size-badge]: https://img.shields.io/bundlejs/size/remark-license 231 | 232 | [size]: https://bundlejs.com/?q=remark-license 233 | 234 | [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg 235 | 236 | [backers-badge]: https://opencollective.com/unified/backers/badge.svg 237 | 238 | [collective]: https://opencollective.com/unified 239 | 240 | [chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg 241 | 242 | [chat]: https://github.com/remarkjs/remark/discussions 243 | 244 | [npm]: https://docs.npmjs.com/cli/install 245 | 246 | [esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c 247 | 248 | [esmsh]: https://esm.sh 249 | 250 | [health]: https://github.com/remarkjs/.github 251 | 252 | [contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md 253 | 254 | [support]: https://github.com/remarkjs/.github/blob/main/support.md 255 | 256 | [coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md 257 | 258 | [hast]: https://github.com/syntax-tree/hast 259 | 260 | [rehype]: https://github.com/rehypejs/rehype 261 | 262 | [remark]: https://github.com/remarkjs/remark 263 | 264 | [spdx]: https://spdx.org/licenses/ 265 | 266 | [typescript]: https://www.typescriptlang.org 267 | 268 | [unified]: https://github.com/unifiedjs/unified 269 | 270 | [unified-transformer]: https://github.com/unifiedjs/unified#transformer 271 | 272 | [wiki-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting 273 | 274 | [file-package-json]: package.json 275 | 276 | [file-license]: license 277 | 278 | [license-section]: #license 279 | 280 | [api-options]: #options 281 | 282 | [api-remark-license]: #unifieduseremarklicense-options 283 | --------------------------------------------------------------------------------