diff --git a/packages/backend/src/core/MfmService.ts b/packages/backend/src/core/MfmService.ts index 9786f8b8b..4e1e8d902 100644 --- a/packages/backend/src/core/MfmService.ts +++ b/packages/backend/src/core/MfmService.ts @@ -6,7 +6,7 @@ import { URL } from 'node:url'; import { Inject, Injectable } from '@nestjs/common'; import * as parse5 from 'parse5'; -import { Window, XMLSerializer } from 'happy-dom'; +import { JSDOM } from 'jsdom'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; import { intersperse } from '@/misc/prelude/array.js'; @@ -243,9 +243,9 @@ export class MfmService { return null; } - const { window } = new Window(); + const fragment = JSDOM.fragment(''); - const doc = window.document; + const doc = fragment.ownerDocument; const body = doc.createElement('p'); @@ -461,6 +461,6 @@ export class MfmService { appendChildren(nodes, body); - return new XMLSerializer().serializeToString(body); + return body.outerHTML; } }