import { escape } from "html-escaper";
import { prefixBase } from "../components/islands/base-path.ts";
import { isImageIcon, isInlineSvg } from "../theme/icon-kind.ts";
import { resolveIcon } from "../theme/icons.ts";
/**
* Resolve a `search.popular` icon to markup for the Cmd+K island. Accepts the
* same *inputs* as nav `` (built-in name, image path/URL, inline SVG);
* resolved on the server so the island never loads the icon set.
*/
export const resolvePopularIconMarkup = (
icon?: string,
/** `deployment.base` / `import.meta.env.BASE_URL` for root-relative image paths. */
base = "/"
): string | undefined => {
if (!icon) {
return undefined;
}
if (isInlineSvg(icon)) {
// Author SVG carries no guaranteed width/height (a viewBox-only