library_helpers.ts

Library documentation URL helpers.

Runtime UI helpers for building URLs in the library documentation system. These depend on fuz_ui's documentation paths and SvelteKit's runtime state.

For generic package/repository URL helpers, see @fuzdev/fuz_util/package_helpers.ts.

view source

Declarations
#

url_to_root_relative
#

library_helpers.ts view source

(url: string, origin?: string): string import {url_to_root_relative} from '@fuzdev/fuz_ui/library_helpers.js';

Convert a full URL to root-relative format by removing the origin.

Uses SvelteKit's page state for the current origin by default.

url

full URL to convert

type string

origin

origin to strip (defaults to current page origin)

type string
default page.url.origin

returns

string

root-relative URL starting with '/'

examples

// Assuming page.url.origin is 'https://fuz.dev' url_to_root_relative('https://fuz.dev/docs/api') // => '/docs/api'

Imported by
#