2026-03-19 13:26:34 -05:00
|
|
|
---
|
|
|
|
|
import ApiMacroSee from "./ApiMacroSee.astro";
|
|
|
|
|
import { MarkdownCustom } from "./MarkdownCustom";
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
body: string;
|
2026-03-19 17:17:23 -05:00
|
|
|
locale: string;
|
2026-03-19 13:26:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const macroPattern = /@(\w+) (.+)/;
|
|
|
|
|
const macros: Record<string, string> = {};
|
|
|
|
|
|
2026-03-19 17:17:23 -05:00
|
|
|
const { body: bodyOriginal, locale } = Astro.props;
|
2026-03-19 13:26:34 -05:00
|
|
|
let body = "";
|
|
|
|
|
|
|
|
|
|
for (const line of bodyOriginal.split("\n")) {
|
|
|
|
|
const match = line.match(macroPattern);
|
|
|
|
|
|
|
|
|
|
if (match === null) {
|
|
|
|
|
body += `${line}\n`;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const macro = match[1];
|
|
|
|
|
const value = match[2];
|
|
|
|
|
|
|
|
|
|
macros[macro] = value;
|
|
|
|
|
}
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.api-description {
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
|
|
.gutter {
|
|
|
|
|
width: var(--space-2);
|
|
|
|
|
background: linear-gradient(transparent, var(--gray-6) var(--space-4));
|
|
|
|
|
|
|
|
|
|
margin: 0 var(--space-4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: var(--space-4);
|
|
|
|
|
|
|
|
|
|
padding-top: var(--space-4);
|
|
|
|
|
padding-bottom: var(--space-3);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<div class="api-description">
|
|
|
|
|
<div class="gutter"></div>
|
|
|
|
|
<div class="content">
|
|
|
|
|
<MarkdownCustom {body} />
|
2026-03-19 17:17:23 -05:00
|
|
|
{"see" in macros && <ApiMacroSee {locale} value={macros.see} />}
|
2026-03-19 13:26:34 -05:00
|
|
|
</div>
|
|
|
|
|
</div>
|