-
Notifications
You must be signed in to change notification settings - Fork 169
Feature/unicode superscripts #1674
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
Merged
sangwinc
merged 3 commits into
maths:iss1676
from
Bjoern-Ge:feature/unicode-superscripts
Feb 9, 2026
+42
−14
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,7 +117,12 @@ public static function parse(string $string, array &$errors, array &$answernote, | |
|
|
||
| // Check for invalid chars at this point as they may prove to be difficult to | ||
| // handle latter, also strings are safe already. | ||
| // Option C: Allow only the most common superscripts: ², ³, ¹ | ||
| // These are 2-byte UTF-8 characters and work without UTF-8mb4 requirement. | ||
| $superscript = ['²' => '2', '³' => '3', '¹' => '1']; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @christianp and I started a collection of patterns like this here. https://github.com/sangwinc/unicode-math-normalization We should link into this, rather than hard-wiring lists into the code. |
||
|
|
||
| $allowedcharsregex = '~[^' . preg_quote( | ||
| implode('', array_keys($superscript)) . | ||
| // @codingStandardsIgnoreStart | ||
| // We do really want a backtick here. | ||
| '0123456789,./\%#&{}[]()$@!"\'?`^~*_+qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM:;=><|: -', '~' | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The order of filters is based purely on the numbers at the start of the filter name. 180 will never get executed before 150, so if one wants to do something before 150, that something needs to be named accordingly.
The array
filterstoapplyis not the execution order for them. It is just the set of filters that need to be included in the filter pipeline; the pipeline construction logic then sorts that set and initialises the filters with any options they might have, as well as checks any issues related to incompatible filters.Interesting, though, that the filter existed but was not used in the actual logic. Only in the input fixtures tests? Guess someone got busy with something else, and this was forgotten?
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.
Indeed @aharjula that's certainly probably me! Sorry, we can look into this.