-
-
Notifications
You must be signed in to change notification settings - Fork 207
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
Delimiter point is escaped in numbers #141
Comments
I'm assuming you mean I think this is the correct behavior, if your text starts with a numbered list-like text, it should be escaped. If it is not, then don't escape it. Can you provide an example of what's your expected behavior? |
Hey! Yes, i meant 120\.000. |
Well, after playing with the Commonmark dingus I realized two things:
Which parser are you using to consider |
According to the CommonMark spec:
While I do think that converting |
Just released 4.6.0 with this fix :) |
Awesome! Thanks for the quick solution! :) |
I experienced some unexpected behavior while using this library.
If a text begins with, let's say "120.000", the delimiter point is escaped, resulting in "120\.000".
If the same string appears somewhere else in a string ("We like 120.000"), it is not escaped.
The reason seems to be this code in src/Converter/ParagraphConverter.php:
private function escapeOtherCharactersRegex($line) { $regExs = array( // Match numbers ending on ')' or '.' that are at the beginning of the line. '/^[0-9]+(?=\)|\.)/' ); foreach ($regExs as $i) { if (preg_match($i, $line, $match)) { // Matched an escapable character, adding a backslash on the string before the offending character $line = substr_replace($line, '\\', strlen($match[0]), 0); } } return $line; }
The regex ignores the fact that this is not a numbered list, but a regular number with a delimiter character.
The text was updated successfully, but these errors were encountered: