 {{ $plainContent := $matchedPage.Plain | htmlUnescape }}
    {{ $noteData := dict 
      "title" $matchedPage.Title
      "excerpt" (substr $plainContent 0 150)
    }}
    
    {{ $replacement = printf "<a href=\"%s\" data-note='%s'>%s</a>" 
      $matchedPage.RelPermalink 
      (jsonify $noteData)
      $display 
    }}
  {{ else }}
    {{ $tooltipText := $page.Site.Params.wikilinks.brokenLinkTooltip | default "Page not found" }}
    {{ $replacement = printf `<span class="wikilink broken" data-title="%s"