Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: use lowercase typings, use | instead of or in type declaration #2167

Merged
merged 3 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 17 additions & 17 deletions docs/content-v1/en/1.getting-started/4.fetching.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@ This module globally injects `$content` instance, meaning that you can access it
### $content(path, options?)

- `path`
- Type: `String`
- Type: `string`
- Default: `/`
- `options`
- Type: `Object`
- Type: `object`
- Default: `{}`
- Version: **>= v1.3.0**
- `options.deep`
- Type: `Boolean`
- Type: `boolean`
- Default: `false`
- Version: **>= v1.3.0**
- *Fetch files from subdirectories*
- `options.text`
- Type: `Boolean`
- Type: `boolean`
- Default: `false`
- Version: **>= v1.4.0**
- *Returns the original markdown content in a `text` variable*
- Returns a chain sequence

> You can also give multiple arguments: `$content('articles', params.slug)` will be translated to `/articles/${params.slug}`

`path` can be a file or a directory. If `path` is a file, `fetch()` will return an `Object`, if it's a directory it will return an `Array`.
`path` can be a file or a directory. If `path` is a file, `fetch()` will return an `object`, if it's a directory it will return an `Array`.

All the methods below can be chained and return a chain sequence, except `fetch` which returns a `Promise`.

### only(keys)

- `keys`
- Type: `Array` | `String`
- Type: `Array` | `string`
- `required`

Select a subset of fields.
Expand All @@ -49,7 +49,7 @@ const { title } = await this.$content('article-1').only(['title']).fetch()
### without(keys)

- `keys`
- Type: `Array` | `String`
- Type: `Array` | `string`
- `required`

Remove a subset of fields.
Expand All @@ -61,7 +61,7 @@ const { title, ...propsWithoutBody } = await this.$content('article-1').without(
### where(query)

- `query`
- Type: `Object`
- Type: `object`
- `required`

Filter results by query.
Expand Down Expand Up @@ -93,10 +93,10 @@ const products = await this.$content('products').where({ 'categories.slug': { $c
### sortBy(key, direction)

- `key`
- Type: `String`
- Type: `string`
- `required`
- `direction`
- Type: `String`
- Type: `string`
- Value: `'asc'` or `'desc'`
- Default: `'asc'`

Expand All @@ -119,7 +119,7 @@ If you need case-insensitive sorting, check out [this snippet](/snippets#case-in
### limit(n)

- `n`
- Type: `String` | `Number`
- Type: `string` | `number`
- `required`

Limit number of results.
Expand All @@ -132,7 +132,7 @@ const articles = await this.$content('articles').limit(5).fetch()
### skip(n)

- `n`
- Type: `String` | `Number`
- Type: `string` | `number`
- `required`

Skip results.
Expand All @@ -145,10 +145,10 @@ const articles = await this.$content('articles').skip(5).limit(5).fetch()
### search(field, value)

- `field`
- Type: `String`
- Type: `string`
- `required`
- `value`
- Type: `String`
- Type: `string`

Performs a full-text search on a field. `value` is optional, in this case `field` is the `value` and search will be performed on all defined full-text search fields.

Expand All @@ -174,10 +174,10 @@ Check out [this snippet](/snippets#search) on how to implement search into your
### surround(slugOrPath, options)

- `slugOrPath`
- Type: `String`
- Type: `string`
- `required`
- `options`
- Type: `Object`
- Type: `object`
- Default: `{ before: 1, after: 1}`

Get prev and next results around a specific slug or path.
Expand Down Expand Up @@ -218,7 +218,7 @@ Check out [this snippet](/snippets#prev-and-next) on how to implement prev and n

### fetch()

- Returns: `Promise<Object>` | `Promise<Array>`
- Returns: `Promise<object>` | `Promise<Array>`

Ends the chain sequence and collects data.

Expand Down
4 changes: 2 additions & 2 deletions docs/content-v1/en/1.getting-started/5.displaying.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export default {

**Props:**
- document:
- Type: `Object`
- Type: `object`
- `required`
- tag:
- Type: `String`
- Type: `string`

Learn more about what you can write in your markdown file in the [writing content](/writing#markdown) section.

Expand Down
20 changes: 10 additions & 10 deletions docs/content-v1/en/1.getting-started/6.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ the defaults are quite sensible. If you don't want to have the defaults included

### `apiPrefix`

- Type: `String`
- Type: `string`
- Default: `'/_content'`

Route that will be used for client-side API calls and SSE.
Expand All @@ -42,7 +42,7 @@ content: {

### `dir`

- Type: `String`
- Type: `string`
- Default: `'content'`

Directory used for writing content.
Expand Down Expand Up @@ -86,7 +86,7 @@ content: {

### `liveEdit`

- Type `Boolean`
- Type `boolean`
- Default: `true`
- Version: **>= v1.5.0**

Expand Down Expand Up @@ -202,7 +202,7 @@ export default {

### `markdown.tocDepth`

- Type: `Number`
- Type: `number`
- Default: `3`
- Version: **>= v1.11.0**

Expand Down Expand Up @@ -238,7 +238,7 @@ Deprecated. Use `markdown.remarkPlugins` as an array instead.

### `markdown.prism.theme`

- Type: `String`
- Type: `string`
- Default: `'prismjs/themes/prism.css'`

This module handles code highlighting in markdown content using [PrismJS](https://prismjs.com).
Expand Down Expand Up @@ -435,7 +435,7 @@ export default {

### `yaml`

- Type: `Object`
- Type: `object`
- Default: `{}`

This module uses `js-yaml` to parse `.yaml`, `.yml` files. You can check here for [options](https://github.com/nodeca/js-yaml#api).
Expand All @@ -445,21 +445,21 @@ Note that we force `json: true` option.

### `xml`

- Type: `Object`
- Type: `object`
- Default: `{}`

This module uses `xml2js` to parse `.xml` files. You can check here for [options](https://www.npmjs.com/package/xml2js#options).

### `csv`

- Type: `Object`
- Type: `object`
- Default: `{}`

This module uses `node-csvtojson` to parse csv files. You can check here for [options](https://github.com/Keyang/node-csvtojson#parameters).

### `extendParser`

- Type: `Object`
- Type: `object`
- Default `{}`

With this option you can define your own parsers for other file types. Also you can **overwrite** the default parser!
Expand Down Expand Up @@ -502,7 +502,7 @@ You should be aware that you get the full markdown file content so this includes

### `useCache`

- Type: `Boolean`
- Type: `boolean`
- Default: `false`

When `true`, the production server (`nuxt start`) will use cached version of the content (generated after running `nuxt build`) instead of parsing files. This improves app startup time, but makes app unaware of any content changes.
Expand Down
14 changes: 7 additions & 7 deletions docs/content-v1/en/1.getting-started/7.advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ Allows you to modify the contents of a file before it is handled by the parsers.

Arguments:
- `file`
- Type: `Object`
- Type: `object`
- Properties:
- path: `String`
- extension: `String` (ex: `.md`)
- data: `String`
- path: `string`
- extension: `string` (ex: `.md`)
- data: `string`

**Example**

Expand All @@ -97,11 +97,11 @@ Allows you to add data to a document before it is stored.

Arguments:
- `document`
- Type: `Object`
- Type: `object`
- Properties:
- See [writing content](/writing)
- `database`
- Type: `Object`
- Type: `object`
- Properties:
- See [type definition](https://github.com/nuxt/content/blob/master/packages/content/types/database.d.ts)

Expand Down Expand Up @@ -155,7 +155,7 @@ Extend the content options, useful for modules that wants to read content option

Arguments:
- `options`
- Type: `Object`
- Type: `object`
- Properties:
- See [configuration](/configuration#properties)

Expand Down
30 changes: 15 additions & 15 deletions docs/content-v1/fr/1.getting-started/4.fetching.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ Ce module injecte globalement une instance de `$content`, ce qui veut dire que v
### $content(path, options?)

- `path`
- Type: `String`
- Type: `string`
- Défaut: `/`
- `requis`
- `options`
- Type: `Object`
- Type: `object`
- Défaut: `{ deep: false }`
- Version: **v1.3.0**
- Retourne une séquence de chaîne

> Vous pouvez églament passer plusieurs arguments : `$content('articles', params.slug)` sera traduit en `/articles/${params.slug}`

`path` peut désigner un fichier ou un répertoire. Si c'est un fichier, la méthode`fetch()` retournera un `Object`, si c'est un répertoire elle retournera un `Array`.
`path` peut désigner un fichier ou un répertoire. Si c'est un fichier, la méthode`fetch()` retournera un `object`, si c'est un répertoire elle retournera un `Array`.

Vous pouvez passer `{ deep: true }` en tant que second argument afin de récupérer les fichiers contenus dans les sous-répertoires.

Expand All @@ -30,7 +30,7 @@ Toutes les méthodes ci-dessous peuvent être chainées et renvoient une séquen
### only(keys)

- `keys`
- Type: `Array` | `String`
- Type: `Array` | `string`
- `requis`

Sélectionne un sous-ensemble de champs.
Expand All @@ -42,7 +42,7 @@ const { titre } = await this.$content('article-1').only(['titre']).fetch()
### without(keys)

- `keys`
- Type: `Array` | `String`
- Type: `Array` | `string`
- `required`

Retire un sous-ensemble de champs.
Expand All @@ -54,7 +54,7 @@ const { title, ...propsWithoutBody } = await this.$content('article-1').without(
### where(query)

- `query`
- Type: `Object`
- Type: `object`
- `requis`

Filtre les résultats par le biais d'une requête.
Expand Down Expand Up @@ -86,10 +86,10 @@ Ce module utilise en interne LokiJS, vous pouvez allez voir des [exemples de req
### sortBy(key, direction)

- `key`
- Type: `String`
- Type: `string`
- `requis`
- `direction`
- Type: `String`
- Type: `string`
- Valeur: `'asc'` ou `'desc'`
- Défaut: `'asc'`

Expand All @@ -104,7 +104,7 @@ const articles = await this.$content('articles').sortBy('titre').fetch()
### limit(n)

- `n`
- Type: `String` | `Number`
- Type: `string` | `number`
- `requis`

Limite le nombre de résultats.
Expand All @@ -117,7 +117,7 @@ const articles = await this.$content('articles').limit(5).fetch()
### skip(n)

- `n`
- Type: `String` | `Number`
- Type: `string` | `number`
- `requis`

Détermine le nombre de résultat à passer.
Expand All @@ -130,10 +130,10 @@ const articles = await this.$content('articles').skip(5).limit(5).fetch()
### search(field, value)

- `field`
- Type: `String`
- Type: `string`
- `requis`
- `value`
- Type: `String`
- Type: `string`

Effectue une recherche plein texte sur un champ. Le paramètre `value` est optionnel, dans ce cas `field` devient la `value`  et la recherche est alors effectuée sur tous les champs définis en tant que champ de recherche plein texte.

Expand All @@ -153,10 +153,10 @@ const articles = await this.$content('articles').search('').fetch()
### surround(slug, options)

- `slug`
- Type: `String`
- Type: `string`
- `requis`
- `options`
- Type: `Object`
- Type: `object`
- Défaut: `{ before: 1, after: 1}`

Récupère les résultats qui précédent et suivent un résultat spécifique.
Expand Down Expand Up @@ -185,7 +185,7 @@ const [prev, next] = await this.$content('articles')

### fetch()

- Renvoie: `Promise<Object>` | `Promise<Array>`
- Renvoie: `Promise<object>` | `Promise<Array>`

Met fin à la séquence de chaînes et collecte les données.

Expand Down
2 changes: 1 addition & 1 deletion docs/content-v1/fr/1.getting-started/5.displaying.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {
**Props:**

- document:
- Type: `Object`
- Type: `object`
- `requis`

Vous pouvez en apprendre davantage au sujet de ce que vous pouvez écrire dans vos fichiers Markdown dans la section [écrire du contenu](/fr/writing#markdown).
Expand Down