1<?php 2 3namespace dokuwiki\plugin\prosemirror\parser; 4 5class LocalLinkNode extends LinkNode 6{ 7 public function toSyntax() 8 { 9 return $this->getDefaultLinkSyntax($this->attrs['href']); 10 } 11 12 public static function render($renderer, $hash, $name) 13 { 14 global $ID; 15 16 $additionalAttributes = [ 17 'data-resolvedTitle' => $ID . ' ↵', 18 'data-resolvedID' => $ID . '#' . $hash, 19 'data-resolvedName' => $hash, 20 'data-resolvedClass' => 'wikilink1', 21 ]; 22 23 self::renderToJSON( 24 $renderer, 25 'internallink', 26 '#' . $hash, 27 $name, 28 $additionalAttributes 29 ); 30 } 31 32 public static function resolveLocalLink($hash, $id) 33 { 34 $trimmedHash = trim($hash, '#'); 35 return [ 36 'id' => $id . '#' . $trimmedHash, 37 'exists' => true, 38 'heading' => $trimmedHash, 39 'title' => $id . ' ↵', 40 ]; 41 } 42} 43