mdfetch API Documentation - v1.0.0
    Preparing search index...

    Function makeImgPathsAbsolute

    • Makes all image source paths absolute in HTML content.

      Finds all <img> tags and converts their src attributes from relative to absolute URLs using the provided hostname.

      Parameters

      • hostname: string

        The base hostname/URL for resolving relative paths

      • html: string

        The HTML content to process

      Returns string

      HTML with all image paths converted to absolute URLs

      const html = '<img src="/logo.png">';
      makeImgPathsAbsolute('https://example.com', html);
      // Returns: '<img src="https://example.com/logo.png">'