Skip to content

In case "plain text + tags", text is ignored #25

Description

@maxsimych

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;
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions