File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -71,14 +71,34 @@ function compileToJSON(str) {
71
71
let min_index_of = - 1
72
72
let min_index_of_key = null
73
73
74
+ let links = linkify . find ( str )
75
+ let min_index_from_link = false
76
+
77
+ if ( links . length > 0 ) {
78
+ min_index_of = str . indexOf ( links [ 0 ] . value )
79
+ min_index_from_link = true
80
+ }
81
+
74
82
Object . keys ( pseudo_markdown ) . forEach ( starting_value => {
75
83
const io = str . indexOf ( starting_value )
76
84
if ( io >= 0 && ( min_index_of < 0 || io < min_index_of ) ) {
77
85
min_index_of = io
78
86
min_index_of_key = starting_value
87
+ min_index_from_link = false
88
+
79
89
}
80
90
} )
81
91
92
+ if ( min_index_from_link && min_index_of_key != - 1 ) {
93
+ let str_left = str . substr ( 0 , min_index_of )
94
+ let str_link = str . substr ( min_index_of , links [ 0 ] . value . length )
95
+ let str_right = str . substr ( min_index_of + links [ 0 ] . value . length )
96
+ result . push ( str_left )
97
+ result . push ( str_link )
98
+ result = result . concat ( compileToJSON ( str_right ) )
99
+ return result
100
+ }
101
+
82
102
if ( min_index_of_key ) {
83
103
let str_left = str . substr ( 0 , min_index_of )
84
104
const char = min_index_of_key
You can’t perform that action at this time.
0 commit comments