# markdown-link-extractor

> extracts links from markdown texts

Latest version **4.0.4** (published 2026-07-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install markdown-link-extractor
pnpm add markdown-link-extractor
yarn add markdown-link-extractor
bun add markdown-link-extractor
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 4.0.4 |
| Published | 2026-07-28 |
| First published | 2016-01-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 32 |
| Author | Thomas Cort |
| Maintainers | tcort |
| Keywords | markdown, link, extract, extractor, href |

## Links

- npm: https://www.npmjs.com/package/markdown-link-extractor
- Repository: https://github.com/tcort/markdown-link-extractor
- Issues: https://github.com/tcort/markdown-link-extractor/issues
- npm.io page: https://npm.io/package/markdown-link-extractor

## Dependencies (2)

- [marked](https://npm.io/package/marked.md) ^18.0.7
- [html-link-extractor](https://npm.io/package/html-link-extractor.md) ^1.0.5

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 4.0.4 (latest) — 2026-07-28
- 4.0.3 — 2025-11-19
- 4.0.2 — 2024-03-10
- 3.1.0 — 2022-09-21
- 4.0.1 — 2022-05-04
- 3.0.2 — 2022-05-04
- 3.0.1 — 2022-05-04
- 4.0.0 — 2022-05-04
- 3.0.0 — 2022-05-04
- 2.0.1 — 2022-03-19
- 2.0.0 — 2022-03-19
- 1.3.1 — 2022-01-21
- 1.3.0 — 2021-05-25
- 1.2.7 — 2021-03-25
- 1.2.6 — 2020-09-09
- … 10 more at https://npm.io/package/markdown-link-extractor/versions

## README

# markdown-link-extractor

Extracts links from markdown texts.

## Installation
```bash
$ npm install --save markdown-link-extractor
```
## API

### markdownLinkExtractor(markdown)

Parameters:

* `markdown` text in markdown format.

Returns:

* an array containing the URLs from the links found.

## Examples

```js
const { readFileSync } = require('fs');
const markdownLinkExtractor = require('markdown-link-extractor');

const markdown = readFileSync('README.md', {encoding: 'utf8'});

const links = markdownLinkExtractor(markdown);
links.forEach(link => console.log(link));
```

## Upgrading to v4.0.0

- anchor link extraction no longer supported

Code that looked like this:

```
const { links } = markdownLinkExtractor(str);
```

Should change to this:

```
const links = markdownLinkExtractor(str);
```

## Upgrading to v3.0.0

- extended mode no longer supported
- embedded image size parameters in `![]()` no longer supported

## Testing

    npm test

## License

See [LICENSE.md](https://github.com/tcort/markdown-link-extractor/blob/master/LICENSE.md)

---
_Source: https://npm.io/package/markdown-link-extractor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
