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 2 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
10 changes: 5 additions & 5 deletions docs/content/3.guide/1.writing/2.markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ description: 'meta description of the page'

### Native parameters

| Key | Type | Default | Description |
| ------------------------------------------- | --------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| Key | Type | Default | Description |
| ------------------------------------------- | :-------: | ------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `title` | `string` | First `<h1>`{lang="html"} of the page | Title of the page, will also be injected in metas |
| `description` | `string` | First `<p>`{lang="html"} of the page | Description of the page, will be shown below the title and injected into the metas |
| `draft` | `Boolean` | `false` | Mark the page as draft (and only display it in development mode). |
| `navigation` | `Boolean` | `true` | Define if the page is included in [`fetchContentNavigation`](/guide/displaying/navigation) return value. |
| [`head`](/api/composables/use-content-head) | `Object` | `true` | Easy access to [`useContentHead`](/api/composables/use-content-head) |
| `draft` | `boolean` | `false` | Mark the page as draft (and only display it in development mode). |
| `navigation` | `boolean` | `true` | Define if the page is included in [`fetchContentNavigation`](/guide/displaying/navigation) return value. |
| [`head`](/api/composables/use-content-head) | `object` | `true` | Easy access to [`useContentHead`](/api/composables/use-content-head) |

When used together with [`<ContentDoc>`](/guide/displaying/rendering#contentdoc-) or the [document-driven mode](/guide/writing/document-driven) to display the current page, the [`useContentHead() composable`](/api/composables/use-content-head) will be used to set the page's metadata.

Expand Down
8 changes: 4 additions & 4 deletions docs/content/4.api/1.components/1.content-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ It uses `<ContentRenderer>`{lang=html} and `<ContentQuery>`{lang=html} under the
## Props

- `tag`{lang=ts}: The tag to use for the renderer element (if no default slot is provided).
- Type: `String`{lang=ts}
- Type: `string`{lang=ts}
- Default: `'div'`{lang=ts}
- `path`{lang=ts}: The path of the content to load from content source.
- Type: `String`{lang=ts}
- Type: `string`{lang=ts}
- Default: `$route.path`{lang=ts}
- `excerpt`{lang=ts}: Whether or not to render the excerpt.
- Type: `Boolean`{lang=ts}
- Type: `boolean`{lang=ts}
- Default: `false`{lang=ts}
- `query`{lang=ts}: A query to be passed to `queryContent()`.
- Type: `QueryBuilderParams`{lang=ts}
- Default: `undefined`{lang=ts}
- `head`{lang=ts}: Toggles the usage of [`useContentHead`](/api/composables/use-content-head).
- Type: `Boolean`{lang=ts}
- Type: `boolean`{lang=ts}
- Default: `true`{lang=ts}

## Slots
Expand Down
2 changes: 1 addition & 1 deletion docs/content/4.api/1.components/2.content-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ An explicit `path`{lang=ts} can be given to the component.
## Props

- `path`{lang=ts}: The path of the content to load from content source.
- Type: `String`{lang=ts}
- Type: `string`{lang=ts}
- Default: `'/'`{lang=ts}
- `query`{lang=ts}: A query builder params object to be passed to `<ContentQuery />` component.
- Type: `QueryBuilderParams`{lang=ts}
Expand Down
6 changes: 3 additions & 3 deletions docs/content/4.api/1.components/2.content-renderer.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Other types will currently be passed to default slot via `v-slot="{ data }"` or
- Type: `ParsedContent`{lang=ts}
- Default: `{}`{lang=ts}
- `tag`{lang=ts}: The tag to use for the renderer element if it is used.
- Type: `String`{lang=ts}
- Type: `string`{lang=ts}
- Default: `'div'`{lang=ts}
- `excerpt`{lang=ts}: Whether or not to render the excerpt.
- Type: `Boolean`{lang=ts}
- Type: `boolean`{lang=ts}
- Default: `false`{lang=ts}
- `components`{lang=ts}: The map of custom components to use for rendering. This prop will pass to markdown renderer and will not affect other file types.
- Type: `Object`{lang=ts}
- Type: `object`{lang=ts}
- Default: `{}`{lang=ts}

## Slots
Expand Down
14 changes: 7 additions & 7 deletions docs/content/4.api/1.components/4.content-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ The `<ContentQuery>`{lang=html} component fetches a document and gives access to
## Props

- `path`{lang=ts}: The path of the content to load from content source.
- Type: `String`{lang=ts}
- Type: `string`{lang=ts}
- Default: `undefined`{lang=ts}
- `only`{lang=ts}: Select a subset of fields from an array of keys.
- Type: `Array<String>`{lang=ts}
- Type: `string[]`{lang=ts}
- Default: `undefined`{lang=ts}
- `without`{lang=ts}: Remove a subset of fields from an array of keys.
- Type: `Array<String>`{lang=ts}
- Type: `string[]`{lang=ts}
- Default: `undefined`{lang=ts}
- `where`{lang=ts}: Filter results with a `where` clause definition.
- Type: `{ [key: string]: any }`{lang=ts}
Expand All @@ -22,16 +22,16 @@ The `<ContentQuery>`{lang=html} component fetches a document and gives access to
- Type: `SortParams`{lang=ts}
- Default: `undefined`{lang=ts}
- `limit`{lang=ts}: Limit the amount of results.
- Type: `Number`{lang=ts}
- Type: `number`{lang=ts}
- Default: `undefined`{lang=ts}
- `skip`{lang=ts}: Skip an amount of results.
- Type: `Number`{lang=ts}
- Type: `number`{lang=ts}
- Default: `undefined`{lang=ts}
- `locale`{lang=ts}: Filter contents based on a locale.
- Type: `String`{lang=ts}
- Type: `string`{lang=ts}
- Default: `undefined`{lang=ts}
- `find`{lang=ts}: The type of query to be made.
- Type: `String`{lang=ts}
- Type: `string`{lang=ts}
- Values: `'one'`{lang=ts} or `'surround'`{lang=ts} or `undefined`{lang=ts}
- Default: `.find()`{lang=ts} will be used if nothing is specified

Expand Down
2 changes: 1 addition & 1 deletion docs/content/4.api/1.components/5.markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ It is useful when creating components that you want to use in your Markdown cont
- Type: Vue slot `Function`
- Example: `$slots.default`{lang=ts}
- `unwrap`{lang=ts}: Whether to unwrap the content or not. This is useful when you want to extract the content nested in native Markdown syntax. Each specified tag will get removed from AST.
- Type: `Boolean`{lang=ts} or `String`{lang=ts}
- Type: `boolean`{lang=ts} or `string`{lang=ts}
- Default: `false`{lang=ts}
- Example: `'ul li'`{lang=ts}

Expand Down
2 changes: 1 addition & 1 deletion docs/content/4.api/1.components/6.content-slot.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ It is useful when creating components that you want to use in your Markdown cont
- Type: Vue slot `Function`
- Example: `$slots.default`{lang=ts}
- `unwrap`{lang=ts}: Whether to unwrap the content or not. This is useful when you want to extract the content nested in native Markdown syntax. Each specified tag will get removed from AST.
- Type: `Boolean`{lang=ts} or `String`{lang=ts}
- Type: `boolean`{lang=ts} or `string`{lang=ts}
- Default: `false`{lang=ts}
- Example: `'ul li'`{lang=ts}

Expand Down
10 changes: 5 additions & 5 deletions docs/content/4.api/2.composables/1.query-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ These options are given to [Intl.Collator()](https://developer.mozilla.org/en-US
## `limit(count)`

- `count`{lang="ts"}
- Type: `Number`{lang="ts"}
- Type: `number`{lang="ts"}
- **Required**

Limit number of results.
Expand All @@ -109,7 +109,7 @@ const articles = await queryContent('articles').limit(5).find()
## `skip(count)`

- `count`{lang=ts}
- Type: `Number`{lang=ts}
- Type: `number`{lang=ts}
- **Required**

Skip results.
Expand All @@ -125,7 +125,7 @@ const articles = await queryContent('articles')
## `without(keys)`

- `keys`{lang=ts}
- Type: `Array`{lang=ts} or `String`{lang=ts}
- Type: `string[]`{lang=ts} or `string`{lang=ts}
- **Required**

Remove a subset of fields.
Expand All @@ -139,7 +139,7 @@ const articles = await queryContent('articles').without(['unused-key', 'another-
## `only(keys)`

- `keys`{lang=ts}
- Type: `Array`{lang=ts} or `String`{lang=ts}
- Type: `string[]`{lang=ts} or `string`{lang=ts}
- **Required**

Select a subset of fields.
Expand Down Expand Up @@ -170,7 +170,7 @@ const firstArticle = await queryContent('articles').findOne()
## `findSurround(path, options)`

- `path`{lang=ts}
- Type: `String`{lang=ts}
- Type: `string`{lang=ts}
- **Required**
- `options`{lang=ts}
- Type: `{ before: number, after: number }`{lang=ts}
Expand Down
22 changes: 11 additions & 11 deletions docs/content/4.api/2.composables/6.use-content-head.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ It is already implemented for you in both [`<ContentDoc />`](/api/components/con
These parameters can be used from the [Front-Matter](/guide/writing/markdown#front-matter) section of your pages.

| Key | Type | Default | Description |
| ------------------ | ------------------ | -------------------- | ------------------------------------------------------------------------------------------------ |
| `head` | `Object` | | A [useHead](https://nuxt.com/docs/api/composables/use-head) compatible object |
| `title` | `String` | | Will be used as the default value for `head.title` |
| `head.title` | `String` | Parsed `title` | Sets the `<title>` tag |
| `description` | `String` | | Will be used as the default value for `head.description` |
| `head.description` | `String` | Parsed `description` | Sets the `<meta name="description">` tag |
| `image` | `String \| Object` | | Will be used as the default value for `head.image` |
| `image.src` | `String` | | The source of the image |
| `image.alt` | `String` | | The alt description of the image |
| `image.xxx` | `String` | | Any [`og:image:xxx` compatible](https://ogp.me/#structured) attribute |
| `head.image` | `String \| Object` | | Overrides the `<meta property="og:image">` |
| ------------------ | :----------------: | -------------------- | ------------------------------------------------------------------------------------------------ |
| `head` | `object` | | A [useHead](https://nuxt.com/docs/api/composables/use-head) compatible object |
| `title` | `string` | | Will be used as the default value for `head.title` |
| `head.title` | `string` | Parsed `title` | Sets the `<title>` tag |
| `description` | `string` | | Will be used as the default value for `head.description` |
| `head.description` | `string` | Parsed `description` | Sets the `<meta name="description">` tag |
| `image` | `string \| object` | | Will be used as the default value for `head.image` |
| `image.src` | `string` | | The source of the image |
| `image.alt` | `string` | | The alt description of the image |
| `image.xxx` | `string` | | Any [`og:image:xxx` compatible](https://ogp.me/#structured) attribute |
| `head.image` | `string \| object` | | Overrides the `<meta property="og:image">` |

At the exception of `title`, `description` and `image`, the `head` object behaves exactly the same in [Front-Matter](/guide/writing/markdown#front-matter) as it would in [`useHead({ ... })`](https://nuxt.com/docs/api/composables/use-head) composable.

Expand Down
34 changes: 17 additions & 17 deletions docs/content/4.api/3.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default defineNuxtConfig({

## `api`

- Type: `Record<String, any>`{lang=ts}
- Type: `Record<string, any>`{lang=ts}
- Default: `{ baseURL: '/api/_content' }`{lang=ts}

Change default behaviour of Content APIs.
Expand All @@ -35,7 +35,7 @@ export default defineNuxtConfig({

## `watch`

- Type: `Object | false`{lang=ts}
- Type: `object | false`{lang=ts}
- Default: `{ port: 4000, showUrl: true }`{lang=ts}

Disable content watcher and hot content reload.
Expand Down Expand Up @@ -74,7 +74,7 @@ export default defineNuxtConfig({

## `sources`

- Type: `Record<String, Object>`{lang=ts}
- Type: `Record<string, object>`{lang=ts}
- Default: `{}`{lang=ts}

Define different sources for contents.
Expand Down Expand Up @@ -184,14 +184,14 @@ When adding a new plugin, make sure to install it in your dependencies.

### `mdc`

- Type: `Boolean`{lang=ts}
- Type: `boolean`{lang=ts}
- Default: `true`{lang=ts}

Whether MDC syntax should be supported or not.

### `toc`

- Type: `Object`{lang=ts}
- Type: `object`{lang=ts}
- Default: `{ depth: 2, searchDepth: 2 }`{lang="ts"}

Control behavior of Table of Contents generation.
Expand All @@ -201,7 +201,7 @@ Control behavior of Table of Contents generation.

### `tags`

- Type: `Object`{lang=ts}
- Type: `object`{lang=ts}

Tags will be used to replace markdown components and render custom components instead of default ones.

Expand All @@ -219,7 +219,7 @@ export default defineNuxtConfig({

### `anchorLinks`

- Type: `Boolean | Object`{lang=ts}
- Type: `boolean | object`{lang=ts}
- Default: `{depth: 4, exclude: [1]}`{lang=ts}

By default, the Content module generates anchor links for `h2`, `h3` and `h4` headings. Using this option, you can control link generation.
Expand All @@ -237,7 +237,7 @@ By default, the Content module generates anchor links for `h2`, `h3` and `h4` he

## `highlight`

- Type: `false | Object`{lang=ts}
- Type: `false | object`{lang=ts}

Nuxt Content uses [Shiki](https://github.com/shikijs/shiki) to provide syntax highlighting for [`ProseCode`](/api/components/prose#prosecode) and [`ProseCodeInline`](/api/components/prose#prosecodeinline).

Expand Down Expand Up @@ -328,14 +328,14 @@ Read more about adding languages in the [Shiki documentation](https://github.com

## `yaml`

- Type: `false | Object`{lang=ts}
- Type: `false | object`{lang=ts}
- Default: `{}`{lang=ts}

Options for yaml parser.

## `navigation`

- Type: `false or Object`{lang=ts}
- Type: `false | object`{lang=ts}
- Default: `true`{lang=ts}

Configure the navigation feature.
Expand All @@ -350,14 +350,14 @@ Can be set to `false` to disable the feature completely.

## `locales`

- Type: `Array<String>`{lang=ts}
- Type: `string[]`{lang=ts}
- Default: `[]`{lang=ts}

List of locale codes. This codes will be used to detect contents locale.

## `defaultLocale`

- Type: `String`{lang=ts}
- Type: `string`{lang=ts}
- Default: `undefined`{lang=ts}

Default locale for top level contents. Module will use first locale code from `locales` array if this option is not defined.
Expand All @@ -368,7 +368,7 @@ Note that in case of defining multiple locales, Module will filter content with

## `documentDriven`

- Type: `Boolean | Object`{lang=ts}
- Type: `boolean | object`{lang=ts}
- Default: `false`{lang=ts}

Toggles the document-driven mode.
Expand Down Expand Up @@ -403,10 +403,10 @@ Toggles the document-driven mode.

| Option | Type | Description |
| ----------------- | :-----------------: | :------------------------------------------------------------- |
| `page` | `Boolean` | Enables the page binding, making it globally accessible. |
| `navigation` | `Boolean` | Enables the navigation binding, making it globally accessible. |
| `surround` | `Boolean` | Enables the surround binding, making it globally accessible. |
| `globals` | `Object \| Boolean` | A list of globals to be made available globally. |
| `page` | `boolean` | Enables the page binding, making it globally accessible. |
| `navigation` | `boolean` | Enables the navigation binding, making it globally accessible. |
| `surround` | `boolean` | Enables the surround binding, making it globally accessible. |
| `globals` | `object \| boolean` | A list of globals to be made available globally. |
| `layoutFallbacks` | `string[]` | A list of `globals` key to use to find a layout fallback. |
| `injectPage` | `boolean` | Inject `[...slug].vue` pre-configured page |
| `trailingSlash` | `boolean` | Add a slash at the end of `canonical` and `og:url` |
8 changes: 4 additions & 4 deletions docs/content/4.api/4.advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ Allows you to modify the contents of a file before it is handled by the parsers.
Arguments:

- file
- Type: `Object`
- Type: `object`
- Properties:
- _id: `String`
- body: `String`
- _id: `string`
- body: `string`

### Example

Expand Down Expand Up @@ -60,7 +60,7 @@ import { visit } from 'unist-util-visit'
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('content:file:afterParse', (file) => {
if (file._id.endsWith('.md')) {
visit(file.body, (n:any) => n.tag === 'img', (node) => {
visit(file.body, (n: any) => n.tag === 'img', (node) => {
file.coverImage = node.props.src
})
}
Expand Down