Skip to content

Plain text input is ignored #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
denis-sokolov opened this issue Jan 16, 2017 · 1 comment
Closed

Plain text input is ignored #11

denis-sokolov opened this issue Jan 16, 2017 · 1 comment

Comments

@denis-sokolov
Copy link

Parsing a plain text node results in an empty list. Current behavior:

const lib = require("html-parse-stringify2");
const nodes = lib.parse("Hello, world!");
nodes.length === 0;

Expected behavior:

const lib = require("html-parse-stringify2");
const nodes = lib.parse("Hello, world!");
nodes.length === 1;
nodes[0].type === "text";
nodes[0].content === "Hello, world!";

The simplest workaround is to wrap in a container:

const parse = function(html){
  return lib.parse("<top>" + html + "</top>")[0].children;
};
@rayd
Copy link
Owner

rayd commented Jul 24, 2017

This is resolved by #9 and a test case added here: d2b6a94. Thanks for the feedback! Sorry for the slow response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants