// SPDX-FileCopyrightText: 2026 Kerstin Humm // // SPDX-License-Identifier: AGPL-3.0-or-later import { Reference } from "./types.js"; // Build an URL that can point to a specific anchor in the standard and even to a specific text fragment. // See https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment/Text_fragments export function buildReference( { url = "https://codeberg.org/fediverse/fep/src/branch/main/fep/8a8e/fep-8a8e.md", anchor, text, }: { url?: string; anchor?: string; text?: string }, ): Reference { let result: Reference = { url: `${url}#${anchor ? anchor : ""}:~:text=${ text ? encodeURIComponent(text) : "" }`, }; if (text) { result.quote = text; } return result; }