@awesome-fe/translate
Version:
Translation utils
24 lines • 823 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Rehype = void 0;
var unified = require("unified");
var rehypeStringify = require("rehype-stringify");
var rehypeParse = require("rehype-parse");
var Rehype = /** @class */ (function () {
function Rehype() {
}
Rehype.stringify = function (node) {
return unified().use(rehypeStringify, { closeSelfClosing: true }).stringify(node);
};
Rehype.parse = function (html) {
return unified().use(rehypeParse).parse(html);
};
Rehype.parseFragment = function (html) {
var htmlElement = this.parse(html).children[0];
var bodyElement = htmlElement.children[1];
return bodyElement.children[0];
};
return Rehype;
}());
exports.Rehype = Rehype;
//# sourceMappingURL=rehype.js.map