Skip to content

Commit

Permalink
update markdown matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
demchenkoalex committed Aug 12, 2024
1 parent 63e3c14 commit a2a3300
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion example/assets/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"createdAt": 1655648402000,
"id": "4e048753-2d60-4144-bc28-9967050aaf12",
"status": "seen",
"text": "What a ~nice~ _wonderful_ sunset! 😻",
"text": "What a ~~nice~~ __wonderful__ sunset! 😻",
"type": "text"
},
{
Expand Down
15 changes: 8 additions & 7 deletions lib/src/models/pattern_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class PatternStyle {
String get pattern => regExp.pattern;

static PatternStyle get bold => PatternStyle(
'*',
RegExp('\\*[^\\*]+\\*'),
'**',
RegExp('\\*\\*[^\\*]+\\*\\*'),
'',
const TextStyle(fontWeight: FontWeight.bold),
);
Expand All @@ -23,22 +23,23 @@ class PatternStyle {
RegExp('`[^`]+`'),
'',
TextStyle(
fontFamily: defaultTargetPlatform == TargetPlatform.iOS
fontFamily: defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS
? 'Courier'
: 'monospace',
),
);

static PatternStyle get italic => PatternStyle(
'_',
RegExp('_[^_]+_'),
'__',
RegExp('__[^_]+__'),
'',
const TextStyle(fontStyle: FontStyle.italic),
);

static PatternStyle get lineThrough => PatternStyle(
'~',
RegExp('~[^~]+~'),
'~~',
RegExp('~~[^~]+~~'),
'',
const TextStyle(decoration: TextDecoration.lineThrough),
);
Expand Down

2 comments on commit a2a3300

@mulderpf
Copy link

Choose a reason for hiding this comment

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

I created issue #626 for this as this is not backwards compatible and breaks all messages created in older versions. What was the reason for this change?

@demchenkoalex
Copy link
Member Author

Choose a reason for hiding this comment

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

replied in the issue. New version only contains this change, just do not update.

Please sign in to comment.