doJavaScript on a Markdown preview?

Yes, I know that. But I could do something like that

const app = Application("DEVONthink");
const r = app.getRecordWithUuid(...);
const tw = app.openWindowFor({record: r});
const result = app.doJavaScript(`do something here`, {in: tw});
r.plainText = r.plainText() + `\n` +  result.toString();

Or whatever JXA permits me to do: The script runs in the context of the preview (if that works), but the doJavaScript runs in the context of JXA.
Background: Interactive task-list checkboxes in the Markdown preview — now that the MultiMarkdown dependency is gone
It’s trivial to have a script make the checkboxes interaktive (ie turn disabled off), but then… As you said, script is just JS, not JXA. In order to change the MD file itself, one would need JXA (or AS, for that matter).
That’s why I was thinking of this slightly contrived approach…