New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

remark-transform-links

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-transform-links

transform links with remark

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
2
-97.56%
Maintainers
1
Weekly downloads
 
Created
Source

npm version npm downloads

transform links in markdown files using remark

📦 Installation

npm install remark-transform-links

🚀 Usage

import { remark } from "remark";
import remarkTransformLinks from "remark-transform-links";

const markdown = `
[Relative Link](/resource.html)
![Relative Image](./image.png)
<a href="/another/path">Link</a>
`;

const result = await remark()
  .use(remarkTransformLinks, { baseUrl: "https://example.com" })
  .process(markdown);

console.log(result.toString());

// Output:
// [Relative Link](https://example.com/resource.html)
// ![Relative Image](https://example.com/image.png)
// <a href="https://example.com/another/path">Link</a>

const result2 = await remark()
  .use(remarkTransformLinks, {
    baseUrl: (path) => {
      if (path.startsWith("/resource.html")) {
        return `https://example.com/market`;
      }

      return `https://example.com`;
    }
  })
  .process(markdown);

console.log(result2.toString());

// Output:
// [Relative Link](https://example.com/market/resource.html)
// ![Relative Image](https://example.com/image.png)
// <a href="https://example.com/another/path">Link</a>

📄 License

Published under MIT License.

Keywords

remark

FAQs

Package last updated on 07 Aug 2025

Did you know?

Socket

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.

Install

Related posts