CoastalCommitsPastes/client/lib/worker.ts
2022-03-06 16:46:59 -08:00

19 lines
496 B
TypeScript

import { expose } from "comlink";
async function RemarkPipeline(disallowedElements, markdown) {
const markdownConverter = RemarkParseRemark()
.use([
RemarkParse,
...remarkPlugins,
[
RehypeUnwrap,
{ disallowedElements: disallowedElements, unwrapDisallowed: true },
],
])
.freeze();
const parsed = markdownConverter.parse(markdown);
const transformed = await markdownConverter.run(parsed);
return transformed;
}
expose(RemarkPipeline);