Skip to content

Commit ef32a0b

Browse files
Sora4431claude
andcommitted
fix(web): isomorphic-dompurify → sanitize-html に変更 (Workers SSR 互換)
isomorphic-dompurify は jsdom に依存しており Cloudflare Workers の SSR 環境で動作しない。DOM 不要な sanitize-html に切り替え。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2fa0bad commit ef32a0b

3 files changed

Lines changed: 110 additions & 38 deletions

File tree

apps/web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"dependencies": {
1919
"@googlemaps/js-api-loader": "^2.0.2",
2020
"@tabitabi/types": "workspace:*",
21-
"isomorphic-dompurify": "^3.8.0",
22-
"mapbox-gl": "^3.17.0"
21+
"mapbox-gl": "^3.17.0",
22+
"sanitize-html": "^2.17.2"
2323
},
2424
"devDependencies": {
2525
"@cloudflare/workers-types": "^4.20250110.0",

apps/web/src/lib/themes/standard-seasons/shared/utils/markdown.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { marked } from "marked";
2-
import DOMPurify from "isomorphic-dompurify";
2+
import sanitizeHtml from "sanitize-html";
33
import { getMemoText } from "$lib/memo";
44

55
marked.setOptions({
@@ -11,5 +11,5 @@ export function renderMarkdown(memoOrNotes: string | null | undefined): string {
1111
const text = getMemoText(memoOrNotes);
1212
if (!text) return '';
1313
const raw = marked.parse(text, { async: false }) as string;
14-
return DOMPurify.sanitize(raw);
14+
return sanitizeHtml(raw);
1515
}

0 commit comments

Comments
 (0)