IOweb/node_modules/satteri/dist/plugin.js
2026-07-03 15:07:38 -05:00

15 lines
557 B
JavaScript

// Generic so the inferred plugin type preserves each visitor's *actual* return
// type. That lets call sites of `markdownToHtml`/`mdxToJs` distinguish sync
// plugins from async ones in their conditional return type.
export function defineMdastPlugin(definition) {
if (!definition.name) {
throw new Error("Plugin definition must have a name");
}
return definition;
}
export function defineHastPlugin(definition) {
if (!definition.name) {
throw new Error("Plugin definition must have a name");
}
return definition;
}