mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-12 12:16:11 +01:00
feat: macro names
This commit is contained in:
1 parent
6a58c5ea1d
commit
8d3678ddcb
8 files changed
+64
-29
No files matched your search
@@ -1,7 +1,6 @@
|
||||
---
|
||||
import { sluggify } from "@blitzkit/core";
|
||||
import { literalsArray } from "@blitzkit/i18n";
|
||||
import { api } from "../core/api/dynamic";
|
||||
import { Code } from "./Code";
|
||||
import { Link } from "./Link";
|
||||
import { Text } from "./Text";
|
||||
|
||||
@@ -10,10 +9,9 @@ interface Props {
|
||||
locale: string;
|
||||
}
|
||||
|
||||
const bodyPattern = /^([a-z0-9-\/\.]+) (.+)$/;
|
||||
const bodyPattern = /^([a-z0-9-\/\.\[\]]+) (.+)$/;
|
||||
|
||||
const { value, locale } = Astro.props;
|
||||
const strings = await api.strings(locale);
|
||||
|
||||
const match = value.match(bodyPattern);
|
||||
|
||||
@@ -26,10 +24,13 @@ const message = match[2];
|
||||
---
|
||||
|
||||
<Text>
|
||||
{
|
||||
literalsArray(strings.api.macros.see, {
|
||||
path: <Link href={`#${sluggify(path)}`}>{path}</Link>,
|
||||
message,
|
||||
})
|
||||
}
|
||||
<Text lowContrast weight="medium" color="tomato">
|
||||
<Code>@see</Code>
|
||||
</Text>
|
||||
|
||||
<Link underline="never" href={`#${sluggify(path)}`}>
|
||||
<Code>{path}</Code>
|
||||
</Link>
|
||||
|
||||
{message}
|
||||
</Text>
|
||||
Reference in new issue
Block a user