Skip to content

Conversation

@JZDesign
Copy link
Contributor

@JZDesign JZDesign commented Dec 13, 2025

Checklist

Motivation

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

image

@emerge-tools
Copy link

emerge-tools bot commented Dec 13, 2025

📸 Snapshot Test

1 modified, 240 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
RevenueCat
com.revenuecat.PaywallsTester
0 0 1 0 240 0 ✅ Approved

🛸 Powered by Emerge Tools

@JZDesign JZDesign marked this pull request as ready for review December 13, 2025 02:49
@JZDesign JZDesign requested a review from a team as a code owner December 13, 2025 02:49
@bab-s
Copy link

bab-s commented Dec 15, 2025

Very happy indeed!

let plainString = String(result.characters)

// Find all <u>...</u> matches
guard let regex = try? NSRegularExpression(pattern: "<u>(.*?)</u>", options: []) else {
Copy link
Contributor

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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Comment on lines +154 to +155
guard let attrFullRange = result.range(of: String(plainString[fullRange])),
let attrContentRange = result[attrFullRange].range(of: String(plainString[contentNSRange])) else {
Copy link
Contributor

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.

🤔 🤔 🤔

Copy link
Contributor Author

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

Copy link
Contributor Author

@JZDesign JZDesign Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants