2026-03-19 13:26:34 -05:00
|
|
|
---
|
2026-03-19 17:17:23 -05:00
|
|
|
import { sluggify } from "@blitzkit/core";
|
|
|
|
|
import { literalsArray } from "@blitzkit/i18n";
|
|
|
|
|
import { api } from "../core/api/dynamic";
|
2026-03-19 13:26:34 -05:00
|
|
|
import { Link } from "./Link";
|
|
|
|
|
import { Text } from "./Text";
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
value: string;
|
2026-03-19 17:17:23 -05:00
|
|
|
locale: string;
|
2026-03-19 13:26:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const bodyPattern = /^([a-z0-9-\/\.]+) (.+)$/;
|
2026-03-19 17:17:23 -05:00
|
|
|
|
|
|
|
|
const { value, locale } = Astro.props;
|
|
|
|
|
const strings = await api.strings(locale);
|
|
|
|
|
|
2026-03-19 13:26:34 -05:00
|
|
|
const match = value.match(bodyPattern);
|
|
|
|
|
|
|
|
|
|
if (match === null) {
|
|
|
|
|
throw new Error(`Invalid value for ApiMacroSee: ${value}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const path = match[1];
|
|
|
|
|
const message = match[2];
|
|
|
|
|
---
|
|
|
|
|
|
2026-03-19 17:17:23 -05:00
|
|
|
<Text>
|
|
|
|
|
{
|
|
|
|
|
literalsArray(strings.api.macros.see, {
|
|
|
|
|
path: <Link href={`#${sluggify(path)}`}>{path}</Link>,
|
|
|
|
|
message,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</Text>
|