Closed DerZade closed 8 months ago
Thanks for your PR
I've a few suggestions
htmlEntities
flag only.num
or hex
. And the value can be set to a function. In the loop, we can check the type if it is string replace it as today. Otherwise, run the function as per setting in the object. It'll give the chance to disable it easily./&#([0-9]+);/
) has +
that make it unsafe to match very long string and will impact performance too.Let me know your thoughts
@amitguptagwl I just force pushed and updated my code to reflect your suggestions:
+
from both expressions. Decimal is now limited to 7 chars and hexadecimal to 6 chars. (The max code point is U+10FFFF
or 1,114,112
in decimal)htmlNumericEntities
option htmlEntities
-object. I choose num_dec
and num_hex
as keys, since there is a named char reference num;
String.prototype.replace
already supports functions as the replacer value.It's live now. You can see the entry in change logs
Thank you so much!
Purpose / Goal
This PR adds a
htmlNumericEntities
option which adds support for parsing HTML numeric entities.Type
Please mention the type of PR
Benchmarks
Before
After