-
Notifications
You must be signed in to change notification settings - Fork 879
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
Provide text escaping and replacement hooks for context-dependent escaping #339
base: master
Are you sure you want to change the base?
Conversation
f1805ba
to
5320f09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks interesting. I like the idea of text nodes being replaceable (although should they pre or post escaping?)
Anyway, I'm a bit confused as to why we need both an escapes
option and a textReplacement
option. What would the code look like to customise escaping with these new options?
Hi @domchristie, this is related to our e-mail conversation and I should perhaps have it posted here:
I will update this PR as follows:
Now it is probably more clear what I meant by eventual externalising of the escaping builder. The builder (or its outcome) would plug into the I consider this the best ratio between backward-compatibility and flexibility in subsequent design decisions. Does this make sense? |
P.S. Updated the comment to express the intention rather than the code dependencies (the backward compatibility would not work if it were implemented exactly how it was written before :)). And regarding:
Actually the escaping is the standard thing to do within text node processing. In general, escaping details also depends on the node (i.e. context) and options indeed. |
Provide text escaping and replacement hooks to allow implementing comprehensive, context-dependent escaping. See #324 as an example, where it is necessary to avoid data corruption.
This PR supersedes #304.