-
Notifications
You must be signed in to change notification settings - Fork 404
Add Underline text support #5935
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
base: main
Are you sure you want to change the base?
Conversation
📸 Snapshot Test1 modified, 240 unchanged
🛸 Powered by Emerge Tools |
|
Very happy indeed! |
| let plainString = String(result.characters) | ||
|
|
||
| // Find all <u>...</u> matches | ||
| guard let regex = try? NSRegularExpression(pattern: "<u>(.*?)</u>", options: []) else { |
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.
Let's make the regex static over NSRegularExpression.
| let plainString = String(result.characters) | ||
|
|
||
| // Find all <u>...</u> matches | ||
| guard let regex = try? NSRegularExpression(pattern: "<u>(.*?)</u>", options: []) else { |
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.
Also maybe silly, but just to clarify. This allows <u></u> right? Is that intentional?
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.
Yes it does, it won't matter because the U tags will be removed.
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.
didn't think about that case honestly, but I'm not concerned
| guard let attrFullRange = result.range(of: String(plainString[fullRange])), | ||
| let attrContentRange = result[attrFullRange].range(of: String(plainString[contentNSRange])) else { |
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.
range(of:) returns the first occurrence of the substring, not necessarily the one matched by the regex.
So I think this might be problematic because even going in reverse, result.range will get the first occurrence if there is more than occurrence.
🤔 🤔 🤔
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 preview is working with more than one occurrence
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.
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.
Ok let me double check this

Checklist
purchases-androidand hybrids Support Underlined Text purchases-android#2928Motivation
We've had customers asking for this for months, Jacob started asking about it in Slack, and @bab-s would be happy.
Description
Add
<u></u>support in the markdown formatter