UNPKG

@hedgedoc/html-to-react

Version:

Parse HTML into React components

15 lines 980 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.convertHtmlToReact = void 0; const htmlparser2_1 = require("htmlparser2"); const processNodes_js_1 = require("./processNodes.js"); function convertHtmlToReact(html, options) { var _a, _b, _c; const parsedDocument = (0, htmlparser2_1.parseDocument)(html, { decodeEntities: (_a = options === null || options === void 0 ? void 0 : options.decodeEntities) !== null && _a !== void 0 ? _a : true }); const processedDocument = (_c = (_b = options === null || options === void 0 ? void 0 : options.preprocessNodes) === null || _b === void 0 ? void 0 : _b.call(options, parsedDocument)) !== null && _c !== void 0 ? _c : parsedDocument; return (0, processNodes_js_1.processNodes)(processedDocument.childNodes, options === null || options === void 0 ? void 0 : options.transform); } exports.convertHtmlToReact = convertHtmlToReact; //# sourceMappingURL=convertHtmlToReact.js.map