site/node_modules/rehype-citation/dist/node/src/html-transform-node.js
2024-10-14 08:09:33 +02:00

12 lines
296 B
JavaScript

import { parseFragment } from 'parse5';
import { fromParse5 } from 'hast-util-from-parse5';
/**
* Convert HTML to HAST node
*
* @param {string} html
*/
export const htmlToHast = (html) => {
const p5ast = parseFragment(html);
// @ts-ignore
return fromParse5(p5ast).children[0];
};