webforai
Version:
A library that provides a web interface for AI
25 lines (24 loc) • 453 B
JavaScript
// src/utils/mdast-utils.ts
var unwarpRoot = (mdast) => {
if (mdast.type === "root") {
return mdast.children;
}
return [mdast];
};
var warpRoot = (mdast) => {
if (Array.isArray(mdast)) {
return { type: "root", children: mdast };
}
return mdast;
};
var internalType = (content) => {
if (content.type === "heading") {
return `h${content.depth}`;
}
return content.type;
};
export {
internalType,
unwarpRoot,
warpRoot
};