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

    Function makeLinksAbsolute

    • Makes all link hrefs absolute in HTML content.

      Finds all <a> tags and converts their href 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 link hrefs converted to absolute URLs

      const html = '<a href="/about">About</a>';
      makeLinksAbsolute('https://example.com', html);
      // Returns: '<a href="https://example.com/about">About</a>'