CoastalCommitsPastes/client/lib/worker.ts

20 lines
496 B
TypeScript
Raw Normal View History

2022-03-06 19:46:59 -05:00
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);