"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = require("path");
const raw_url_1 = __importDefault(require("./raw-url"));
// NOTE: there is a similar function in frontend/project/page/url-transform.ts
function getUrlTransform({ id, path, relativePath, // relative path of the directory containing the file we are rendering.
 }) {
    return (href, tag) => {
        if (href.startsWith("data:"))
            return; // never change data: urls in any way.
        if (tag == "a" || href.includes("://")) {
            // Don't modify anything non-local, i.e., like https://...
            // Also don't modify a tags at all.
            return;
        }
        return (0, raw_url_1.default)({ id, path, relativePath: (0, path_1.join)(relativePath, href) });
    };
}
exports.default = getUrlTransform;
//# sourceMappingURL=url-transform.js.map