npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

markdown-image-extractor

v1.0.1

Published

A simple Mardown Image Extractor useful for websites like Mathpix or others

Readme

Markdown Image Extractor

A simple Node.js tool to extract and download images from markdown files. It’s designed for scenarios where markdown files, such as those from websites like Mathpix, contain images hosted online. This tool downloads those images and updates the markdown to reference local versions instead.

Features

  • Extracts image URLs from markdown syntax ![](<image-url>).
  • Detects markdown files dynamically, supporting .md, .mdx, and other variants.
  • Downloads each image and saves it with a specified prefix.
  • Overwrites previously downloaded images without requiring manual cleanup.
  • Replaces URLs in the markdown file with local paths, making it easy to host the images locally.
  • Full error handling to avoid interruptions, even with invalid URLs or file permissions.

Requirements

  • Node.js (v14 or higher recommended)

Installation

npm i -g markdown-image-extractor

Usage

Navigate to the directory with your markdown file(s) and run:

markdown-image-extractor <filename> [prefix]

Replace <filename> with the markdown file’s name and [prefix] with a string for naming the downloaded images. If no prefix is provided, it defaults to "img".

For example:

markdown-image-extractor filename.md "img"

This command will:

  1. Check if the specified file is a markdown-compatible file.
  2. Extract all image URLs in the file.
  3. Download each image, saving it as img1.jpg, img2.jpg, etc., in the current directory.
  4. Update the markdown file, replacing each URL with the path to the downloaded image.

Example

Given a markdown file (example.md) with content like:

![Image](https://cdn.domain.tld/cropped/image1.jpg)
Some text.
![Another Image](https://cdn.domain.tld/cropped/image2.png)

Running markdown-image-extractor example.md "img" will:

  1. Download the images as img1.jpg and img2.png.

  2. Update example.md to:

    ![Image](./img1.jpg)
    Some text.
    ![Another Image](./img2.png)

Help

Use the --help or -h flag for usage details:

markdown-image-extractor --help

Package Scripts

  • start: Runs the script locally (e.g., node main.js).
  • lint: Lints the codebase with ESLint.

License

This project is licensed under the MIT License. See LICENSE for more details.

Issues and Contributions

Please report issues at GitHub Issues. Contributions are welcome!