From 8e3cb20b5c37c9539412b659943b6191086ccf52 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Mon, 26 Jun 2023 11:34:13 +0800 Subject: [PATCH] Format markdown files (#7439) Co-authored-by: Chris Swithinbank --- .prettierignore | 3 - README.md | 25 ++-- examples/basics/README.md | 1 - examples/blog/README.md | 1 - examples/blog/src/content/blog/first-post.md | 8 +- .../src/content/blog/markdown-style-guide.md | 8 +- examples/blog/src/content/blog/second-post.md | 8 +- examples/blog/src/content/blog/third-post.md | 8 +- examples/component/README.md | 10 +- examples/deno/README.md | 1 - examples/framework-alpine/README.md | 1 - examples/framework-lit/README.md | 2 +- examples/framework-vue/README.md | 1 - examples/integration/README.md | 10 +- examples/portfolio/README.md | 1 - package.json | 2 +- packages/astro-prism/README.md | 9 +- packages/astro-rss/README.md | 66 ++++----- packages/astro/README.md | 9 +- .../astro/src/core/build/plugins/README.md | 37 ++--- packages/astro/src/core/errors/README.md | 38 +++-- .../src/vite-plugin-config-alias/README.md | 6 +- packages/create-astro/README.md | 21 +-- packages/integrations/alpinejs/README.md | 2 +- packages/integrations/cloudflare/README.md | 19 ++- packages/integrations/deno/README.md | 41 +++--- packages/integrations/image/README.md | 131 ++++++++++++------ packages/integrations/lit/README.md | 22 +-- packages/integrations/markdoc/README.md | 56 ++++---- packages/integrations/mdx/README.md | 47 ++++--- packages/integrations/mdx/src/README.md | 20 +-- packages/integrations/netlify/README.md | 48 +++---- packages/integrations/node/README.md | 70 +++++----- packages/integrations/partytown/README.md | 80 ++++++----- packages/integrations/preact/README.md | 12 +- packages/integrations/prefetch/README.md | 45 +++--- packages/integrations/react/README.md | 4 +- packages/integrations/sitemap/README.md | 117 ++++++++-------- packages/integrations/solid/README.md | 8 +- packages/integrations/svelte/README.md | 12 +- packages/integrations/tailwind/README.md | 59 ++++---- packages/integrations/turbolinks/README.md | 3 +- packages/integrations/vercel/README.md | 93 +++++++------ packages/integrations/vue/README.md | 50 +++---- packages/markdown/component/readme.md | 7 +- packages/webapi/README.md | 34 +++-- pnpm-lock.yaml | 39 +++++- 47 files changed, 701 insertions(+), 594 deletions(-) diff --git a/.prettierignore b/.prettierignore index e6c627f0c..71dca9c3c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -12,14 +12,11 @@ packages/markdown/component/Markdown.astro **/fixtures **/vendor **/.vercel -examples/docs/**/*.md -examples/blog/**/*.md # Directories .github .changeset # Files -README.md packages/webapi/mod.d.ts pnpm-lock.yaml diff --git a/README.md b/README.md index 934bceb98..31341cdd6 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@

- ## Install The **recommended** way to install the latest version of Astro is by running the command below: @@ -23,9 +22,10 @@ You can also install Astro **manually** by running this command instead: npm install --save-dev astro ``` -Looking for help? Start with our [Getting Started](https://docs.astro.build/en/getting-started/) guide. +Looking for help? Start with our [Getting Started](https://docs.astro.build/en/getting-started/) guide. Looking for quick examples? [Open a starter project](https://astro.new/) right in your browser. + ## Documentation Visit our [official documentation](https://docs.astro.build/). @@ -33,9 +33,10 @@ Visit our [official documentation](https://docs.astro.build/). ## Support Having trouble? Get help in the official [Astro Discord](https://astro.build/chat). + ## Contributing -**New contributors welcome!** Check out our [Contributors Guide](CONTRIBUTING.md) for help getting started. +**New contributors welcome!** Check out our [Contributors Guide](CONTRIBUTING.md) for help getting started. Join us on [Discord](https://astro.build/chat) to meet other maintainers. We'll help you get your first contribution in no time! @@ -47,23 +48,23 @@ Join us on [Discord](https://astro.build/chat) to meet other maintainers. We'll | [create-astro](packages/create-astro) | [![create-astro version](https://img.shields.io/npm/v/create-astro.svg?label=%20)](packages/create-astro/CHANGELOG.md) | | [@astrojs/react](packages/integrations/react) | [![astro version](https://img.shields.io/npm/v/@astrojs/react.svg?label=%20)](packages/integrations/react/CHANGELOG.md) | | [@astrojs/preact](packages/integrations/preact) | [![astro version](https://img.shields.io/npm/v/@astrojs/preact.svg?label=%20)](packages/integrations/preact/CHANGELOG.md) | -| [@astrojs/solid-js](packages/integrations/solid) | [![astro version](https://img.shields.io/npm/v/@astrojs/solid-js.svg?label=%20)](packages/integrations/solid/CHANGELOG.md) | +| [@astrojs/solid-js](packages/integrations/solid) | [![astro version](https://img.shields.io/npm/v/@astrojs/solid-js.svg?label=%20)](packages/integrations/solid/CHANGELOG.md) | | [@astrojs/svelte](packages/integrations/svelte) | [![astro version](https://img.shields.io/npm/v/@astrojs/svelte.svg?label=%20)](packages/integrations/svelte/CHANGELOG.md) | | [@astrojs/vue](packages/integrations/vue) | [![astro version](https://img.shields.io/npm/v/@astrojs/vue.svg?label=%20)](packages/integrations/vue/CHANGELOG.md) | | [@astrojs/lit](packages/integrations/lit) | [![astro version](https://img.shields.io/npm/v/@astrojs/lit.svg?label=%20)](packages/integrations/lit/CHANGELOG.md) | | [@astrojs/deno](packages/integrations/deno) | [![astro version](https://img.shields.io/npm/v/@astrojs/deno.svg?label=%20)](packages/integrations/deno/CHANGELOG.md) | | [@astrojs/netlify](packages/integrations/netlify) | [![astro version](https://img.shields.io/npm/v/@astrojs/netlify.svg?label=%20)](packages/integrations/netlify/CHANGELOG.md) | -| [@astrojs/node](packages/integrations/node) | [![astro version](https://img.shields.io/npm/v/@astrojs/node.svg?label=%20)](packages/integrations/node/CHANGELOG.md) | +| [@astrojs/node](packages/integrations/node) | [![astro version](https://img.shields.io/npm/v/@astrojs/node.svg?label=%20)](packages/integrations/node/CHANGELOG.md) | | [@astrojs/vercel](packages/integrations/vercel) | [![astro version](https://img.shields.io/npm/v/@astrojs/vercel.svg?label=%20)](packages/integrations/vercel/CHANGELOG.md) | | [@astrojs/cloudflare](packages/integrations/cloudflare) | [![astro version](https://img.shields.io/npm/v/@astrojs/cloudflare.svg?label=%20)](packages/integrations/cloudflare/CHANGELOG.md) | | [@astrojs/partytown](packages/integrations/partytown) | [![astro version](https://img.shields.io/npm/v/@astrojs/partytown.svg?label=%20)](packages/integrations/partytown/CHANGELOG.md) | | [@astrojs/sitemap](packages/integrations/sitemap) | [![astro version](https://img.shields.io/npm/v/@astrojs/sitemap.svg?label=%20)](packages/integrations/sitemap/CHANGELOG.md) | | [@astrojs/tailwind](packages/integrations/tailwind) | [![astro version](https://img.shields.io/npm/v/@astrojs/tailwind.svg?label=%20)](packages/integrations/tailwind/CHANGELOG.md) | | [@astrojs/turbolinks](packages/integrations/turbolinks) | [![astro version](https://img.shields.io/npm/v/@astrojs/turbolinks.svg?label=%20)](packages/integrations/turbolinks/CHANGELOG.md) | -| [@astrojs/alpinejs](packages/integrations/alpinejs) | [![astro version](https://img.shields.io/npm/v/@astrojs/alpinejs.svg?label=%20)](packages/integrations/alpinejs/CHANGELOG.md) | -| [@astrojs/image](packages/integrations/image) | [![astro version](https://img.shields.io/npm/v/@astrojs/image.svg?label=%20)](packages/integrations/image/CHANGELOG.md) | -| [@astrojs/mdx](packages/integrations/mdx) | [![astro version](https://img.shields.io/npm/v/@astrojs/mdx.svg?label=%20)](packages/integrations/mdx/CHANGELOG.md) | -| [@astrojs/prefetch](packages/integrations/prefetch) | [![astro version](https://img.shields.io/npm/v/@astrojs/prefetch.svg?label=%20)](packages/integrations/prefetch/CHANGELOG.md) | +| [@astrojs/alpinejs](packages/integrations/alpinejs) | [![astro version](https://img.shields.io/npm/v/@astrojs/alpinejs.svg?label=%20)](packages/integrations/alpinejs/CHANGELOG.md) | +| [@astrojs/image](packages/integrations/image) | [![astro version](https://img.shields.io/npm/v/@astrojs/image.svg?label=%20)](packages/integrations/image/CHANGELOG.md) | +| [@astrojs/mdx](packages/integrations/mdx) | [![astro version](https://img.shields.io/npm/v/@astrojs/mdx.svg?label=%20)](packages/integrations/mdx/CHANGELOG.md) | +| [@astrojs/prefetch](packages/integrations/prefetch) | [![astro version](https://img.shields.io/npm/v/@astrojs/prefetch.svg?label=%20)](packages/integrations/prefetch/CHANGELOG.md) | [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/6178/badge)](https://bestpractices.coreinfrastructure.org/projects/6178) @@ -71,10 +72,9 @@ Several official projects are maintained outside of this repo: | Project | Repository | | ------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| [@astrojs/compiler](https://github.com/withastro/compiler) | [withastro/compiler](https://github.com/withastro/compiler) | +| [@astrojs/compiler](https://github.com/withastro/compiler) | [withastro/compiler](https://github.com/withastro/compiler) | | [Astro Language Tools](https://github.com/withastro/language-tools) | [withastro/language-tools](https://github.com/withastro/language-tools) | - ## Links - [License (MIT)](LICENSE) @@ -92,8 +92,7 @@ Astro is generously supported by Netlify, Storyblok, and several other amazing o

-[![Astro's sponsors.](https://astro.build/sponsors.png -"Astro's sponsors. +[![Astro's sponsors.](https://astro.build/sponsors.png "Astro's sponsors. Platinum sponsors: Netlify, storyblok, Vercel, Ship Shape, Google Chrome Gold sponsors: ‹div›RIOTS, DEEPGRAM, CloudCannon Sponsors: Monogram, Qoddi, Dimension")](https://github.com/sponsors/withastro) diff --git a/examples/basics/README.md b/examples/basics/README.md index 43c1d6d0c..75d44e0da 100644 --- a/examples/basics/README.md +++ b/examples/basics/README.md @@ -12,7 +12,6 @@ npm create astro@latest -- --template basics ![basics](https://user-images.githubusercontent.com/4677417/186188965-73453154-fdec-4d6b-9c34-cb35c248ae5b.png) - ## 🚀 Project Structure Inside of your Astro project, you'll see the following folders and files: diff --git a/examples/blog/README.md b/examples/blog/README.md index 579d3244a..33c8496b6 100644 --- a/examples/blog/README.md +++ b/examples/blog/README.md @@ -10,7 +10,6 @@ npm create astro@latest -- --template blog > 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun! - ![blog](https://user-images.githubusercontent.com/4677417/186189140-4ef17aac-c3c9-4918-a8c2-ce86ba1bb394.png) Features: diff --git a/examples/blog/src/content/blog/first-post.md b/examples/blog/src/content/blog/first-post.md index 33b844032..eb5e250f8 100644 --- a/examples/blog/src/content/blog/first-post.md +++ b/examples/blog/src/content/blog/first-post.md @@ -1,8 +1,8 @@ --- -title: "First post" -description: "Lorem ipsum dolor sit amet" -pubDate: "Jul 08 2022" -heroImage: "/placeholder-hero.jpg" +title: 'First post' +description: 'Lorem ipsum dolor sit amet' +pubDate: 'Jul 08 2022' +heroImage: '/placeholder-hero.jpg' --- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. diff --git a/examples/blog/src/content/blog/markdown-style-guide.md b/examples/blog/src/content/blog/markdown-style-guide.md index 242e86278..bb7bb2daa 100644 --- a/examples/blog/src/content/blog/markdown-style-guide.md +++ b/examples/blog/src/content/blog/markdown-style-guide.md @@ -1,8 +1,8 @@ --- -title: "Markdown Style Guide" -description: "Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro." -pubDate: "Jul 01 2022" -heroImage: "/placeholder-hero.jpg" +title: 'Markdown Style Guide' +description: 'Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro.' +pubDate: 'Jul 01 2022' +heroImage: '/placeholder-hero.jpg' --- Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro. diff --git a/examples/blog/src/content/blog/second-post.md b/examples/blog/src/content/blog/second-post.md index 1bd5ee465..b5a067938 100644 --- a/examples/blog/src/content/blog/second-post.md +++ b/examples/blog/src/content/blog/second-post.md @@ -1,8 +1,8 @@ --- -title: "Second post" -description: "Lorem ipsum dolor sit amet" -pubDate: "Jul 22 2022" -heroImage: "/placeholder-hero.jpg" +title: 'Second post' +description: 'Lorem ipsum dolor sit amet' +pubDate: 'Jul 22 2022' +heroImage: '/placeholder-hero.jpg' --- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. diff --git a/examples/blog/src/content/blog/third-post.md b/examples/blog/src/content/blog/third-post.md index d7f1f24b0..a2bc343bd 100644 --- a/examples/blog/src/content/blog/third-post.md +++ b/examples/blog/src/content/blog/third-post.md @@ -1,8 +1,8 @@ --- -title: "Third post" -description: "Lorem ipsum dolor sit amet" -pubDate: "Jul 15 2022" -heroImage: "/placeholder-hero.jpg" +title: 'Third post' +description: 'Lorem ipsum dolor sit amet' +pubDate: 'Jul 15 2022' +heroImage: '/placeholder-hero.jpg' --- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. diff --git a/examples/component/README.md b/examples/component/README.md index 00f1a04e5..c92a01a95 100644 --- a/examples/component/README.md +++ b/examples/component/README.md @@ -10,7 +10,6 @@ npm create astro@latest -- --template component [![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/non-html-pages) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/component/devcontainer.json) - ## 🚀 Project Structure Inside of your Astro project, you'll see the following folders and files: @@ -27,9 +26,10 @@ Inside of your Astro project, you'll see the following folders and files: The `index.ts` file is the "entry point" for your package. Export your components in `index.ts` to make them importable from your package. ## 🧞 Commands + All commands are run from the root of the project, from a terminal: -| Command | Action | -| :--------------------- | :----------------------------------------------- | -| `npm link` | Registers this package locally. Run `npm link my-component-library` in an Astro project to install your components -| `npm publish` | [Publishes](https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages#publishing-unscoped-public-packages) this package to NPM. Requires you to be [logged in](https://docs.npmjs.com/cli/v8/commands/npm-adduser) +| Command | Action | +| :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `npm link` | Registers this package locally. Run `npm link my-component-library` in an Astro project to install your components | +| `npm publish` | [Publishes](https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages#publishing-unscoped-public-packages) this package to NPM. Requires you to be [logged in](https://docs.npmjs.com/cli/v8/commands/npm-adduser) | diff --git a/examples/deno/README.md b/examples/deno/README.md index 0b1ea4c4b..98f7ee020 100644 --- a/examples/deno/README.md +++ b/examples/deno/README.md @@ -12,7 +12,6 @@ npm create astro@latest -- --template deno ![basics](https://user-images.githubusercontent.com/4677417/186188965-73453154-fdec-4d6b-9c34-cb35c248ae5b.png) - ## 🚀 Project Structure Inside of your Astro project, you'll see the following folders and files: diff --git a/examples/framework-alpine/README.md b/examples/framework-alpine/README.md index 3bd88aa01..9c61ea1b0 100644 --- a/examples/framework-alpine/README.md +++ b/examples/framework-alpine/README.md @@ -9,4 +9,3 @@ npm create astro@latest -- --template framework-alpine [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/framework-alpine/devcontainer.json) This example showcases Astro working with [AlpineJS](https://alpinejs.dev/). - diff --git a/examples/framework-lit/README.md b/examples/framework-lit/README.md index 830822fd4..9afdb987c 100644 --- a/examples/framework-lit/README.md +++ b/examples/framework-lit/README.md @@ -8,4 +8,4 @@ npm create astro@latest -- --template framework-lit [![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/framework-lit) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/framework-lit/devcontainer.json) -This example showcases Astro working with [Lit](https://lit.dev/). \ No newline at end of file +This example showcases Astro working with [Lit](https://lit.dev/). diff --git a/examples/framework-vue/README.md b/examples/framework-vue/README.md index bc311c9dd..07f94e1c3 100644 --- a/examples/framework-vue/README.md +++ b/examples/framework-vue/README.md @@ -9,4 +9,3 @@ npm create astro@latest -- --template framework-vue [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/framework-vue/devcontainer.json) This example showcases Astro working with [Vue](https://v3.vuejs.org/). - diff --git a/examples/integration/README.md b/examples/integration/README.md index f40c3dbd0..a6709d400 100644 --- a/examples/integration/README.md +++ b/examples/integration/README.md @@ -10,7 +10,6 @@ npm create astro@latest -- --template integration [![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/integration) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/integration/devcontainer.json) - ## 🚀 Project Structure Inside of your Astro project, you'll see the following folders and files: @@ -25,9 +24,10 @@ Inside of your Astro project, you'll see the following folders and files: The `index.ts` file is the "entry point" for your integration. Export your integration in `index.ts` to make them importable from your package. ## 🧞 Commands + All commands are run from the root of the project, from a terminal: -| Command | Action | -| :--------------------- | :----------------------------------------------- | -| `npm link` | Registers this package locally. Run `npm link my-integration` in an Astro project to install your integration -| `npm publish` | [Publishes](https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages#publishing-unscoped-public-packages) this package to NPM. Requires you to be [logged in](https://docs.npmjs.com/cli/v8/commands/npm-adduser) +| Command | Action | +| :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `npm link` | Registers this package locally. Run `npm link my-integration` in an Astro project to install your integration | +| `npm publish` | [Publishes](https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages#publishing-unscoped-public-packages) this package to NPM. Requires you to be [logged in](https://docs.npmjs.com/cli/v8/commands/npm-adduser) | diff --git a/examples/portfolio/README.md b/examples/portfolio/README.md index cc9cdd5e3..7ca90501a 100644 --- a/examples/portfolio/README.md +++ b/examples/portfolio/README.md @@ -12,7 +12,6 @@ npm create astro@latest -- --template portfolio ![portfolio](https://user-images.githubusercontent.com/357379/210779178-a98f0fb7-6b1a-4068-894c-8e1403e26654.jpg) - ## 🧞 Commands All commands are run from the root of the project, from a terminal: diff --git a/package.json b/package.json index 26a48fc80..b65d19e88 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "only-allow": "^1.1.1", "organize-imports-cli": "^0.10.0", "prettier": "^2.8.8", - "prettier-plugin-astro": "^0.8.1", + "prettier-plugin-astro": "^0.10.0", "tiny-glob": "^0.2.9", "turbo": "^1.10.3", "typescript": "~5.0.2" diff --git a/packages/astro-prism/README.md b/packages/astro-prism/README.md index 1e8e92fa2..f5627d062 100644 --- a/packages/astro-prism/README.md +++ b/packages/astro-prism/README.md @@ -8,7 +8,7 @@ This package exports a component to support highlighting inside an Astro file. E ```astro --- -import { Prism } from "@astrojs/prism" +import { Prism } from '@astrojs/prism'; --- @@ -21,11 +21,14 @@ This package exports a `runHighlighterWithAstro` function to highlight while mak ```typescript import { runHighlighterWithAstro } from '@astrojs/prism'; -runHighlighterWithAstro(` +runHighlighterWithAstro( + ` --- const helloAstro = 'Hello, Astro!'; ---

{helloAstro}
-`, 'astro'); +`, + 'astro' +); ``` diff --git a/packages/astro-rss/README.md b/packages/astro-rss/README.md index 43adaad92..47dfc1747 100644 --- a/packages/astro-rss/README.md +++ b/packages/astro-rss/README.md @@ -36,14 +36,14 @@ export async function get(context) { // Pull in your project "site" from the endpoint context // https://docs.astro.build/en/reference/api-reference/#contextsite site: context.site, - items: posts.map(post => ({ + items: posts.map((post) => ({ // Assumes all RSS feed item properties are in post frontmatter ...post.data, // Generate a `url` from each post `slug` // This assumes all blog posts are rendered as `/blog/[slug]` routes // https://docs.astro.build/en/guides/content-collections/#generating-pages-from-content-collections link: `/blog/${post.slug}/`, - })) + })), }); } ``` @@ -180,9 +180,10 @@ By default, the library will add trailing slashes to the emitted URLs. To preven ```js import rss from '@astrojs/rss'; -export const get = () => rss({ - trailingSlash: false -}); +export const get = () => + rss({ + trailingSlash: false, + }); ``` ## `RSSFeedItem` @@ -193,12 +194,13 @@ An example feed item might look like: ```js const item = { - title: "Alpha Centauri: so close you can touch it", - link: "/blog/alpha-centuari", - pubDate: new Date("2023-06-04"), - description: "Alpha Centauri is a triple star system, containing Proxima Centauri, the closest star to our sun at only 4.24 light-years away.", - categories: ["stars", "space"] -} + title: 'Alpha Centauri: so close you can touch it', + link: '/blog/alpha-centuari', + pubDate: new Date('2023-06-04'), + description: + 'Alpha Centauri is a triple star system, containing Proxima Centauri, the closest star to our sun at only 4.24 light-years away.', + categories: ['stars', 'space'], +}; ``` ### `title` @@ -259,15 +261,16 @@ An object that defines the `title` and `url` of the original feed for items that ```js const item = { - title: "Alpha Centauri: so close you can touch it", - link: "/blog/alpha-centuari", - pubDate: new Date("2023-06-04"), - description: "Alpha Centauri is a triple star system, containing Proxima Centauri, the closest star to our sun at only 4.24 light-years away.", - source: { - title: "The Galactic Times", - url: "https://galactictimes.space/feed.xml" - } -} + title: 'Alpha Centauri: so close you can touch it', + link: '/blog/alpha-centuari', + pubDate: new Date('2023-06-04'), + description: + 'Alpha Centauri is a triple star system, containing Proxima Centauri, the closest star to our sun at only 4.24 light-years away.', + source: { + title: 'The Galactic Times', + url: 'https://galactictimes.space/feed.xml', + }, +}; ``` #### `source.title` @@ -290,16 +293,17 @@ An object to specify properties for an included media source (e.g. a podcast) wi ```js const item = { - title: "Alpha Centauri: so close you can touch it", - link: "/blog/alpha-centuari", - pubDate: new Date("2023-06-04"), - description: "Alpha Centauri is a triple star system, containing Proxima Centauri, the closest star to our sun at only 4.24 light-years away.", - enclosure: { - url: "/media/alpha-centauri.aac", + title: 'Alpha Centauri: so close you can touch it', + link: '/blog/alpha-centuari', + pubDate: new Date('2023-06-04'), + description: + 'Alpha Centauri is a triple star system, containing Proxima Centauri, the closest star to our sun at only 4.24 light-years away.', + enclosure: { + url: '/media/alpha-centauri.aac', length: 124568, - type: "audio/aac" - } -} + type: 'audio/aac', + }, +}; ``` #### `enclosure.url` @@ -361,9 +365,7 @@ export async function get(context) { title: 'Buzz’s Blog', description: 'A humble Astronaut’s guide to the stars', site: context.site, - items: await pagesGlobToRssItems( - import.meta.glob('./blog/*.{md,mdx}'), - ), + items: await pagesGlobToRssItems(import.meta.glob('./blog/*.{md,mdx}')), }); } ``` diff --git a/packages/astro/README.md b/packages/astro/README.md index ebd4ca3c7..9e3ff67c3 100644 --- a/packages/astro/README.md +++ b/packages/astro/README.md @@ -8,10 +8,8 @@

- ## Install - ```bash # Recommended! npm create astro@latest @@ -20,7 +18,7 @@ npm create astro@latest npm install --save-dev astro ``` -Looking for help? Start with our [Getting Started](https://docs.astro.build/en/getting-started/) guide. +Looking for help? Start with our [Getting Started](https://docs.astro.build/en/getting-started/) guide. Looking for quick examples? [Open a starter project](https://astro.new/) right in your browser. @@ -31,9 +29,10 @@ Visit our [official documentation](https://docs.astro.build/). ## Support Having trouble? Get help in the official [Astro Discord](https://astro.build/chat). + ## Contributing -**New contributors welcome!** Check out our [Contributors Guide](/CONTRIBUTING.md) for help getting started. +**New contributors welcome!** Check out our [Contributors Guide](/CONTRIBUTING.md) for help getting started. Join us on [Discord](https://astro.build/chat) to meet other maintainers. We'll help you get your first contribution in no time! @@ -42,5 +41,3 @@ Join us on [Discord](https://astro.build/chat) to meet other maintainers. We'll Astro is generously supported by [Netlify](https://www.netlify.com/), [Vercel](https://vercel.com/), and several other amazing organizations [listed here.](https://astro.build/) [❤️ Sponsor Astro! ❤️](https://github.com/withastro/.github/blob/main/FUNDING.md) - - diff --git a/packages/astro/src/core/build/plugins/README.md b/packages/astro/src/core/build/plugins/README.md index 32ac8c448..145158163 100644 --- a/packages/astro/src/core/build/plugins/README.md +++ b/packages/astro/src/core/build/plugins/README.md @@ -2,12 +2,11 @@ This file serves as developer documentation to explain how the internal plugins work - ## `plugin-middleware` This plugin is responsible to retrieve the `src/middleware.{ts.js}` file and emit an entry point during the SSR build. -The final file is emitted only if the user has the middleware file. The final name of the file is `middleware.mjs`. +The final file is emitted only if the user has the middleware file. The final name of the file is `middleware.mjs`. This is **not** a virtual module. The plugin will try to resolve the physical file. @@ -20,7 +19,12 @@ The emitted file is called `renderers.mjs`. The emitted file has content similar to: ```js -const renderers = [Object.assign({"name":"astro:jsx","serverEntrypoint":"astro/jsx/server.js","jsxImportSource":"astro"}, { ssr: server_default }),]; +const renderers = [ + Object.assign( + { name: 'astro:jsx', serverEntrypoint: 'astro/jsx/server.js', jsxImportSource: 'astro' }, + { ssr: server_default } + ), +]; export { renderers }; ``` @@ -32,19 +36,20 @@ This plugin is responsible to collect all pages inside an Astro application, and This plugin **will emit code** only when building a static site. In order to achieve that, the plugin emits these pages as **virtual modules**. Doing so allows us to bypass: + - rollup resolution of the files - possible plugins that get triggered when the name of the module has an extension e.g. `.astro` The plugin does the following operations: + - loop through all the pages and collects their paths; - with each path, we create a new [string](#plugin-pages-mapping-resolution) that will serve and virtual module for that particular page - when resolving the page, we check if the `id` of the module starts with `@astro-page` - once the module is resolved, we emit [the code of the module](#plugin-pages-code-generation) - ### `plugin pages` mapping resolution -The mapping is as follows: +The mapping is as follows: ``` src/pages/index.astro => @astro-page:src/pages/index@_@astro @@ -53,14 +58,13 @@ src/pages/index.astro => @astro-page:src/pages/index@_@astro 1. We add a fixed prefix, which is used as virtual module naming convention; 2. We replace the dot that belongs extension with an arbitrary string. -This kind of patterns will then allow us to retrieve the path physical path of the +This kind of patterns will then allow us to retrieve the path physical path of the file back from that string. This is important for the [code generation](#plugin-pages-code-generation) - - ### `plugin pages` code generation When generating the code of the page, we will import and export the following modules: + - the `renderers.mjs` - the `middleware.mjs` - the page, via dynamic import @@ -79,6 +83,7 @@ export { middleware, page }; ``` If we have a `pages/` folder that looks like this: + ``` ├── blog │ ├── first.astro @@ -89,8 +94,9 @@ If we have a `pages/` folder that looks like this: └── second.astro ``` -The emitted entry points will be stored inside a `pages/` folder, and they +The emitted entry points will be stored inside a `pages/` folder, and they will look like this: + ``` ├── _astro │ ├── first.132e69e0.css @@ -117,7 +123,7 @@ will look like this: └── renderers.mjs ``` -Of course, all these files will be deleted by Astro at the end build. +Of course, all these files will be deleted by Astro at the end build. ## `plugin-ssr` (WIP) @@ -130,15 +136,14 @@ The plugin will collect all the [virtual pages](#plugin-pages) and create a JavaScript `Map`. These map will look like this: ```js -const _page$0 = () => import("../chunks/.mjs") -const _page$1 = () => import("../chunks/.mjs") +const _page$0 = () => import('../chunks/.mjs'); +const _page$1 = () => import('../chunks/.mjs'); const pageMap = new Map([ - ["src/pages/index.astro", _page$0], - ["src/pages/about.astro", _page$1], -]) + ['src/pages/index.astro', _page$0], + ['src/pages/about.astro', _page$1], +]); ``` It will also import the [`renderers`](#plugin-renderers) virtual module and the [`middleware`](#plugin-middleware) virtual module. - diff --git a/packages/astro/src/core/errors/README.md b/packages/astro/src/core/errors/README.md index 2e6ffb3ae..789afd73e 100644 --- a/packages/astro/src/core/errors/README.md +++ b/packages/astro/src/core/errors/README.md @@ -9,30 +9,36 @@ **Error Format** Name (key of the object definition): + - As with the error code, this property is a static reference to the error. The shape should be similar to JavaScript's native errors (TypeError, ReferenceError): pascal-cased, no spaces, no special characters etc. (ex: `ClientAddressNotAvailable`) - This is the only part of the error message that should not be written as a full, proper sentence complete with Capitalization and end punctuation. Title: + - Use this property to briefly describe the error in a few words. This is the user's way to see at a glance what has happened and will be prominently displayed in the UI (ex: `{feature} is not available in static mode.`) Do not include further details such as why this error occurred or possible solutions. Message: + - Begin with **what happened** and **why**. (ex: `Could not use {feature} because Server⁠-⁠side Rendering is not enabled.`) - Then, **describe the action the user should take**. (ex: `Update your Astro config with `output: 'server'` to enable Server⁠-⁠side Rendering.`) - Although this does not need to be as brief as the `title`, try to keep sentences short, clear and direct to give the reader all the necessary information quickly as possible. - Instead of writing a longer message, consider using a `hint`. Hint: + - A `hint` can be used for any additional info that might help the user. (ex: a link to the documentation, or a common cause) **Writing Style** + - Write in proper sentences. Include periods at the end of sentences. Avoid using exclamation marks! (Leave them to Houston!) - Technical jargon is mostly okay! But, most abbreviations should be avoided. If a developer is unfamiliar with a technical term, spelling it out in full allows them to look it up on the web more easily. -- Describe the _what_, _why_ and _action to take_ from the user's perspective. Assume they don't know Astro internals, and care only about how Astro is _used_. (ex: `You are missing...` vs `Astro/file cannot find...`) +- Describe the _what_, _why_ and _action to take_ from the user's perspective. Assume they don't know Astro internals, and care only about how Astro is _used_. (ex: `You are missing...` vs `Astro/file cannot find...`) - Avoid using cutesy language. (ex: Oops!) This tone minimizes the significance of the error, which _is_ important to the developer. The developer may be frustrated and your error message shouldn't be making jokes about their struggles. Only include words and phrases that help the developer **interpret the error** and **fix the problem**. **Choosing an Error Code** Choose any available error code in the appropriate range: + - 01xxx and 02xxx are reserved for compiler errors and warnings respectively - 03xxx: Astro errors (your error most likely goes here!) - 04xxx: Vite errors @@ -49,17 +55,19 @@ Users are not reading codes sequentially. They're much more likely to directly l If you are unsure about which error code to choose, ask [Erika](https://github.com/Princesseuh)! ### CLI specifics tips: + - If the error happened **during an action that changes the state of the project** (ex: editing configuration, creating files), the error should **reassure the user** about the state of their project (ex: "Failed to update configuration. Your project has been restored to its previous state.") - If an "error" happened because of a conscious user action (ex: pressing CTRL+C during a choice), it is okay to add more personality (ex: "Operation cancelled. See you later, astronaut!"). Do keep in mind the previous point however (ex: "Operation cancelled. No worries, your project folder has already been created") ### Shape + - **Error codes and names are permanent**, and should never be changed, nor deleted. Users should always be able to find an error by searching, and this ensures a matching result. When an error is no longer relevant, it should be deprecated, not removed. - Contextual information may be used to enhance the message or the hint. However, the code that caused the error or the position of the error should not be included in the message as they will already be shown as part of the error. - Do not prefix `title`, `message` and `hint` with descriptive words such as "Error:" or "Hint:" as it may lead to duplicated labels in the UI / CLI. - Dynamic error messages must use the following shape: ```js -message: (arguments) => `text ${substitute}` +message: (arguments) => `text ${substitute}`; ``` Please avoid including too much logic inside the errors if you can. The last thing you want is for a bug to happen inside what's already an error! @@ -76,22 +84,24 @@ Here's how to create and format the comments: ```js /** - * @docs <- Needed for the comment to be used for docs - * @message <- (Optional) Clearer error message to show in cases where the original one is too complex (ex: because of conditional messages) - * @see <- List of additional references users can look at - * @description <- Description of the error - */ + * @docs <- Needed for the comment to be used for docs + * @message <- (Optional) Clearer error message to show in cases where the original one is too complex (ex: because of conditional messages) + * @see <- List of additional references users can look at + * @description <- Description of the error + */ ``` + Example: + ```js /** - * @docs - * @message Route returned a `returnedValue`. Only a Response can be returned from Astro files. - * @see - * - [Response](https://docs.astro.build/en/guides/server-side-rendering/#response) - * @description - * Only instances of [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) can be returned inside Astro files. - */ + * @docs + * @message Route returned a `returnedValue`. Only a Response can be returned from Astro files. + * @see + * - [Response](https://docs.astro.build/en/guides/server-side-rendering/#response) + * @description + * Only instances of [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) can be returned inside Astro files. + */ ``` The `@message` property is intended to provide slightly more context when it is helpful: a more descriptive error message or a collection of common messages if there are multiple possible error messages. Try to avoid making substantial changes to existing messages so that they are easy to find for users who copy and search the exact content of an error message. diff --git a/packages/astro/src/vite-plugin-config-alias/README.md b/packages/astro/src/vite-plugin-config-alias/README.md index 85971c90a..3b470aded 100644 --- a/packages/astro/src/vite-plugin-config-alias/README.md +++ b/packages/astro/src/vite-plugin-config-alias/README.md @@ -18,9 +18,9 @@ Consider the following example configuration: With this configuration, the following imports would map to the same location. ```js -import Test from '../components/Test.astro' +import Test from '../components/Test.astro'; -import Test from 'components/Test.astro' +import Test from 'components/Test.astro'; -import Test from 'components:Test' +import Test from 'components:Test'; ``` diff --git a/packages/create-astro/README.md b/packages/create-astro/README.md index 0b0c9813c..5341d60f0 100644 --- a/packages/create-astro/README.md +++ b/packages/create-astro/README.md @@ -26,6 +26,7 @@ npm create astro@latest my-astro-project -- --template minimal # yarn yarn create astro my-astro-project --template minimal ``` + [Check out the full list][examples] of example templates, available on GitHub. You can also use any GitHub repo as a template: @@ -38,16 +39,16 @@ npm create astro@latest my-astro-project -- --template cassidoo/shopify-react-as May be provided in place of prompts -| Name | Description | -|:-------------|:----------------------------------------------------| -| `--template ` | Specify your template. | -| `--install` / `--no-install` | Install dependencies (or not). | -| `--git` / `--no-git` | Initialize git repo (or not). | -| `--yes` (`-y`) | Skip all prompt by accepting defaults. | -| `--no` (`-n`) | Skip all prompt by declining defaults. | -| `--dry-run` | Walk through steps without executing. | -| `--skip-houston` | Skip Houston animation. | -| `--typescript
` or ``. This behavior can be changed in your `astro.config.*` file to use a custom query selector when finding prefetch links. -__`astro.config.mjs`__ +By default the prefetch script searches the page for any links that include a `rel="prefetch"` attribute, ex: `` or ``. This behavior can be changed in your `astro.config.*` file to use a custom query selector when finding prefetch links. + +**`astro.config.mjs`** ```js import { defineConfig } from 'astro/config'; @@ -72,17 +73,20 @@ import prefetch from '@astrojs/prefetch'; export default defineConfig({ // ... - integrations: [prefetch({ - // Only prefetch links with an href that begins with `/products` - selector: "a[href^='/products']" - })], + integrations: [ + prefetch({ + // Only prefetch links with an href that begins with `/products` + selector: "a[href^='/products']", + }), + ], }); ``` + ### config.throttle - + By default the prefetch script will only prefetch one link at a time. This behavior can be changed in your `astro.config.*` file to increase the limit for concurrent downloads. -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js import { defineConfig } from 'astro/config'; @@ -90,14 +94,17 @@ import prefetch from '@astrojs/prefetch'; export default defineConfig({ // ... - integrations: [prefetch({ - // Allow up to three links to be prefetched concurrently - throttle: 3 - })], + integrations: [ + prefetch({ + // Allow up to three links to be prefetched concurrently + throttle: 3, + }), + ], }); ``` ## Troubleshooting + - If your installation doesn't seem to be working, try restarting the dev server. - If a link doesn't seem to be prefetching, make sure that the link is pointing to a page on the same domain and matches the integration's `selector` option. diff --git a/packages/integrations/react/README.md b/packages/integrations/react/README.md index 61f9b1418..68daef6e4 100644 --- a/packages/integrations/react/README.md +++ b/packages/integrations/react/README.md @@ -9,6 +9,7 @@ There are two ways to add integrations to your project. Let's try the most conve ### `astro add` command Astro includes a CLI tool for adding first party integrations: `astro add`. This command will: + 1. (Optionally) Install all necessary dependencies and peer dependencies 2. (Also optionally) Update your `astro.config.*` file to apply this integration @@ -41,7 +42,7 @@ npm install react react-dom Now, apply this integration to your `astro.config.*` file using the `integrations` property: -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js ins={2} "react()" import { defineConfig } from 'astro/config'; @@ -56,6 +57,7 @@ export default defineConfig({ ## Getting started To use your first React component in Astro, head to our [UI framework documentation][astro-ui-frameworks]. You'll explore: + - 📦 how framework components are loaded, - 💧 client-side hydration options, and - 🤝 opportunities to mix and nest frameworks together diff --git a/packages/integrations/sitemap/README.md b/packages/integrations/sitemap/README.md index cb532f7b9..80ea96288 100644 --- a/packages/integrations/sitemap/README.md +++ b/packages/integrations/sitemap/README.md @@ -2,7 +2,6 @@ This **[Astro integration][astro-integration]** generates a sitemap based on your routes when you build your Astro project. - - [Why Astro Sitemap](#why-astro-sitemap) - [Installation](#installation) - [Usage](#usage) @@ -23,9 +22,9 @@ With Astro Sitemap, you don't have to worry about creating this file: build your ## Installation ### Quick Install - + The `astro add` command-line tool automates the installation for you. Run one of the following commands in a new terminal window. (If you aren't sure which package manager you're using, run the first command.) Then, follow the prompts, and type "y" in the terminal (meaning "yes") for each one. - + ```sh # Using NPM npx astro add sitemap @@ -34,18 +33,20 @@ yarn astro add sitemap # Using PNPM pnpm astro add sitemap ``` - + If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Manual Install - + First, install the `@astrojs/sitemap` package using your package manager. If you're using npm or aren't sure, run this in the terminal: + ```sh npm install @astrojs/sitemap ``` + Then, apply this integration to your `astro.config.*` file using the `integrations` property: -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js ins={2} "sitemap()" import { defineConfig } from 'astro/config'; @@ -54,15 +55,14 @@ import sitemap from '@astrojs/sitemap'; export default defineConfig({ // ... integrations: [sitemap()], -}) +}); ``` - ## Usage `@astrojs/sitemap` requires a deployment / site URL for generation. Add your site's URL under your `astro.config.*` using the `site` property. This must begin with `http:` or `https:`. -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js import { defineConfig } from 'astro/config'; @@ -72,7 +72,7 @@ export default defineConfig({ // ... site: 'https://stargazers.club', integrations: [sitemap()], -}) +}); ``` Note that unlike other configuration options, `site` is set in the root `defineConfig` object, rather than inside the `sitemap()` call. @@ -87,11 +87,11 @@ After verifying that the sitemaps are built, you can add them to your site's ` - + ``` -```yaml ins={4} title="public/robots.txt" +```txt ins={4} title="public/robots.txt" User-agent: * Allow: / @@ -129,66 +129,69 @@ Sitemap: https:///sitemap-index.xml To configure this integration, pass an object to the `sitemap()` function call in `astro.config.mjs`. -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; export default defineConfig({ - integrations: [sitemap({ - filter: ... - })] + integrations: [ + sitemap({ + // configuration options + }), + ], }); ``` ### filter - -All pages are included in your sitemap by default. By adding a custom `filter` function, you can filter included pages by URL. -__`astro.config.mjs`__ +All pages are included in your sitemap by default. By adding a custom `filter` function, you can filter included pages by URL. + +**`astro.config.mjs`** ```js -... - sitemap({ - filter: (page) => page !== 'https://stargazers.club/secret-vip-lounge' - }), +// ... +sitemap({ + filter: (page) => page !== 'https://stargazers.club/secret-vip-lounge', +}); ``` The function will be called for every page on your site. The `page` function parameter is the full URL of the page currently under considering, including your `site` domain. Return `true` to include the page in your sitemap, and `false` to leave it out. To filter multiple pages, add arguments with target URLs. -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js -... - sitemap({ - filter: (page) => - page !== "https://stargazers.club/secret-vip-lounge-1" && - page !== "https://stargazers.club/secret-vip-lounge-2" && - page !== "https://stargazers.club/secret-vip-lounge-3" && - page !== "https://stargazers.club/secret-vip-lounge-4", - }), +// ... +sitemap({ + filter: (page) => + page !== 'https://stargazers.club/secret-vip-lounge-1' && + page !== 'https://stargazers.club/secret-vip-lounge-2' && + page !== 'https://stargazers.club/secret-vip-lounge-3' && + page !== 'https://stargazers.club/secret-vip-lounge-4', +}); ``` - + ### customPages - + In some cases, a page might be part of your deployed site but not part of your Astro project. If you'd like to include a page in your sitemap that _isn't_ created by Astro, you can use this option. -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js -... - sitemap({ - customPages: ['https://stargazers.club/external-page', 'https://stargazers.club/external-page2'] - }), +// ... +sitemap({ + customPages: ['https://stargazers.club/external-page', 'https://stargazers.club/external-page2'], +}); ``` + ### entryLimit The maximum number entries per sitemap file. The default value is 45000. A sitemap index and multiple sitemaps are created if you have more entries. See this [explanation of splitting up a large sitemap](https://developers.google.com/search/docs/advanced/sitemaps/large-sitemaps). -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js import { defineConfig } from 'astro/config'; @@ -208,12 +211,12 @@ export default defineConfig({ These options correspond to the ``, ``, and `` tags in the [Sitemap XML specification.](https://www.sitemaps.org/protocol.html) -Note that `changefreq` and `priority` are ignored by Google. +Note that `changefreq` and `priority` are ignored by Google. > **Note** > Due to limitations of Astro's [Integration API](https://docs.astro.build/en/reference/integrations-reference/), this integration can't analyze a given page's source code. This configuration option can set `changefreq`, `lastmod` and `priority` on a _site-wide_ basis; see the next option **serialize** for how you can set these values on a per-page basis. -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js import { defineConfig } from 'astro/config'; @@ -236,21 +239,22 @@ export default defineConfig({ A function called for each sitemap entry just before writing to a disk. This function can be asynchronous. It receives as its parameter a `SitemapItem` object that can have these properties: - - `url` (absolute page URL). This is the only property that is guaranteed to be on `SitemapItem`. - - `changefreq` - - `lastmod` (ISO formatted date, `String` type) - - `priority` - - `links`. -This `links` property contains a `LinkItem` list of alternate pages including a parent page. +- `url` (absolute page URL). This is the only property that is guaranteed to be on `SitemapItem`. +- `changefreq` +- `lastmod` (ISO formatted date, `String` type) +- `priority` +- `links`. + +This `links` property contains a `LinkItem` list of alternate pages including a parent page. The `LinkItem` type has two fields: `url` (the fully-qualified URL for the version of this page for the specified language) and `lang` (a supported language code targeted by this version of the page). -The `serialize` function should return `SitemapItem`, touched or not. +The `serialize` function should return `SitemapItem`, touched or not. The example below shows the ability to add sitemap specific properties individually. -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js import { defineConfig } from 'astro/config'; @@ -283,13 +287,13 @@ To localize a sitemap, pass an object to this `i18n` option. This object has two required properties: - `defaultLocale`: `String`. Its value must exist as one of `locales` keys. -- `locales`: `Record`, key/value - pairs. The key is used to look for a locale part in a page path. The value is a language attribute, only English alphabet and hyphen allowed. +- `locales`: `Record`, key/value - pairs. The key is used to look for a locale part in a page path. The value is a language attribute, only English alphabet and hyphen allowed. [Read more about language attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang). [Read more about localization](https://developers.google.com/search/docs/advanced/crawling/localized-versions#all-method-guidelines). -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js import { defineConfig } from 'astro/config'; @@ -298,11 +302,11 @@ import sitemap from '@astrojs/sitemap'; export default defineConfig({ site: 'https://stargazers.club', integrations: [ - sitemap({ + sitemap({ i18n: { - defaultLocale: 'en', // All urls that don't contain `es` or `fr` after `https://stargazers.club/` will be treated as default locale, i.e. `en` + defaultLocale: 'en', // All urls that don't contain `es` or `fr` after `https://stargazers.club/` will be treated as default locale, i.e. `en` locales: { - en: 'en-US', // The `defaultLocale` value must present in `locales` keys + en: 'en-US', // The `defaultLocale` value must present in `locales` keys es: 'es-ES', fr: 'fr-CA', }, @@ -344,9 +348,10 @@ The resulting sitemap looks like this: ``` ## Examples + - The official Astro website uses Astro Sitemap to generate [its sitemap](https://astro.build/sitemap-index.xml). - The [integrations playground template](https://github.com/withastro/astro/tree/latest/examples/integrations-playground?on=github) comes with Astro Sitemap installed. Try adding a route and building the project! -- [Browse projects with Astro Sitemap on GitHub](https://github.com/search?q=%22@astrojs/sitemap%22+filename:package.json&type=Code) for more examples! +- [Browse projects with Astro Sitemap on GitHub](https://github.com/search?q=%22@astrojs/sitemap%22+filename:package.json&type=Code) for more examples! ## Troubleshooting diff --git a/packages/integrations/solid/README.md b/packages/integrations/solid/README.md index 338951bf2..e9f123f14 100644 --- a/packages/integrations/solid/README.md +++ b/packages/integrations/solid/README.md @@ -9,6 +9,7 @@ There are two ways to add integrations to your project. Let's try the most conve ### `astro add` command Astro includes a CLI tool for adding first party integrations: `astro add`. This command will: + 1. (Optionally) Install all necessary dependencies and peer dependencies 2. (Also optionally) Update your `astro.config.*` file to apply this integration @@ -41,21 +42,22 @@ npm install solid-js Now, apply this integration to your `astro.config.*` file using the `integrations` property: -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js ins={2} "solid()" import { defineConfig } from 'astro/config'; import solid from '@astrojs/solid-js'; export default defineConfig({ - // ... - integrations: [solid()], + // ... + integrations: [solid()], }); ``` ## Getting started To use your first SolidJS component in Astro, head to our [UI framework documentation][astro-ui-frameworks]. You'll explore: + - 📦 how framework components are loaded, - 💧 client-side hydration options, and - 🤝 opportunities to mix and nest frameworks together diff --git a/packages/integrations/svelte/README.md b/packages/integrations/svelte/README.md index 1c8b98b82..70e14ebb8 100644 --- a/packages/integrations/svelte/README.md +++ b/packages/integrations/svelte/README.md @@ -9,6 +9,7 @@ There are two ways to add integrations to your project. Let's try the most conve ### `astro add` command Astro includes a CLI tool for adding first party integrations: `astro add`. This command will: + 1. (Optionally) Install all necessary dependencies and peer dependencies 2. (Also optionally) Update your `astro.config.*` file to apply this integration @@ -41,7 +42,7 @@ npm install svelte Now, apply this integration to your `astro.config.*` file using the `integrations` property: -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js ins={2} "svelte()" import { defineConfig } from 'astro/config'; @@ -56,6 +57,7 @@ export default defineConfig({ ## Getting started To use your first Svelte component in Astro, head to our [UI framework documentation][astro-ui-frameworks]. You'll explore: + - 📦 how framework components are loaded, - 💧 client-side hydration options, and - 🤝 opportunities to mix and nest frameworks together @@ -85,7 +87,7 @@ This integration passes the following default options to the Svelte compiler: const defaultOptions = { emitCss: true, compilerOptions: { dev: isDev, hydratable: true }, - preprocess: vitePreprocess() + preprocess: vitePreprocess(), }; ``` @@ -95,7 +97,7 @@ Providing your own `preprocess` options **will** override the [`vitePreprocess() You can set options either by passing them to the `svelte` integration in `astro.config.mjs` or in `svelte.config.js`. Either of these would override the default `preprocess` setting: -__`astro.config.mjs`__ +**`astro.config.mjs`** ```js import { defineConfig } from 'astro/config'; @@ -106,7 +108,7 @@ export default defineConfig({ }); ``` -__`svelte.config.js`__ +**`svelte.config.js`** ```js export default { @@ -120,7 +122,7 @@ export default { If you're using a preprocessor like TypeScript or SCSS in your Svelte files, you can create a `svelte.config.js` file so that the Svelte IDE extension can correctly parse the Svelte files. -__`svelte.config.js`__ +**`svelte.config.js`** ```js import { vitePreprocess } from '@astrojs/svelte'; diff --git a/packages/integrations/tailwind/README.md b/packages/integrations/tailwind/README.md index f0595dbe5..fb62efade 100644 --- a/packages/integrations/tailwind/README.md +++ b/packages/integrations/tailwind/README.md @@ -17,20 +17,18 @@ Tailwind lets you use utility classes instead of writing CSS. These utility clas If you don't like those predefined settings, you can [customize the Tailwind configuration file](https://tailwindcss.com/docs/configuration) to your project's design requirements. For example, if the "large text" in your design is actually `2rem`, you can [change the `lg` fontSize setting](https://tailwindcss.com/docs/font-size#customizing-your-theme) to `2rem`. -Tailwind is also a great choice to add styles to React, Preact, or Solid components, which don't support a `