Skip to content

Commit a725c78

Browse files
ArmandPhilippotsarah11918Adammatthiesen
authored
fix(integrations-guide): add/format API references blocks (#12319)
Co-authored-by: Sarah Rainsberger <[email protected]> Co-authored-by: Adammatthiesen <[email protected]>
1 parent 7dc1f09 commit a725c78

File tree

9 files changed

+152
-36
lines changed

9 files changed

+152
-36
lines changed

src/content/docs/en/guides/integrations-guide/alpinejs.mdx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ githubIntegrationURL: 'https://github.com/withastro/astro/tree/main/packages/int
88
category: renderer
99
i18nReady: true
1010
---
11-
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro'
11+
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro';
12+
import Since from '~/components/Since.astro';
1213

1314
This **[Astro integration][astro-integration]** adds [Alpine.js](https://alpinejs.dev/) to your project so that you can use Alpine.js anywhere on your page.
1415

@@ -96,6 +97,12 @@ export default defineConfig({
9697

9798
### `entrypoint`
9899

100+
<p>
101+
102+
**Type:** `string`<br />
103+
<Since v="0.4.0" pkg="@astrojs/alpinejs" />
104+
</p>
105+
99106
You can extend Alpine by setting the `entrypoint` option to a root-relative import specifier (e.g. `entrypoint: "/src/entrypoint"`).
100107

101108
The default export of this file should be a function that accepts an Alpine instance prior to starting. This allows the use of custom directives, plugins and other customizations for advanced use cases.

src/content/docs/en/guides/integrations-guide/db.mdx

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ export default defineConfig({
129129

130130
### `columns`
131131

132+
<p>
133+
134+
**Type:** `ColumnsConfig`
135+
</p>
136+
132137
Table columns are configured using the `columns` object:
133138

134139
```ts
@@ -184,6 +189,11 @@ type UserTableInferInsert = {
184189
185190
### `indexes`
186191
192+
<p>
193+
194+
**Type:** `{ on: string | string[]; unique?: boolean | undefined; name?: string | undefined; }[]`
195+
</p>
196+
187197
Table indexes are used to improve lookup speeds on a given column or combination of columns. The `indexes` property accepts an array of configuration objects specifying the columns to index:
188198
189199
```ts title="db/config.ts" {9-11}
@@ -205,12 +215,17 @@ This will generate a unique index on the `authorId` and `published` columns with
205215

206216
The following configuration options are available for each index:
207217

208-
- `on`: `string | string[]` - A single column or array of column names to index.
209-
- `unique`: `boolean` - Set to `true` to enforce unique values across the indexed columns.
210-
- `name`: `string` (optional) - A custom name for the unique index. This will override Astro's generated name based on the table and column names being indexed (e.g. `Comment_authorId_published_idx`). Custom names are global, so ensure index names do not conflict between tables.
218+
- `on` - A single column or array of column names to index.
219+
- `unique` (optional) - Set to `true` to enforce unique values across the indexed columns.
220+
- `name` (optional) - A custom name for the unique index. This will override Astro's generated name based on the table and column names being indexed (e.g. `Comment_authorId_published_idx`). Custom names are global, so ensure index names do not conflict between tables.
211221

212222
### `foreignKeys`
213223

224+
<p>
225+
226+
**Type:** `{ columns: string | string[]; references: () => Column | Column[]; }[]`
227+
</p>
228+
214229
:::tip
215230

216231
`foreignKeys` is an advanced API for relating multiple table columns. If you only need to reference a single column, try using [the column `references` property.](#columns)
@@ -246,8 +261,8 @@ const Comment = defineTable({
246261

247262
Each foreign key configuration object accepts the following properties:
248263

249-
- `columns`: `string[]` - An array of column names to relate to the referenced table.
250-
- `references`: `() => Column[]` - A function that returns an array of columns from the referenced table.
264+
- `columns` - A single column or array of column names to relate to the referenced table.
265+
- `references` - A function that returns a single column or an array of columns from the referenced table.
251266

252267
## Astro DB CLI reference
253268

@@ -288,6 +303,12 @@ Execute a raw SQL query against your database. Use the `--remote` flag to run ag
288303

289304
### `isDbError()`
290305

306+
<p>
307+
308+
**Type:** `(err: unknown) => boolean`<br />
309+
<Since v="0.9.1" pkg="@astrojs/db" />
310+
</p>
311+
291312
The `isDbError()` function checks if an error is a libSQL database exception. This may include a foreign key constraint error when using references, or missing fields when inserting data. You can combine `isDbError()` with a try / catch block to handle database errors in your application:
292313

293314
```ts title="src/pages/api/comment/[id].ts" "idDbError"

src/content/docs/en/guides/integrations-guide/markdoc.mdx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ githubIntegrationURL: 'https://github.com/withastro/astro/tree/main/packages/int
88
category: other
99
i18nReady: true
1010
---
11-
import { FileTree } from '@astrojs/starlight/components';
11+
import { FileTree, Steps } from '@astrojs/starlight/components';
1212
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro';
13-
import { Steps } from '@astrojs/starlight/components';
1413
import ReadMore from '~/components/ReadMore.astro';
14+
import Since from '~/components/Since.astro';
1515

1616
This **[Astro integration][astro-integration]** enables the usage of [Markdoc](https://markdoc.dev/) to create components, pages, and content collection entries.
1717

@@ -593,6 +593,13 @@ The Astro Markdoc integration handles configuring Markdoc options and capabiliti
593593
594594
### `allowHTML`
595595
596+
<p>
597+
598+
**Type:** `boolean`<br />
599+
**Default:** `false`<br />
600+
<Since v="0.4.4" pkg="@astrojs/markdoc" />
601+
</p>
602+
596603
Enables writing HTML markup alongside Markdoc tags and nodes.
597604
598605
By default, Markdoc will not recognize HTML markup as semantic content.
@@ -615,6 +622,13 @@ When `allowHTML` is enabled, HTML markup inside Markdoc documents will be render
615622
616623
### `ignoreIndentation`
617624
625+
<p>
626+
627+
**Type:** `boolean`<br />
628+
**Default:** `false`<br />
629+
<Since v="0.7.0" pkg="@astrojs/markdoc" />
630+
</p>
631+
618632
By default, any content that is indented by four spaces is treated as a code block. Unfortunately, this behavior makes it difficult to use arbitrary levels of indentation to improve the readability of documents with complex structure.
619633
620634
When using nested tags in Markdoc, it can be helpful to indent the content inside of tags so that the level of depth is clear. To support arbitrary indentation, we have to disable the indent-based code blocks and modify several other markdown-it parsing rules that account for indent-based code blocks. These changes can be applied by enabling the ignoreIndentation option.

src/content/docs/en/guides/integrations-guide/mdx.mdx

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,12 @@ MDX does not support passing remark and rehype plugins as a string. You should i
271271

272272
### `extendMarkdownConfig`
273273

274-
* **Type:** `boolean`
275-
* **Default:** `true`
274+
<p>
275+
276+
**Type:** `boolean`<br />
277+
**Default:** `true`<br />
278+
<Since v="0.15.0" pkg="@astrojs/mdx" />
279+
</p>
276280

277281
MDX will extend [your project's existing Markdown configuration](/en/reference/configuration-reference/#markdown-options) by default. To override individual options, you can specify their equivalent in your MDX configuration.
278282

@@ -326,13 +330,25 @@ export default defineConfig({
326330

327331
### `recmaPlugins`
328332

333+
<p>
334+
335+
**Type:** `PluggableList`<br />
336+
**Default:** `[]`<br />
337+
<Since v="0.11.5" pkg="@astrojs/mdx" />
338+
</p>
339+
329340
These are plugins that modify the output [estree](https://github.com/estree/estree) directly. This is useful for modifying or injecting JavaScript variables in your MDX files.
330341

331342
We suggest [using AST Explorer](https://astexplorer.net/) to play with estree outputs, and trying [`estree-util-visit`](https://unifiedjs.com/explore/package/estree-util-visit/) for searching across JavaScript nodes.
332343

333344
### `optimize`
334345

335-
* **Type:** `boolean | { ignoreElementNames?: string[] }`
346+
<p>
347+
348+
**Type:** `boolean | { ignoreElementNames?: string[] }`<br />
349+
**Default:** `false`<br />
350+
<Since v="0.19.5" pkg="@astrojs/mdx" />
351+
</p>
336352

337353
This is an optional configuration setting to optimize the MDX output for faster builds and rendering via an internal rehype plugin. This may be useful if you have many MDX files and notice slow builds. However, this option may generate some unescaped HTML, so make sure your site's interactive parts still work correctly after enabling it.
338354

@@ -354,9 +370,12 @@ export default defineConfig({
354370

355371
#### `ignoreElementNames`
356372

357-
* **Type:** `string[]`
373+
<p>
374+
375+
**Type:** `string[]`<br />
376+
<Since v="3.0.0" pkg="@astrojs/mdx" />
377+
</p>
358378

359-
<p><Since pkg="@astrojs/mdx" v="3.0.0" /></p>
360379
Previously known as `customComponentNames`.
361380

362381
An optional property of `optimize` to prevent the MDX optimizer from handling certain element names, like [custom components passed to imported MDX content via the components prop](/en/guides/integrations-guide/mdx/#custom-components-with-imported-mdx).

src/content/docs/en/guides/integrations-guide/partytown.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ export default defineConfig({
107107
});
108108
```
109109

110-
This mirrors the [Partytown config object](https://partytown.qwik.dev/configuration/).
110+
This mirrors the [Partytown config object](https://partytown.qwik.dev/configuration/) and all options can be set in `partytown.config`. Some common configuration options for Astro projects are described on this page.
111111

112112

113-
### config.debug
113+
### Enabling debug mode
114114

115115
Partytown ships with a `debug` mode; enable or disable it by passing `true` or `false` to `config.debug`. If [`debug` mode](https://partytown.qwik.dev/debugging) is enabled, it will output detailed logs to the browser console.
116116

@@ -128,7 +128,7 @@ export default defineConfig({
128128
});
129129
```
130130

131-
### config.forward
131+
### Forwarding variables
132132

133133
Third-party scripts typically add variables to the `window` object so that you can communicate with them throughout your site. But when a script is loaded in a web-worker, it doesn't have access to that global `window` object.
134134

@@ -150,7 +150,7 @@ export default defineConfig({
150150
});
151151
```
152152

153-
### config.resolveUrl
153+
### Proxying requests
154154

155155
Some third-party scripts may require [proxying](https://partytown.qwik.dev/proxying-requests/) through `config.resolveUrl()`, which runs inside the service worker. You can set this configuration option to check for a specific URL, and optionally return a proxied URL instead:
156156

@@ -211,4 +211,3 @@ Note that the integration config will override `window.partytown` if you set a p
211211
* [Optimise Google Analytics using Partytown in Astro](https://ricostacruz.com/posts/google-analytics-in-astro)
212212

213213
[astro-integration]: /en/guides/integrations-guide/
214-

src/content/docs/en/guides/integrations-guide/preact.mdx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,13 @@ The Astro Preact integration handles how Preact components are rendered and it h
133133

134134
For basic usage, you do not need to configure the Preact integration.
135135

136-
### compat
136+
### `compat`
137+
138+
<p>
139+
140+
**Type:** `boolean`<br />
141+
<Since pkg="@astrojs/preact" v="0.3.0" />
142+
</p>
137143

138144
You can enable `preact/compat`, Preact’s compatibility layer for rendering React components without needing to install or ship React’s larger libraries to your users’ web browsers.
139145

@@ -167,9 +173,13 @@ Check out the [`pnpm` overrides](https://pnpm.io/package_json#pnpmoverrides) and
167173
Currently, the `compat` option only works for React libraries that export code as ESM. If an error happens during build-time, try adding the library to `vite.ssr.noExternal: ['the-react-library']` in your `astro.config.mjs` file.
168174
:::
169175

170-
### devtools
176+
### `devtools`
177+
178+
<p>
171179

172-
<p><Since pkg="@astrojs/preact" v="3.3.0" /></p>
180+
**Type:** `boolean`<br />
181+
<Since pkg="@astrojs/preact" v="3.3.0" />
182+
</p>
173183

174184
You can enable [Preact devtools](https://preactjs.github.io/preact-devtools/) in development by passing an object with `devtools: true` to your `preact()` integration config:
175185

src/content/docs/en/guides/integrations-guide/solid-js.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,13 @@ To use your first SolidJS component in Astro, head to our [UI framework document
117117

118118
## Configuration
119119

120-
### devtools
120+
### `devtools`
121121

122-
<p><Since pkg="@astrojs/solid-js" v="4.2.0" /></p>
122+
<p>
123+
124+
**Type:** `boolean`<br />
125+
<Since pkg="@astrojs/solid-js" v="4.2.0" />
126+
</p>
123127

124128
You can enable [Solid DevTools](https://github.com/thetarnav/solid-devtools) in development by passing an object with `devtools: true` to your `solid()` integration config and adding `solid-devtools` to your project dependencies:
125129

@@ -232,4 +236,3 @@ Feel free to add additional Suspense boundaries according to your preference.
232236
[solid-create-resource]: https://www.solidjs.com/docs/latest/api#createresource
233237

234238
[solid-lazy-components]: https://www.solidjs.com/docs/latest/api#lazy
235-

0 commit comments

Comments
 (0)