mirror of https://github.com/MaxLeiter/Drift
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
496 B
TypeScript
20 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);
|