在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):tcort/markdown-link-check开源软件地址(OpenSource Url):https://github.com/tcort/markdown-link-check开源编程语言(OpenSource Language):JavaScript 97.1%开源软件介绍(OpenSource Introduction):markdown-link-checkExtracts links from markdown texts and checks whether each link is
alive ( InstallationTo add the module to your project, run: npm install --save-dev markdown-link-check To install the command line tool globally, run: npm install -g markdown-link-check Run using DockerDocker images are built with each release. Use the Add current directory with your docker run -v ${PWD}:/tmp:ro --rm -i ghcr.io/tcort/markdown-link-check:stable /tmp/README.md Alternatively, if you wish to target a specific release, images are tagged with semantic versions (i.e. Run in a GitHub actionPlease head on to github-action-markdown-link-check. Run in other tools
APImarkdownLinkCheck(markdown, [opts,] callback)Given a string containing Parameters:
Disable commentsYou can write html comments to disable markdown-link-check for parts of the text.
ExamplesModuleBasic usage: 'use strict';
var markdownLinkCheck = require('markdown-link-check');
markdownLinkCheck('[example](http://example.com)', function (err, results) {
if (err) {
console.error('Error', err);
return;
}
results.forEach(function (result) {
console.log('%s is %s', result.link, result.status);
});
}); With options, for example using URL specific headers: 'use strict';
var markdownLinkCheck = require('markdown-link-check');
markdownLinkCheck('[example](http://example.com)', { httpHeaders: [{ urls: ['http://example.com'], headers: { 'Authorization': 'Basic Zm9vOmJhcg==' }}] }, function (err, results) {
if (err) {
console.error('Error', err);
return;
}
results.forEach(function (result) {
console.log('%s is %s', result.link, result.status);
});
}); Command Line ToolThe command line tool optionally takes 1 argument, the file name or http/https URL. If not supplied, the tool reads from standard input. Check links from a markdown file hosted on the webmarkdown-link-check https://github.com/tcort/markdown-link-check/blob/master/README.md Check links from a local markdown filemarkdown-link-check ./README.md Check links from a local markdown folder (recursive)Avoid using find . -name \*.md -print0 | xargs -0 -n1 markdown-link-check There is an open issue for allowing the tool to specify multiple files on the command line. UsageUsage: markdown-link-check [options] [filenameOrUrl]
Options:
-p, --progress show progress bar
-c, --config [config] apply a config file (JSON), holding e.g. url specific header configuration
-q, --quiet displays errors only
-v, --verbose displays detailed error information
-a, --alive <code> comma separated list of HTTP code to be considered as alive
-r, --retry retry after the duration indicated in 'retry-after' header when HTTP code is 429
-h, --help display help for command
-V, --version display version string (e.g. `1.2.3`) Config file format
Example: {
"ignorePatterns": [
{
"pattern": "^http://example.net"
}
],
"replacementPatterns": [
{
"pattern": "^.attachments",
"replacement": "file://some/conventional/folder/.attachments"
},
{
"pattern": "^/",
"replacement": "{{BASEURL}}/"
}
],
"httpHeaders": [
{
"urls": ["https://example.com"],
"headers": {
"Authorization": "Basic Zm9vOmJhcg==",
"Foo": "Bar"
}
}
],
"timeout": "20s",
"retryOn429": true,
"retryCount": 5,
"fallbackRetryDelay": "30s",
"aliveStatusCodes": [200, 206]
} Testingnpm test LicenseSee LICENSE.md |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论