| | |
| | | import { slug as slugAnchor } from "github-slugger" |
| | | import type { Element as HastElement } from "hast" |
| | | import { clone } from "./clone" |
| | | |
| | | // this file must be isomorphic so it can't use node libs (e.g. path) |
| | | |
| | | export const QUARTZ = "quartz" |
| | |
| | | return validStart && validEnding && ![".md", ".html"].includes(getFileExtension(s) ?? "") |
| | | } |
| | | |
| | | export function isAbsoluteURL(s: string): boolean { |
| | | try { |
| | | new URL(s) |
| | | } catch { |
| | | return false |
| | | } |
| | | return true |
| | | } |
| | | |
| | | export function getFullSlug(window: Window): FullSlug { |
| | | const res = window.document.body.dataset.slug! as FullSlug |
| | | return res |