From ec249f7a983926ba89248a3cc88cb1100a85168f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elian=20=E2=98=95=EF=B8=8F?= Date: Thu, 28 Sep 2023 15:48:03 +0200 Subject: [PATCH] update all the readme's for expressive code (#8691) Co-authored-by: HiDeoo Co-authored-by: Genteure Co-authored-by: Bryce Russell Co-authored-by: Reuben Tier Co-authored-by: Hippo Co-authored-by: Sarah Rainsberger Co-authored-by: Kevin Zuniga Cuellar --- packages/integrations/alpinejs/README.md | 5 +- packages/integrations/cloudflare/README.md | 94 +++++++++++----------- packages/integrations/lit/README.md | 37 +++++---- packages/integrations/markdoc/README.md | 35 ++++---- packages/integrations/mdx/README.md | 17 ++-- packages/integrations/node/README.md | 53 ++++++------ packages/integrations/partytown/README.md | 21 ++--- packages/integrations/preact/README.md | 10 ++- packages/integrations/prefetch/README.md | 17 ++-- packages/integrations/react/README.md | 18 +++-- packages/integrations/sitemap/README.md | 37 ++++----- packages/integrations/solid/README.md | 18 +++-- packages/integrations/svelte/README.md | 17 ++-- packages/integrations/tailwind/README.md | 37 ++++----- packages/integrations/vercel/README.md | 16 ++-- packages/integrations/vue/README.md | 17 ++-- 16 files changed, 237 insertions(+), 212 deletions(-) diff --git a/packages/integrations/alpinejs/README.md b/packages/integrations/alpinejs/README.md index 29b2e5b09..b90ad65a8 100644 --- a/packages/integrations/alpinejs/README.md +++ b/packages/integrations/alpinejs/README.md @@ -67,7 +67,10 @@ The Alpine.js integration does not give you control over how the script is loade **It is not currently possible to [extend Alpine.js](https://alpinejs.dev/advanced/extending) when using this component.** If you need this feature, consider following [the manual Alpine.js setup](https://alpinejs.dev/essentials/installation) instead using an Astro script tag: -```astro title="src/pages/index.astro" +```astro +--- +// src/pages/index.astro +--- + ``` @@ -79,7 +80,7 @@ export default defineConfig({ integrations: [ partytown({ config: { - //options go here + // options go here }, }), ], diff --git a/packages/integrations/preact/README.md b/packages/integrations/preact/README.md index 752cb1adf..ff708bd5e 100644 --- a/packages/integrations/preact/README.md +++ b/packages/integrations/preact/README.md @@ -53,14 +53,15 @@ npm install preact Then, apply this integration to your `astro.config.*` file using the `integrations` property: -```js ins={3} "preact()" +```diff lang="js" "preact()" // astro.config.mjs import { defineConfig } from 'astro/config'; -import preact from '@astrojs/preact'; ++ import preact from '@astrojs/preact'; export default defineConfig({ // ... integrations: [preact()], + // ^^^^^^^^ }); ``` @@ -93,6 +94,7 @@ import preact from '@astrojs/preact'; export default defineConfig({ integrations: [preact({ compat: true })], + // ^^^^^^^^^^^^ }); ``` @@ -100,8 +102,7 @@ With the `compat` option enabled, the Preact integration will render React compo When importing React component libraries, in order to swap out the `react` and `react-dom` dependencies as `preact/compat`, you can use [`overrides`](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides) to do so. -```json -// package.json +```json title="package.json" { "overrides": { "react": "npm:@preact/compat@latest", @@ -126,6 +127,7 @@ Use the `include` (required) and `exclude` (optional) configuration options to s We recommend placing common framework components in the same folder (e.g. `/components/react/` and `/components/solid/`) to make specifying your includes easier, but this is not required: ```js +// astro.config.mjs import { defineConfig } from 'astro/config'; import preact from '@astrojs/preact'; import react from '@astrojs/react'; diff --git a/packages/integrations/prefetch/README.md b/packages/integrations/prefetch/README.md index 5ba1d1ffe..82a608edd 100644 --- a/packages/integrations/prefetch/README.md +++ b/packages/integrations/prefetch/README.md @@ -41,15 +41,16 @@ npm install @astrojs/prefetch Then, apply this integration to your `astro.config.*` file using the `integrations` property: -```js ins={3} "prefetch()" -// astro.config.mjs -import { defineConfig } from 'astro/config'; -import prefetch from '@astrojs/prefetch'; +```diff lang="js" "prefetch()" + // astro.config.mjs + import { defineConfig } from 'astro/config'; ++ import prefetch from '@astrojs/prefetch'; -export default defineConfig({ - // ... - integrations: [prefetch()], -}); + export default defineConfig({ + // ... + integrations: [prefetch()], + // ^^^^^^^^^^ + }); ``` ## Usage diff --git a/packages/integrations/react/README.md b/packages/integrations/react/README.md index 00a574c54..d9a3b473c 100644 --- a/packages/integrations/react/README.md +++ b/packages/integrations/react/README.md @@ -42,15 +42,16 @@ npm install react react-dom Now, apply this integration to your `astro.config.*` file using the `integrations` property: -```js ins={3} "react()" -// astro.config.mjs -import { defineConfig } from 'astro/config'; -import react from '@astrojs/react'; +```diff lang="js" "react()" + // astro.config.mjs + import { defineConfig } from 'astro/config'; ++ import react from '@astrojs/react'; -export default defineConfig({ - // ... - integrations: [react()], -}); + export default defineConfig({ + // ... + integrations: [react()], + // ^^^^^^^ + }); ``` ## Getting started @@ -72,6 +73,7 @@ Use the `include` (required) and `exclude` (optional) configuration options to s We recommend placing common framework components in the same folder (e.g. `/components/react/` and `/components/solid/`) to make specifying your includes easier, but this is not required: ```js +// astro.config.mjs import { defineConfig } from 'astro/config'; import preact from '@astrojs/preact'; import react from '@astrojs/react'; diff --git a/packages/integrations/sitemap/README.md b/packages/integrations/sitemap/README.md index b2fb5e9dd..92e760303 100644 --- a/packages/integrations/sitemap/README.md +++ b/packages/integrations/sitemap/README.md @@ -48,15 +48,16 @@ npm install @astrojs/sitemap Then, apply this integration to your `astro.config.*` file using the `integrations` property: -```js ins={3} "sitemap()" -// astro.config.mjs -import { defineConfig } from 'astro/config'; -import sitemap from '@astrojs/sitemap'; +```diff lang="js" "sitemap()" + // astro.config.mjs + import { defineConfig } from 'astro/config'; ++ import sitemap from '@astrojs/sitemap'; -export default defineConfig({ - // ... - integrations: [sitemap()], -}); + export default defineConfig({ + // ... + integrations: [sitemap()], + // ^^^^^^^^^ + }); ``` ## Usage @@ -84,19 +85,19 @@ Now, [build your site for production](https://docs.astro.build/en/reference/cli- After verifying that the sitemaps are built, you can add them to your site's `` and the `robots.txt` file for crawlers to pick up. -```html ins={3} - - - - +```diff lang="html" + + ++ + ``` - -```diff ins={4} title="public/robots.txt" -User-agent: * -Allow: / +```diff + # public/robots.txt + User-agent: * + Allow: / -Sitemap: https:///sitemap-index.xml ++ Sitemap: https:///sitemap-index.xml ``` ### Example of generated files for a two-page website diff --git a/packages/integrations/solid/README.md b/packages/integrations/solid/README.md index d11d5da88..e82cd5e18 100644 --- a/packages/integrations/solid/README.md +++ b/packages/integrations/solid/README.md @@ -42,15 +42,16 @@ npm install solid-js Now, apply this integration to your `astro.config.*` file using the `integrations` property: -```js ins={3} "solid()" -// astro.config.mjs -import { defineConfig } from 'astro/config'; -import solid from '@astrojs/solid-js'; +```diff lang="js" "solid()" + // astro.config.mjs + import { defineConfig } from 'astro/config'; ++ import solid from '@astrojs/solid-js'; -export default defineConfig({ - // ... - integrations: [solid()], -}); + export default defineConfig({ + // ... + integrations: [solid()], + // ^^^^^^^ + }); ``` ## Getting started @@ -72,6 +73,7 @@ Use the `include` (required) and `exclude` (optional) configuration options to s We recommend placing common framework components in the same folder (e.g. `/components/react/` and `/components/solid/`) to make specifying your includes easier, but this is not required: ```js +// astro.config.mjs import { defineConfig } from 'astro/config'; import preact from '@astrojs/preact'; import react from '@astrojs/react'; diff --git a/packages/integrations/svelte/README.md b/packages/integrations/svelte/README.md index d36450526..5df61fab0 100644 --- a/packages/integrations/svelte/README.md +++ b/packages/integrations/svelte/README.md @@ -42,15 +42,16 @@ npm install svelte Now, apply this integration to your `astro.config.*` file using the `integrations` property: -```js ins={3} "svelte()" -// astro.config.mjs -import { defineConfig } from 'astro/config'; -import svelte from '@astrojs/svelte'; +```diff lang="js" "svelte()" + // astro.config.mjs + import { defineConfig } from 'astro/config'; ++ import svelte from '@astrojs/svelte'; -export default defineConfig({ - // ... - integrations: [svelte()], -}); + export default defineConfig({ + // ... + integrations: [svelte()], + // ^^^^^^^^ + }); ``` ## Getting started diff --git a/packages/integrations/tailwind/README.md b/packages/integrations/tailwind/README.md index a0225db77..ecbe37d1a 100644 --- a/packages/integrations/tailwind/README.md +++ b/packages/integrations/tailwind/README.md @@ -50,15 +50,16 @@ npm install @astrojs/tailwind tailwindcss Then, apply this integration to your `astro.config.*` file using the `integrations` property: -```js ins={3} "tailwind()" -// astro.config.mjs -import { defineConfig } from 'astro/config'; -import tailwind from '@astrojs/tailwind'; +```diff lang="js" "tailwind()" + // astro.config.mjs + import { defineConfig } from 'astro/config'; ++ import tailwind from '@astrojs/tailwind'; -export default defineConfig({ - // ... - integrations: [tailwind()], -}); + export default defineConfig({ + // ... + integrations: [tailwind()], + // ^^^^^^^^^^ + }); ``` Then, create a `tailwind.config.cjs` file in your project's root directory. You can use the following command to generate a basic configuration file for you: @@ -69,16 +70,16 @@ npx tailwindcss init Finally, add this basic configuration to your `tailwind.config.cjs` file: -```js ins={4} "content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}']" -// tailwind.config.cjs -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'], - theme: { - extend: {}, - }, - plugins: [], -}; +```diff lang="js" "content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}']" + // tailwind.config.cjs + /** @type {import('tailwindcss').Config} */ + module.exports = { ++ content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'], + theme: { + extend: {}, + }, + plugins: [], + }; ``` ## Usage diff --git a/packages/integrations/vercel/README.md b/packages/integrations/vercel/README.md index 381132d80..143a8db5c 100644 --- a/packages/integrations/vercel/README.md +++ b/packages/integrations/vercel/README.md @@ -45,15 +45,15 @@ If you prefer to install the adapter manually instead, complete the following tw 1. Add two new lines to your `astro.config.mjs` project configuration file. - ```js ins={3, 6-7} - // astro.config.mjs - import { defineConfig } from 'astro/config'; - import vercel from '@astrojs/vercel/serverless'; + ```diff lang="js" + // astro.config.mjs + import { defineConfig } from 'astro/config'; + + import vercel from '@astrojs/vercel/serverless'; - export default defineConfig({ - output: 'server', - adapter: vercel(), - }); + export default defineConfig({ + + output: 'server', + + adapter: vercel(), + }); ``` ### Targets diff --git a/packages/integrations/vue/README.md b/packages/integrations/vue/README.md index 688a7a7b9..3440048ee 100644 --- a/packages/integrations/vue/README.md +++ b/packages/integrations/vue/README.md @@ -42,15 +42,16 @@ npm install vue Now, apply this integration to your `astro.config.*` file using the `integrations` property: -```js ins={3} "vue()" -// astro.config.mjs -import { defineConfig } from 'astro/config'; -import vue from '@astrojs/vue'; +```diff lang="js" "vue()" + // astro.config.mjs + import { defineConfig } from 'astro/config'; ++ import vue from '@astrojs/vue'; -export default defineConfig({ - // ... - integrations: [vue()], -}); + export default defineConfig({ + // ... + integrations: [vue()], + // ^^^^^ + }); ``` ## Getting started