@@ -90,11 +90,11 @@ export default class SourceViewObserver {
90
90
const filePath = this . plugin . app . workspace . getActiveFile ( ) ?. path ;
91
91
if ( ! activeLeaf || filePath === undefined ) return ;
92
92
93
- const regex2Find = / (?< = [ [ ] { 2 } ) [ ^ \] ] * (? = [ \] ] { 2 } ) / gm;
93
+ const regex2FindLinks = / [ [ ] { 2 } [ ^ \] ] * (? = [ \] ] { 2 } ) / gm;
94
94
const view = activeLeaf . leaf . view . containerEl ;
95
95
const editor = activeLeaf . editor ;
96
96
const oldText = editor . getValue ( ) ;
97
- const linkHref = oldText . match ( regex2Find ) ;
97
+ const linkHref = oldText . match ( regex2FindLinks )
98
98
if ( ! linkHref || linkHref . length == 0 ) return ;
99
99
100
100
const tempSourceLinks = view . getElementsByClassName ( 'cm-hmd-internal-link cm-link-alias' ) as HTMLCollectionOf < HTMLAnchorElement > ;
@@ -130,7 +130,10 @@ export default class SourceViewObserver {
130
130
for ( let i = 0 ; i < sourceLinks . length ; i ++ ) {
131
131
const tempLink = linkHref [ i ] ;
132
132
if ( typeof tempLink != 'string' ) continue ;
133
- const parsedLink = parseLinktext ( tempLink . split ( '|' ) [ 0 ] ) ;
133
+
134
+ // substring used remove [[ from internal link
135
+ // because iOS doesn't support positive lookback regex
136
+ const parsedLink = parseLinktext ( tempLink . substring ( 2 ) . split ( '|' ) [ 0 ] ) ;
134
137
const annotationid = parsedLink . subpath . startsWith ( '#^' ) ? parsedLink . subpath . substring ( 2 ) : null ;
135
138
const file : TFile | null = this . plugin . app . metadataCache . getFirstLinkpathDest ( parsedLink . path , filePath ) ;
136
139
0 commit comments