Files
backnotprop__plannotator/packages/server/annotate-doc-url.ts
Michael Ramos be2d06a7c2 Make HTML annotations render HTML by default
* feat(annotate): render html files by default

* fix(annotate): support raw html assets and sharing

* fix(annotate): address html first review followups

* fix(editor): avoid raw html sidebar init crash

* fix(annotate): support portable html shares

* fix(annotate): harden html share support

* fix(share): clear attachments when loading shared payloads

* fix(share): warn on remote share link failures

* perf(annotate): lazy-build html share payloads

* test(annotate): guard lazy html share generation

* test(annotate): drop flaky html share server test
2026-06-16 16:16:05 -07:00

23 lines
601 B
TypeScript

import { dirname } from "path";
export function applyAnnotateDocSessionParams(
requestUrl: string,
sourceFilePath: string,
convertHtml: boolean,
): { url: string; changed: boolean } {
const docUrl = new URL(requestUrl);
let changed = false;
if (!docUrl.searchParams.has("base") && !/^https?:\/\//i.test(sourceFilePath)) {
docUrl.searchParams.set("base", dirname(sourceFilePath));
changed = true;
}
if (convertHtml && !docUrl.searchParams.has("convert")) {
docUrl.searchParams.set("convert", "1");
changed = true;
}
return { url: docUrl.toString(), changed };
}