@@ -32,6 +32,7 @@ struct MarkdownParser {
32
32
private static let linkTextClosingSymbol = Symbol ( character: " ] " )
33
33
private static let linkURLOpeningSymbol = Symbol ( character: " ( " )
34
34
private static let linkURLClosingSymbol = Symbol ( character: " ) " )
35
+ private static let inAppLinkSymbol = Symbol ( rawValue: " -- " )
35
36
36
37
// MARK: - Static functions
37
38
@@ -45,7 +46,8 @@ struct MarkdownParser {
45
46
let underscoreStrongSymbol = underscoreStrongSymbol,
46
47
let asteriskStrongSymbol = asteriskStrongSymbol,
47
48
let tildeStrikethroughSymbol = tildeStrikethroughSymbol,
48
- let equalUnderlineSymbol = equalUnderlineSymbol else {
49
+ let equalUnderlineSymbol = equalUnderlineSymbol,
50
+ let inAppLinkSymbol = inAppLinkSymbol, else {
49
51
return ( string, [ ] )
50
52
}
51
53
@@ -57,6 +59,7 @@ struct MarkdownParser {
57
59
let equalUnderlineRule = Rule ( symbol: equalUnderlineSymbol)
58
60
let linkTextRule = Rule ( openingSymbol: linkTextOpeningSymbol, closingSymbol: linkTextClosingSymbol)
59
61
let linkURLRule = Rule ( openingSymbol: linkURLOpeningSymbol, closingSymbol: linkURLClosingSymbol)
62
+ let inAppLinkRule = Rule ( symbol: inAppLinkSymbol)
60
63
61
64
let tokens = try TokenParser . parse ( string,
62
65
using: [ underscoreEmRule,
@@ -66,7 +69,8 @@ struct MarkdownParser {
66
69
tildeStrikethroughRule,
67
70
equalUnderlineRule,
68
71
linkTextRule,
69
- linkURLRule] )
72
+ linkURLRule,
73
+ inAppLinkRule] )
70
74
71
75
guard tokens. count > 0 else {
72
76
return ( string, [ ] )
@@ -105,6 +109,9 @@ struct MarkdownParser {
105
109
elements. append ( . link( range: range, urlString: tokens [ i + 1 ] . string) )
106
110
107
111
i += 1
112
+ case . some( inAppLinkRule) :
113
+ let range = strippedString. append ( contentOf: token)
114
+ elements. append ( . inAppLink( range: range) )
108
115
default :
109
116
strippedString += token. stringWithRuleSymbols
110
117
}
0 commit comments