
Research
/Security News
10 npm Typosquatted Packages Deploy Multi-Stage Credential Harvester
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.
markdown-link-check
Advanced tools
checks the all of the hyperlinks in a markdown text to determine if they are alive or dead
Extracts links from markdown texts and checks whether each link is
alive (200 OK) or dead. mailto: links are also validated.
To 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
Docker images are built with each release. Use the stable tag for the current stable release.
Add current directory with your README.md file as read only volume to docker run:
docker run -v .:/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. 3, 3.8, 3.8.3)
Please head on to github-action-markdown-link-check.
To run as a pre-commit hook:
- repo: https://github.com/tcort/markdown-link-check
  rev: ...
  hooks:
    - id: markdown-link-check
      args: [-q]
linkchecker:
  stage: test
  image:
    name: ghcr.io/tcort/markdown-link-check:3.11.2
    entrypoint: ["/bin/sh", "-c"]
  script:
    - markdown-link-check ./docs
  rules:
    - changes:
      - "**/*.md"
Given a string containing markdown formatted text and a callback,
extract all of the links and check if they're alive or dead. Call the
callback with (err, results)
Parameters:
markdown string containing markdown formatted text.opts optional options object containing any of the following optional fields:
showProgressBar enable an ASCII progress bar.timeout timeout in ms format. (e.g. "2000ms", 20s, 1m). Default 10s.httpHeaders to apply URL specific headers, see example below.ignorePatterns an array of objects holding regular expressions which a link is checked against and skipped for checking in case of a match. Example: [{ pattern: /foo/ }]replacementPatterns an array of objects holding regular expressions which are replaced in a link with their corresponding replacement string. This behavior allows (for example) to adapt to certain platform conventions hosting the Markdown. The special replacement {{BASEURL}} can be used to dynamically link to the base folder (used from projectBaseUrl) (for example that / points to the root of your local repository). Example: [{ pattern: /^.attachments/, replacement: "file://some/conventional/folder/.attachments" }, { pattern: ^/, replacement: "{{BASEURL}}/"}]. You can add "global": true to use a global regular expression to replace all instances.projectBaseUrl the URL to use for {{BASEURL}} replacementignoreDisable if this is true then disable comments are ignored.retryOn429 if this is true then retry request when response is an HTTP code 429 after the duration indicated by retry-after header.retryCount the number of retries to be made on a 429 response. Default 2.fallbackRetryDelay the delay in ms format. (e.g. "2000ms", 20s, 1m) for retries on a 429 response when no retry-after header is returned or when it has an invalid value. Default is 60s.aliveStatusCodes a list of HTTP codes to consider as alive.
Example: [200,206]reporters an array of reporter functions to use for outputting results. If not specified, default output will be generated (useful when using the API programmatically). Available built-in reporters can be imported from the command-line tool.callback function which accepts (err, results).
err an Error object when the operation cannot be completed, otherwise null.results an array of objects with the following properties:
link the link provided as inputstatus a string set to either alive, ignored or dead.statusCode the HTTP status code. Set to 0 if no HTTP status code was returned (e.g. when the server is down).err any connection error that occurred, otherwise null.You can write html comments to disable markdown-link-check for parts of the text.
<!-- markdown-link-check-disable --> disables markdown link check.
<!-- markdown-link-check-enable --> reenables markdown link check.
<!-- markdown-link-check-disable-next-line --> disables markdown link check for the next line.
<!-- markdown-link-check-disable-line --> disables markdown link check for this line.
Basic 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);
    });
});
The command line tool optionally takes 1 argument, the file name or http/https URL. If not supplied, the tool reads from standard input.
markdown-link-check https://github.com/tcort/markdown-link-check/blob/master/README.md
markdown-link-check ./README.md
This checks all files in folder ./docs with file extension *.md:
markdown-link-check ./docs
The files can also be searched for and filtered manually:
find . -name \*.md -print0 | xargs -0 -n1 markdown-link-check
Usage: markdown-link-check [options] [filenamesOrDirectorynamesOrUrls...]
Options:
  -V, --version           output the version number
  -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
  -i, --ignore <paths>    ignore input paths including an ignore path
  -a, --alive <code>      comma separated list of HTTP codes to be considered as alive
  -r, --retry             retry after the duration indicated in 'retry-after' header when HTTP code is 429
  --reporters <names>     specify reporters to use
  --projectBaseUrl <url>  the URL to use for {{BASEURL}} replacement
  --junit-output <file>   output file for JUnit XML report (only used with junit reporter)
  -h, --help              display help for command
markdown-link-check supports multiple output reporters to format the results of link checking:
The default reporter outputs results to the console with colored status indicators:
markdown-link-check README.md
Output format:
  âś“ https://example.com/valid-link
  âś– https://example.com/broken-link
  / https://example.com/ignored-link
  3 links checked.
  ERROR: 1 dead links found!
The JUnit reporter generates XML output compatible with JUnit test result format, useful for CI/CD integration:
markdown-link-check --reporters junit README.md
To specify a custom output file:
markdown-link-check --reporters junit --junit-output results.xml README.md
If no output file is specified, the results are written to junit-results.xml by default.
You can use multiple reporters simultaneously by specifying them in a comma-separated list:
markdown-link-check --reporters default,junit README.md
This will output to both the console (default reporter) and generate a JUnit XML file.
config.json:
ignorePatterns: An array of objects holding regular expressions which a link is checked against and skipped for checking in case of a match.replacementPatterns: An array of objects holding regular expressions which are replaced in a link with their corresponding replacement string. This behavior allows (for example) to adapt to certain platform conventions hosting the Markdown. The special replacement {{BASEURL}} can be used to dynamically link to the current working directory (for example that / points to the root of your current working directory). This parameter supports named regex groups the same way as string.replace method in node.httpHeaders: The headers are only applied to links where the link starts with one of the supplied URLs in the urls section.timeout timeout in ms format. (e.g. "2000ms", 20s, 1m). Default 10s.retryOn429 if this is true then retry request when response is an HTTP code 429 after the duration indicated by retry-after header.retryCount the number of retries to be made on a 429 response. Default 2.fallbackRetryDelay the delay in ms format. (e.g. "2000ms", 20s, 1m) for retries on a 429 response when no retry-after header is returned or when it has an invalid value. Default is 60s.aliveStatusCodes a list of HTTP codes to consider as alive.projectBaseUrl the URL to use for {{BASEURL}} replacementExample:
{
  "projectBaseUrl":"${workspaceFolder}",
  "ignorePatterns": [
    {
      "pattern": "^http://example.net"
    }
  ],
  "replacementPatterns": [
    {
      "pattern": "^.attachments",
      "replacement": "file://some/conventional/folder/.attachments"
    },
    {
      "pattern": "^/",
      "replacement": "{{BASEURL}}/"
    },
    {
      "pattern": "%20",
      "replacement": "-",
      "global": true
    },
    {
      "pattern": "images/(?<filename>.*)",
      "replacement": "assets/$<filename>"
    }
  ],
  "httpHeaders": [
    {
      "urls": ["https://example.com"],
      "headers": {
        "Authorization": "Basic Zm9vOmJhcg==",
        "Foo": "Bar"
      }
    }
  ],
  "timeout": "20s",
  "retryOn429": true,
  "retryCount": 5,
  "fallbackRetryDelay": "30s",
  "aliveStatusCodes": [200, 206]
}
npm test
See LICENSE.md
Version 3.14.1
FAQs
checks the all of the hyperlinks in a markdown text to determine if they are alive or dead
The npm package markdown-link-check receives a total of 92,108 weekly downloads. As such, markdown-link-check popularity was classified as popular.
We found that markdown-link-check demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.