diff --git a/package-lock.json b/package-lock.json index 7383714..52147c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@astrojs/tailwind": "^5.1.0", "@hpcc-js/wasm": "^2.22.1", "astro": "^4.10.2", + "marked": "^14.1.2", "rehype-graphviz": "^0.3.0", "sharp": "^0.32.5", "tailwindcss": "^3.4.10" @@ -4707,6 +4708,17 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/marked": { + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/marked/-/marked-14.1.2.tgz", + "integrity": "sha512-f3r0yqpz31VXiDB/wj9GaOB0a2PRLQl6vJmXiFrniNwjkKdvakqJRULhjFKJpxOchlCRiG5fcacoUZY5Xa6PEQ==", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/mdast-util-definitions": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-6.0.0.tgz", diff --git a/package.json b/package.json index 6038d60..c6f501f 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "@astrojs/tailwind": "^5.1.0", "@hpcc-js/wasm": "^2.22.1", "astro": "^4.10.2", + "marked": "^14.1.2", "rehype-graphviz": "^0.3.0", "sharp": "^0.32.5", "tailwindcss": "^3.4.10" diff --git a/scripts/generate.ts b/scripts/generate.ts index 1908bfa..ce743a1 100644 --- a/scripts/generate.ts +++ b/scripts/generate.ts @@ -243,6 +243,35 @@ function buildRedirects(aeps: AEP[]): object { return {}; } +function buildHomepage(): Markdown { + let frontmatter = { + "title": "AEPs", + "description": "Application Enhancement Proposals", + "template": "splash", + "hero": { + "tagline": "Focused design documents for flexible API development.", + "image": { + "file": "../../assets/aep.svg" + }, + actions: [] + }, + } + + let config = loadConfigFiles("hero.yaml"); + frontmatter.hero.actions = config.hero.buttons.map((button) => ({text: button.text, link: button.href, icon: "right-arrow"})); + + let contents = `import config from "../../../generated/config.json"; + + + ` + let markdown = new Markdown(contents, frontmatter); + markdown.addComponent({ + "names": ["HomeGrid"], + "path": "../../components/HomeGrid.astro" + }); + return markdown; +} + // Build config. let config = loadConfigFiles("hero.yaml", "urls.yaml", "site.yaml"); writeSidebar(config, "config.json"); @@ -281,4 +310,7 @@ var linter_sidebar = buildLinterSidebar(consolidated_rules); writeSidebar(linter_sidebar, "linter_sidebar.json"); buildIndexPage(aeps); -writeSidebar(buildRedirects(aeps), "redirects.json"); \ No newline at end of file +writeSidebar(buildRedirects(aeps), "redirects.json"); + +let homePage = buildHomepage(); +fs.writeFileSync("src/content/docs/index.mdx", homePage.build()); \ No newline at end of file diff --git a/src/components/HomeGrid.astro b/src/components/HomeGrid.astro new file mode 100644 index 0000000..8697413 --- /dev/null +++ b/src/components/HomeGrid.astro @@ -0,0 +1,15 @@ +--- +const {sections} = Astro.props; +import { Card, CardGrid, LinkButton } from '@astrojs/starlight/components'; +import { marked } from 'marked'; +--- + + {sections.map((section) => ( + +
+ + + {section.button.text} + + ))} + \ No newline at end of file diff --git a/src/content/docs/index.mdx b/src/content/docs/index.mdx deleted file mode 100644 index 8fc6fce..0000000 --- a/src/content/docs/index.mdx +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: AEPs -description: Application Enhancement Proposals -template: splash -hero: - tagline: Focused design documents for flexible API development. - image: - file: ../../assets/aep.svg - actions: - - text: Read the AEPs - link: /general - icon: right-arrow - - text: AEP Tools - link: /tooling - icon: right-arrow ---- - -import { Card, CardGrid, LinkButton } from '@astrojs/starlight/components'; - - - - AEPs are a combination of design guidance and a system we use to manage and - track that guidance. Learn more about how the AEP program works in the first - AEP! - - Read AEP-1 - - - Interested in helping with AEPs? Contribute by proposing new guidance, - commenting on existing AEPs, or fixing typos. All contributions are welcome! - - Contribute to the project - - - AEPs are designed to be useful outside of Google. Take a look at how you - might choose which AEPs are best suited to your API design needs. - - Learn more - - - Free free to take a look at the [frequently asked questions](/faq). If you don't - find an answer there, file an issue on our GitHub repository. - - Ask us on GitHub - -