Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

314 B
Raw Blame
const NAVIGATION_ALLOWED_SCHEMES: ReadonlySet<string> = new Set([
  'http:',
  'https:',
  'mailto:',
  'tel:',
]);

export function isSafeNavigationUrl(url: string): boolean {
  try {
    const parsed = new URL(url);
    return NAVIGATION_ALLOWED_SCHEMES.has(parsed.protocol);
  } catch {
    return false;
  }
}