Skip to content

Commit

Permalink
docs: Typos and syntax fixes (#2920)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptdev authored Dec 20, 2024
1 parent 17ebcef commit efceeed
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 16 deletions.
18 changes: 9 additions & 9 deletions docs/content/docs/1.getting-started/4.migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@ description: How to migrate from v2 to v3

Nuxt Content v3 has been rebuilt from the ground up, resulting in a new library with enhanced capabilities. While we've redesigned concepts and components in a similar way as Content v2, breaking changes are inevitable.

Don't worry, you don't need to modify your content files, We made sure that Content v3 handles content in the same way as Content v2.
Don't worry, you don't need to modify your content files. We made sure that Content v3 handles content in the same way as Content v2.

## Changes

### Query/Find Contents

- `queryContent()` API is replaced with new `queryCollection()`
- New API is backed by SQL
- New API search contents within the specific collection
- New API searches contents within a specific collection
- `fetchContentNavigation()` API is replaced with new `queryCollectionNavigation()`
- Surroundings now has its own separate API `queryCollectionItemSurroundings()`
- Document driven mode is fully dropped, meaning:
- Markdown files will not convert to Nuxt pages automatically, you need to create pages, see [how](/docs/components/content-renderer#example)
- `useContent()` composable is removed
- `searchContent()` is dropped in favor of new api `queryCollectionSearchSections`
- `searchContent()` is dropped in favor of new API `queryCollectionSearchSections`
- Full text search can easily be done using this API See [Full-Text Search Snippets](/docs/advanced/fulltext-search)

### Rendering Components

- Every content should be rendered using `<ContentRenderer>` component. `<ContentDoc>`, `<ContentList>`, `<ContentNavigation>` and `<ContentQuery>` components are dropped in v3.
- All content should be rendered using `<ContentRenderer>` component. `<ContentDoc>`, `<ContentList>`, `<ContentNavigation>` and `<ContentQuery>` components are dropped in v3.
- `<ContentSlot>` and `<MDCSlot>` components are not supported in v3. Instead components can simply use Vue's native `<slot>` component.
- One of the main reasons for existance of `<ContentSlot>` and `<MDCSlot>` was to manipulate content before rendering and removing wrapping paragraphs from slot content. This unwrapping behavior is now supported via `mdc-unwrap` attribute in `<slot>` component. example: `<slot mdc-unwrap="p" />`
- One of the main reasons for existence of `<ContentSlot>` and `<MDCSlot>` was to manipulate content before rendering and removing wrapping paragraphs from slot content. This unwrapping behavior is now supported via `mdc-unwrap` attribute in `<slot>` component. example: `<slot mdc-unwrap="p" />`
- We consolidated the `ProsePre`, `ProseCode`, and `ProseCodeInline` components
- `ProseCodeInline` is now `ProseCode`
- `ProseCode` is now `ProsePre`

### General Changes

- `_dir.yml` files are renamed to `.navigation.yml`
- There is no source option in module options, instead you can define multiple source for your collections in `content.config.ts`.
- There is no source option in module options, instead you can define multiple sources for your collections in `content.config.ts`.
- Document `._path` is now renamed to `.path`, likewise all internal fields with `_` prefix are removed or renamed.
- `useContentHelpers()` is removed

Expand Down Expand Up @@ -65,8 +65,8 @@ const { data: page } = await useAsyncData(route.path, () => {

As we mentioned above, `queryContent` is dropped in favor of new collection based `queryCollection`. There are two main differences between these two:

1. `queryCollection` is building a query for SQL database.
2. `queryCollection` do the search only inside the specific collection. You should know the collection.
1. `queryCollection` is building a query for an SQL database.
2. `queryCollection` does the search only inside the specified collection. You should know the collection's name (key on config).

```ts [Find content with path]
// Content v2
Expand All @@ -88,7 +88,7 @@ const v3Query = await queryCollection('content')

## Convert `queryContent().findSurround()`

Surround now has it's own separate API.
Surround now has its own separate API.

```ts
const targetPath = '/docs'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"@types/ws": "^8.5.13",
"csvtojson": "^2.0.10",
"eslint": "^9.17.0",
"mdclint": "^0.0.1",
"mdclint": "^0.0.2",
"micromark-util-types": "^2.0.1",
"nuxt": "^3.14.1592",
"release-it": "^17.10.0",
Expand Down
30 changes: 24 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit efceeed

Please sign in to comment.