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

parser plugins should parse top-level unknown and void elements #494

Closed
bantic opened this issue Sep 14, 2016 · 1 comment · Fixed by #627
Closed

parser plugins should parse top-level unknown and void elements #494

bantic opened this issue Sep 14, 2016 · 1 comment · Fixed by #627
Labels
Milestone

Comments

@bantic
Copy link
Collaborator

bantic commented Sep 14, 2016

The Section parser first infers a section type for a given element before attempting to parse its child nodes, and it only runs its parser plugins against the child nodes. This means that HTML with root-level elements do not get run through the plugins. This happens (in slightly different ways) with both void elements and elements with childNodes:

  • parse('<video>...</video>') — plugins skip <video>
  • parse('<video>') — plugins skip video
@kevinansfield
Copy link
Collaborator

I've just run into this too. I'd like to be able to parse <figure><img/><figcaption>Foo</figcaption></figure> into our image card in order to extract the caption for the payload but the <figure> element never hits the parser plugins, only the <img>.

I have a similar problem where a <hr /> element doesn't get passed to the parser plugins so we're unable to convert it to our divider card. Is this the same problem or does that stem from somewhere else?

kevinansfield pushed a commit to kevinansfield/mobiledoc-kit that referenced this issue Jun 18, 2018
kevinansfield added a commit to kevinansfield/mobiledoc-kit that referenced this issue Jun 18, 2018
closes bustle#494
- run parser plugins for the top-level section elements
    - do not continue parsing children elements if a parser marks the top-level element as finished
- update tests to double-check the output for top-level elements is unchanged
kevinansfield pushed a commit to TryGhost/mobiledoc-kit that referenced this issue Jun 18, 2018
kevinansfield added a commit to TryGhost/mobiledoc-kit that referenced this issue Jun 18, 2018
closes bustle#494
- run parser plugins for the top-level section elements
    - do not continue parsing children elements if a parser marks the top-level element as finished
- update tests to double-check the output for top-level elements is unchanged
kevinansfield pushed a commit to kevinansfield/mobiledoc-kit that referenced this issue Jun 18, 2018
kevinansfield added a commit to kevinansfield/mobiledoc-kit that referenced this issue Jun 18, 2018
closes bustle#494
- run parser plugins for the top-level section elements
    - do not continue parsing children elements if a parser marks the top-level element as finished
- update tests to double-check the output for top-level elements is unchanged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants