-
Notifications
You must be signed in to change notification settings - Fork 30
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
Deduplicate separators when processing HTML #290
Comments
After some investigation, I'm starting to feel like this fix is not trivial. |
Avoiding redundant separaters is easy, but applying multiple times is a bit complicated, because once BudouX is applied, it's difficult to distinguish One way to do this is removing existing separaters before inserting new ones. This looks like a clean way, but this doesn't work well, becuase this option ignores author-inserted separaters. The 2nd option. BudouX can check if there's an existing separater before inserting a new one. This can fix the redundant separators, but if the content changes and if we want to apply BudouX again, existing separaters for the previous content will remain. For example:
The 3rd option is to mark separators. For example, The 4th option is BudouX to insert different separators and apply the option 1. For example, if author is supposed to use If we want to fix redundant separators without worrying about applying multiple times for updated content, the option 2 looks reasonable and simple to me. Thoughts? |
Thanks for your thorough consideration. I think the 2nd option is the way to go. We want to respect word break opportunities inserted by the author initially, but we should not distinguish if they're inserted by the author or BudouX itself from the second run. |
Demo
https://codepen.io/tushuhei/pen/VwqMywj
Setup
Expected
Actual
We may want to remove duplicated separators in case we need to apply BudouX to the same element multiple times (e.g. Web Components that reuse their Light DOM).
@kojiishi Could you take a look what changes should be applied to
html_processor.ts
?The text was updated successfully, but these errors were encountered: