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

Document parser hooks #257

Merged
merged 2 commits into from
Dec 9, 2015
Merged

Document parser hooks #257

merged 2 commits into from
Dec 9, 2015

Conversation

mixonic
Copy link
Contributor

@mixonic mixonic commented Dec 8, 2015

Introduce a public API for parser hooks.

TODO

  • Get general 👍 from @bantic
  • Tests
  • Refactor to the documented API
  • Port existing hook usage here and in TypeSet, smoke test

Fixes #229

A developer can override the default parsing behavior for leaf DOM nodes in
pasted HTML.

For example, when an `img` tag is pasted it may be approprite to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appropriate

@bantic
Copy link
Collaborator

bantic commented Dec 8, 2015

few typos, but otherwise these docs look 👍 to me. There are some scenarios where a return value may be invalid, however. For instance, if a parser hook returned a marker where a section was expected, I expect the parsing would break later (perhaps much later, at render time) when attempting to deal with a post that had a list of sections that looked like [markupSection, listSection, marker].

Is there a plan to guard against nonsensical (in context) return values for parser hooks?

@mixonic
Copy link
Contributor Author

mixonic commented Dec 8, 2015

@bantic perhaps we could assert the correct type is appended to a linked-list during adoptItem

@mixonic mixonic changed the title WIP: Document parser hooks Document parser hooks Dec 9, 2015
mixonic added a commit that referenced this pull request Dec 9, 2015
@mixonic mixonic merged commit 01fec18 into bustle:master Dec 9, 2015
@mixonic mixonic deleted the parser-hooks branch December 9, 2015 20:19
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

Successfully merging this pull request may close these issues.

2 participants