public function getDocumentUrl($url) { // because the URL also includes the current page as segment, it means we have to go 1 higher. Example: // document: "codex/master/getting-started/configure" // has link: "../index" // normalizes to: "codex/master/getting-started/index" // this will fix that $url = "../{$url}"; // endfix $url = str_replace_last('.' . $this->getExtension($url), '', $url); $url = url()->current() . Str::ensureLeft($url, '/'); return $this->normalizeUrl($url); }