Skip to content
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

Not parsing correclty #40

Closed
stylesuxx opened this issue Aug 13, 2020 · 3 comments
Closed

Not parsing correclty #40

stylesuxx opened this issue Aug 13, 2020 · 3 comments

Comments

@stylesuxx
Copy link

This HTML string:
<p><em>a</em></p><p>b</p><p><strong>c</strong></p><ul><li>d</li></ul><p>e</p>

will generate the following AST:

[ { type: 'tag',
    name: 'p',
    voidElement: false,
    attrs: {},
    children: [ [Object], [Object], [Object] ] } ]

So basically the outermost p tag is considered to be wrapping all other elements.

@bblochkohl
Copy link

bblochkohl commented Sep 10, 2020

I have a similar problem, but it looks like, when having nested tags, the next following tag after the closing of nested parent, is included as children to the nested.

<div><h1>something</h1><p>go ahead</p><p>some more text</p></div>
<article><p>whatever</p></article>

will generate following

[ { type: 'tag',
    name: 'div',
    voidElement: false,
    attrs: {},
    children: [ {h1}, {p}, {p}, {article} ] 
} ]

@stylesuxx
Copy link
Author

If you need a quick solution - I used htmlparser2 instead.

ericponto added a commit to ericponto/html-parse-stringify that referenced this issue Oct 13, 2020
ericponto added a commit to ericponto/html-parse-stringify that referenced this issue Oct 13, 2020
@HenrikJoreteg
Copy link
Owner

From my understanding this has been fixed, thanks (sorry for the delay)

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

3 participants