-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: enable html preprocessing #1529
Conversation
probably major version, right? |
Breaking change in the component interface so I'd say yes |
Is there a specific reason to remove the existing functionality to unescape and making this a breaking version. My suggestion would be:
Also I would keep the |
fyi: #1426 |
That entity subset is actually too small for me and others (see #1435). There's a bunch more entities, e.g. visible in alt dependency: https://github.com/mdevils/html-entities/blob/master/src/named-references.ts
So, like this? type TransProps = {
...
shouldUnescape?: boolean | (text: string) => string;
}
Naming is actually |
@nilsmehlhorn adding the unescape "default" function as option here: https://github.com/i18next/react-i18next/blob/master/src/context.js#L3 -> devs can override it by passing it in i18next.init as options.react here https://github.com/i18next/react-i18next/blob/master/src/Trans.js#L252 instead of using unescape from the import we use it from the i18nOptions |
I've implemented a default unescape analogue to html-escaper and enabled the override via options. Not quite sure about the typing though, because |
Yes, currently the types needs to be updated here for react-i18next: https://github.com/i18next/i18next/blob/master/index.d.ts#L186 correct me @pedrodurek if I'm wrong |
released with react-i18next v11.18.0 and i18next v21.8.13 |
@nilsmehlhorn thank you for your contribution |
Checklist
npm run test
Checklist (for documentation change)
Closes #1435