forked from HenrikJoreteg/html-parse-stringify
-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Thank you for this helpful package!
Almost the same problem as #11 still remain:
Parsing a plain text node + tags results in an list without plain text. Current behavior:
const lib = require("html-parse-stringify2");
const nodes = lib.parse("Hello, <b>world!</b>");
nodes.length === 1;Expected behavior:
const lib = require("html-parse-stringify2");
const nodes = lib.parse("Hello, <b>world!</b>")
nodes.length === 2;
nodes[0].type === "text";
nodes[0].content === "Hello, ";
nodes[0].type === "tag";
nodes[0].name === "b";And the same workaround works:
const parse = function(htmlAndText){
return lib.parse("<top>" + htmlAndText + "</top>")[0].children;
};Metadata
Metadata
Assignees
Labels
No labels