@@ -23,8 +23,11 @@ pub fn extract_wikilink_targets(text: &str) -> Vec<String> {
2323 {
2424 let inner = & rest[ ..close] ;
2525 if !is_embed && !inner. is_empty ( ) && !inner. contains ( '\n' ) {
26+ // Obsidian escapes the alias pipe as `\|` inside tables;
27+ // unescape it so the `|` separator is recognized.
28+ let inner = inner. replace ( "\\ |" , "|" ) ;
2629 // Strip heading: [[Note#Section]] → "Note"
27- let target = inner. split ( '#' ) . next ( ) . unwrap_or ( inner) ;
30+ let target = inner. split ( '#' ) . next ( ) . unwrap_or ( inner. as_str ( ) ) ;
2831 // Strip display: [[Note|Display]] → "Note"
2932 let target = target. split ( '|' ) . next ( ) . unwrap_or ( target) ;
3033 let target = target. trim ( ) . to_string ( ) ;
@@ -195,6 +198,15 @@ mod tests {
195198 assert_eq ! ( targets, vec![ "Note" ] ) ; // strip both heading and display
196199 }
197200
201+ #[ test]
202+ fn test_extract_wikilinks_escaped_pipe_in_table ( ) {
203+ // Obsidian escapes the alias pipe as `\|` inside tables; the target
204+ // must still resolve to the note name, not "Name\".
205+ let text = "| [[Vlad Apukhtin\\ |Vlad]] | done |" ;
206+ let targets = extract_wikilink_targets ( text) ;
207+ assert_eq ! ( targets, vec![ "Vlad Apukhtin" ] ) ;
208+ }
209+
198210 #[ test]
199211 fn test_extract_query_terms ( ) {
200212 let terms = extract_query_terms ( "BRE-2579 delivery date" ) ;
0 commit comments