File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -71,14 +71,33 @@ function compileToJSON(str) {
7171 let min_index_of = - 1
7272 let min_index_of_key = null
7373
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+
7482 Object . keys ( pseudo_markdown ) . forEach ( starting_value => {
7583 const io = str . indexOf ( starting_value )
7684 if ( io >= 0 && ( min_index_of < 0 || io < min_index_of ) ) {
7785 min_index_of = io
7886 min_index_of_key = starting_value
87+ min_index_from_link = false
7988 }
8089 } )
8190
91+ if ( min_index_from_link && min_index_of_key != - 1 ) {
92+ let str_left = str . substr ( 0 , min_index_of )
93+ let str_link = str . substr ( min_index_of , links [ 0 ] . value . length )
94+ let str_right = str . substr ( min_index_of + links [ 0 ] . value . length )
95+ result . push ( str_left )
96+ result . push ( str_link )
97+ result = result . concat ( compileToJSON ( str_right ) )
98+ return result
99+ }
100+
82101 if ( min_index_of_key ) {
83102 let str_left = str . substr ( 0 , min_index_of )
84103 const char = min_index_of_key
You can’t perform that action at this time.
0 commit comments