mirror of
https://github.com/jimeh/commonflow.org.git
synced 2026-02-19 05:46:40 +00:00
91 lines
2.4 KiB
Plaintext
91 lines
2.4 KiB
Plaintext
---
|
|
import { getCollection } from "astro:content";
|
|
import * as fs from "node:fs";
|
|
import * as path from "node:path";
|
|
|
|
import SinglePage from "../../layouts/SinglePage.astro";
|
|
import Header from "../../components/Header.astro";
|
|
import Hero from "../../components/Hero.astro";
|
|
import AboutSection from "../../components/AboutSection.astro";
|
|
import SpecSection from "../../components/SpecSection.astro";
|
|
import FAQSection from "../../components/FAQSection.astro";
|
|
import { parseSpecContent } from "../../utils/parseSpecContent";
|
|
import { config } from "../../config";
|
|
|
|
export async function getStaticPaths() {
|
|
const specs = await getCollection("spec");
|
|
return specs.map((spec) => ({
|
|
params: { version: spec.data.version },
|
|
props: { spec },
|
|
}));
|
|
}
|
|
|
|
const { spec } = Astro.props;
|
|
const version = spec.data.version;
|
|
|
|
// Read the markdown file
|
|
const filePath = path.join(process.cwd(), "src/content/spec", `${version}.md`);
|
|
const content = fs.readFileSync(filePath, "utf-8");
|
|
|
|
// Remove frontmatter
|
|
const markdown = content.replace(/^---[\s\S]*?---\n/, "");
|
|
|
|
// Parse the content into sections (handles markdown -> HTML internally)
|
|
const parsed = await parseSpecContent(markdown, version);
|
|
---
|
|
|
|
<SinglePage title={spec.data.title} version={version}>
|
|
<Header version={version} />
|
|
|
|
<main>
|
|
<Hero version={version} svgPath={parsed.svgPath} />
|
|
|
|
<AboutSection
|
|
introduction={parsed.introduction}
|
|
summary={parsed.summary}
|
|
about={parsed.about}
|
|
license={parsed.license}
|
|
/>
|
|
|
|
<SpecSection
|
|
terminology={parsed.terminology}
|
|
terminologyTitle={parsed.terminologyTitle}
|
|
specification={parsed.specification}
|
|
tocItems={parsed.tocItems}
|
|
/>
|
|
|
|
<FAQSection items={parsed.faq} />
|
|
</main>
|
|
|
|
<!-- Footer -->
|
|
<footer
|
|
class="py-8 text-center text-sm
|
|
text-gray-500 dark:text-gray-500
|
|
border-t border-gray-200 dark:border-gray-800"
|
|
>
|
|
<div class="section-container">
|
|
<p>
|
|
Git Common-Flow is authored by
|
|
<a
|
|
href="https://jimeh.me/"
|
|
class="hover:text-sky-600"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
>
|
|
Jim Myhrberg
|
|
</a>
|
|
</p>
|
|
<p class="mt-2">
|
|
<a
|
|
href="https://creativecommons.org/licenses/by/4.0/"
|
|
class="hover:text-sky-600"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
>
|
|
CC BY 4.0
|
|
</a>
|
|
</p>
|
|
</div>
|
|
</footer>
|
|
</SinglePage>
|