diff --git a/LICENSE b/LICENSE index 133e304..10f2327 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2022 +Copyright (c) 2024 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file +THE SOFTWARE. diff --git a/README.md b/README.md index 4a175c5..ebaad74 100644 --- a/README.md +++ b/README.md @@ -176,13 +176,13 @@ Found 2 broken external links FILE: src//linter-test-A.md - [✖] https://example.co/ → Status: 0 + [✖] https://github.com/holamgadol/foliant-md-lint → Status: 404 -------------------------------------------------------------------------------- FILE: src//subproject/article.md - [✖] https://example.coms/ → Status: 0 + [✖] https://github.com/holamgadol/foliant-md-linte → Status: 404 Full markdown-link-check log see in /Users/user/github/foliant-md-linter/.markdownlinkcheck.log ``` diff --git a/configs/mdLinkCheckConfig.json b/configs/mdLinkCheckConfig.json index 4dd0e56..5ae5a98 100644 --- a/configs/mdLinkCheckConfig.json +++ b/configs/mdLinkCheckConfig.json @@ -4,5 +4,6 @@ "pattern": "^(?!http).+" } ], - "timeout": "20s" + "timeout": "20s", + "aliveStatusCodes": [200, 206, 0, 204, 401, 406] } diff --git a/package.json b/package.json index a6127b9..f93e4de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "foliant-md-linter", - "version": "0.1.11", + "version": "0.1.12", "description": "CLI tool for linting Foliant markdown sources", "license": "MIT", "homepage": "https://github.com/holamgadol/foliant-md-linter", diff --git a/test/alt-src/linter-test-B.md b/test/alt-src/linter-test-B.md index 22784c3..ae06173 100644 --- a/test/alt-src/linter-test-B.md +++ b/test/alt-src/linter-test-B.md @@ -24,7 +24,7 @@ physics–science ![invalid link to image](/red-circle.png) -[Broken external link](https://example.rus/) +[Broken external link](https://github.com/holamgadol/foliant-md-linters) ```bash indented-fence diff --git a/test/linter.spec.js b/test/linter.spec.js index 0f654dd..1186558 100644 --- a/test/linter.spec.js +++ b/test/linter.spec.js @@ -768,13 +768,13 @@ test('urls -v', async () => { `FILE: ${linkCheckFilePrint(linuxSwapString('src//linter-test-A.md', 'src//subproject/article.md'))}\n`, - ` [✖] ${linuxSwapString('https://example.co/', 'https://example.coms/')} → Status: 0\n`, + ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-lint', 'https://github.com/holamgadol/foliant-md-linte')} → Status: 404\n`, '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//subproject/article.md', 'src//linter-test-A.md'))}\n`, - ` [✖] ${linuxSwapString('https://example.coms/', 'https://example.co/')} → Status: 0\n`, + ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-linte', 'https://github.com/holamgadol/foliant-md-lint')} → Status: 404\n`, `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['urls', '-v'], '.') @@ -792,7 +792,7 @@ test('urls -v -s alt-src', async () => { `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, - ' [✖] https://example.rus/ → Status: 0\n', + ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['urls', '-v', '-s alt-src'], '.') @@ -810,7 +810,7 @@ test('urls -v -s alt-src -f', async () => { `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, - ' [✖] https://example.rus/ → Status: 0\n', + ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['urls', '-v', '-s alt-src', '-f'], '.') @@ -895,13 +895,13 @@ test('essential -v', async () => { `FILE: ${linkCheckFilePrint(linuxSwapString('src//linter-test-A.md', 'src//subproject/article.md'))}\n`, - ` [✖] ${linuxSwapString('https://example.co/', 'https://example.coms/')} → Status: 0\n`, + ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-lint', 'https://github.com/holamgadol/foliant-md-linte')} → Status: 404\n`, '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//subproject/article.md', 'src//linter-test-A.md'))}\n`, - ` [✖] ${linuxSwapString('https://example.coms/', 'https://example.co/')} → Status: 0\n`, + ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-linte', 'https://github.com/holamgadol/foliant-md-lint')} → Status: 404\n`, `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['essential', '-v'], '.') @@ -943,13 +943,13 @@ test('essential -v -p another-project', async () => { `FILE: ${linkCheckFilePrint(linuxSwapString('src//linter-test-A.md', 'src//subproject/article.md'))}\n`, - ` [✖] ${linuxSwapString('https://example.co/', 'https://example.coms/')} → Status: 0\n`, + ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-lint', 'https://github.com/holamgadol/foliant-md-linte')} → Status: 404\n`, '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//subproject/article.md', 'src//linter-test-A.md'))}\n`, - ` [✖] ${linuxSwapString('https://example.coms/', 'https://example.co/')} → Status: 0\n`, + ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-linte', 'https://github.com/holamgadol/foliant-md-lint')} → Status: 404\n`, `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['essential', '-v', '-p another-project'], '.') @@ -983,7 +983,7 @@ test('essential -s alt-src -v', async () => { `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, - ' [✖] https://example.rus/ → Status: 0\n', + ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['essential', '-s alt-src', '-v'], '.') @@ -1014,7 +1014,7 @@ test('essential -s alt-src -v -c', async () => { `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, - ' [✖] https://example.rus/ → Status: 0\n', + ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['essential', '-s alt-src', '-v', '-c'], '.') @@ -1045,7 +1045,7 @@ test('essential -s alt-src -v -c -f', async () => { `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, - ' [✖] https://example.rus/ → Status: 0\n', + ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['essential', '-s alt-src', '-v', '-c', '-f'], '.') @@ -1122,13 +1122,13 @@ test('full-check -v', async () => { `FILE: ${linkCheckFilePrint(linuxSwapString('src//linter-test-A.md', 'src//subproject/article.md'))}\n`, - ` [✖] ${linuxSwapString('https://example.co/', 'https://example.coms/')} → Status: 0\n`, + ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-lint', 'https://github.com/holamgadol/foliant-md-linte')} → Status: 404\n`, '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//subproject/article.md', 'src//linter-test-A.md'))}\n`, - ` [✖] ${linuxSwapString('https://example.coms/', 'https://example.co/')} → Status: 0\n`, + ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-linte', 'https://github.com/holamgadol/foliant-md-lint')} → Status: 404\n`, `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['full-check', '-v'], '.') @@ -1172,13 +1172,13 @@ test('full-check -v -p another-project', async () => { `FILE: ${linkCheckFilePrint(linuxSwapString('src//linter-test-A.md', 'src//subproject/article.md'))}\n`, - ` [✖] ${linuxSwapString('https://example.co/', 'https://example.coms/')} → Status: 0\n`, + ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-lint', 'https://github.com/holamgadol/foliant-md-linte')} → Status: 404\n`, '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//subproject/article.md', 'src//linter-test-A.md'))}\n`, - ` [✖] ${linuxSwapString('https://example.coms/', 'https://example.co/')} → Status: 0\n`, + ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-linte', 'https://github.com/holamgadol/foliant-md-lint')} → Status: 404\n`, `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['full-check', '-v', '-p another-project'], '.') @@ -1214,7 +1214,7 @@ test('full-check -s alt-src -v', async () => { `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, - ' [✖] https://example.rus/ → Status: 0\n', + ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['full-check', '-s alt-src', '-v'], '.') @@ -1247,7 +1247,7 @@ test('full-check -s alt-src -v -c', async () => { `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, - ' [✖] https://example.rus/ → Status: 0\n', + ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['full-check', '-s alt-src', '-v', '-c'], '.') @@ -1281,7 +1281,7 @@ test('full-check -s alt-src -v -c -l', async () => { `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, - ' [✖] https://example.rus/ → Status: 0\n', + ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`, `removing ${path.join(cwd, '.markdownlint-cli2.jsonc ...')}\n`, @@ -1318,7 +1318,7 @@ test('full-check -s alt-src -v -c -f', async () => { `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, - ' [✖] https://example.rus/ → Status: 0\n', + ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['full-check', '-s alt-src', '-v', '-c', '-f'], '.') @@ -1356,7 +1356,7 @@ test('print -v', async () => { `Full markdownlint log see in ${path.join(cwd, '.markdownlint_full.log')}\n`, 'Found 1 broken external links\n', `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, - ' [✖] https://example.rus/ → Status: 0\n', + ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] const result = await cli(['print', '-v'], '.', false) console.log(result) diff --git a/test/src/linter-test-A.md b/test/src/linter-test-A.md index 9252a93..88ff25b 100644 --- a/test/src/linter-test-A.md +++ b/test/src/linter-test-A.md @@ -30,7 +30,7 @@ physics–science ![invalid link to image](/red-circle.png) -[Broken external link](https://example.co/) +[Broken external link](https://github.com/holamgadol/foliant-md-lint) [absolute link to file](/another-project/subproject/article) diff --git a/test/src/subproject/article.md b/test/src/subproject/article.md index 31904c7..7855c44 100644 --- a/test/src/subproject/article.md +++ b/test/src/subproject/article.md @@ -7,4 +7,4 @@ tags: [broken local link](#anchor) -[broken external link](https://example.coms/) +[broken external link](https://github.com/holamgadol/foliant-md-linte)