Skip to content

Commit

Permalink
Merge branch 'main' into fix/link-handler
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz authored Oct 25, 2022
2 parents 463fd0f + 6463e46 commit 8c1f82f
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion docs/content/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Powerful Features
#title
Code highlighting
#description
Display beautiful code blocks in your website with the Shiki integration supporting VS Code themes.
Display beautiful code blocks on your website with the Shiki integration supporting VS Code themes.
::

::card
Expand Down
2 changes: 1 addition & 1 deletion docs/content/2.get-started.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Get Started
description: How to start with Nuxt Content, by creating a fresh new project or adding it to your Nuxt application.
description: How to get started with Nuxt Content by creating a new project or adding it to an existing Nuxt application.
icon: heroicons-outline:lightning-bolt
layout: page
constrainedClass: 'max-w-4xl'
Expand Down
6 changes: 3 additions & 3 deletions docs/content/3.guide/1.writing/2.markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Nuxt Content uses the Markdown syntax and conventions to provide a rich-text edi

## Prose

In Nuxt Content, Prose represents the HTML tags output from the Markdown syntax, for example title levels, links... A Vue component corresponds to each tag, allowing you to override them if needed.
In Nuxt Content, Prose represents the HTML tags generated by the Markdown syntax, such as title levels and links. A Vue component corresponds to each tag, allowing you to override them if needed.

::alert{type=info}
Read the complete Prose reference in the [API section](/api/components/prose)
Expand Down Expand Up @@ -36,7 +36,7 @@ If you want to customize a Prose component, here are the recommended steps:

- Checkout the original [component sources](https://github.com/nuxt/content/tree/main/src/runtime/components/Prose).
- Use the exact same props.
- Name it the same in your `components/content/` directory.
- In your `components/content/` directory, give it the same name.
- Make it yours 🚀.

## Front-matter
Expand Down Expand Up @@ -100,7 +100,7 @@ Example variables will be injected into the document:

## Code Highlighting

Code highlighting allows you to display beautiful code blocks in your website.
Code highlighting allows you to display beautiful code blocks on your website.

Nuxt Content uses [Shiki](https://github.com/shikijs/shiki), that colors tokens with VSCode themes.

Expand Down
2 changes: 1 addition & 1 deletion docs/content/3.guide/1.writing/3.mdc.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ Attributes are useful for highlighting and modifying part of paragraph. The synt
::
::

Other than `span`s the attribute syntax will work on images, links, `code`, **bold** and _italic_ texts.
Other than `spans` the attribute syntax will work on images, links, `code`, **bold** and _italic_ texts.

::code-group

Expand Down
10 changes: 5 additions & 5 deletions docs/content/3.guide/1.writing/7.document-driven.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default defineNuxtConfig({

### Fresh project

Start with a fresh project with the document driven mode enabled:
Start a new project with the document-driven mode enabled:

::code-group
```bash [npx]
Expand Down Expand Up @@ -53,11 +53,11 @@ my-project/
tsconfig.json
```
It comes with a direct binding between your page’s metadada to the OpenGraph tags using the [useContentHead() composable](/api/composables/use-content-head), providing effective SEO with no configuration.
It comes with a direct binding between your page's meta data to the OpenGraph tags using the [useContentHead() composable](/api/composables/use-content-head), providing effective SEO with no configuration.
### Page slots
That page comes with 2 slot components that you can replace at your project level.
The page comes with 2 slot components that you can replace at your project level.
To do so, you only have to create a component with the same name in your project `components/` directory.
Expand Down Expand Up @@ -213,7 +213,7 @@ definePageMeta({
```

::alert
If you change `page` option and leave `surround` unset, `surround` option will use same config and `page`.
If you change `page` option and leave `surround` unset, `surround` option will use the same config and `page`.
```html
<script setup lang="ts">
definePageMeta({
Expand All @@ -230,4 +230,4 @@ definePageMeta({

## Example

Jump into the [Document Driven Example](/examples/essentials/document-driven) to see a working example.
Jump into the [Document Driven Example](/examples/essentials/document-driven) to see a working example.
6 changes: 3 additions & 3 deletions docs/content/3.guide/2.displaying/1.rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Nuxt Content provides 2 components to render Markdown content in a rich-text for
- The `<ContentRenderer>` component renders a Markdown document returned by [`queryContent()`](/guide/displaying/querying).

::alert
`<ContentDoc>` and `<ContentRenderer />` components are auto-imported so any component or page can use it.
`<ContentDoc>` and `<ContentRenderer />` components are auto-imported, so any component or page can use them.
::

## `<ContentDoc />`
Expand All @@ -17,7 +17,7 @@ The `<ContentDoc>` component fetches a document and renders it in a rich-text fo

The fetching endpoint defaults to the current route (`$route.path`). An explicit path can be passed to the component with the `path` props.

Create a [catch all route](https://v3.nuxtjs.org/guide/directory-structure/pages/#catch-all-route) named `pages/[...slug].vue` and the component:
Create a [catch all route](https://v3.nuxtjs.org/guide/directory-structure/pages/#catch-all-route) named `pages/[...slug].vue` and add the component:

```vue [pages/[...slug].vue]
<template>
Expand All @@ -39,7 +39,7 @@ You can use the `<ContentDoc>` component to render a specific document by specif
</template>
```

Note that no head management will be made when the `path` is specified.
Note that no head management will be done when the `path` is specified.

Take a look at the [Hello world](/examples/essentials/hello-world) example to see it in action.

Expand Down
4 changes: 2 additions & 2 deletions docs/content/3.guide/2.displaying/3.navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ It allows you to create advanced navigation components without having to maintai

## Structure

The navigation object can be seen as a tree representing in a JSON format the structure of your content sources.
The navigation object can be seen as a tree, representing the structure of your content sources in JSON format.

It is divided in two type of nodes, **pages** and **directories**.
It is divided into two types of nodes: **pages** and **directories**.

::code-group

Expand Down
4 changes: 2 additions & 2 deletions docs/content/3.guide/2.displaying/4.typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ The module exposes typings properly from configuration to query builder.

When using `queryContent()`{lang="ts"}, you will retrieve a [`QueryBuilder`](https://github.com/nuxt/content/blob/main/src/runtime/types.d.ts#L128) instance.

Once using one of the fetching methods (`find()`{lang="ts"}, `findOne()`{lang="ts"}, `findSurround()`{lang="ts"}), you will retrieve an object of type [`ParsedContent`](https://github.com/nuxt/content/blob/main/src/runtime/types.d.ts#L128).
Once you use one of the fetching methods (`find()`{lang="ts"}, `findOne()`{lang="ts"}, `findSurround()`{lang="ts"}), you will retrieve an object of type [`ParsedContent`](https://github.com/nuxt/content/blob/main/src/runtime/types.d.ts#L128).

## Type augmentation

If you are adding keys to front-matter other than the [defaults key](/guide/writing/markdown#front-matter), you might want to have typings over these.
If you are adding keys to the front-matter other than the [default keys](/guide/writing/markdown#front-matter), you might want to have typings over these.

This is currently possible, yet not in an _optimal_ way.

Expand Down
6 changes: 3 additions & 3 deletions docs/content/3.guide/3.recipes/1.sitemap.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Sitemap

A sitemap file is useful for helping Google to better index your website, ensuring that the content you write can be visible on search results.
A sitemap file is useful for helping Google to better index your website, ensuring that the content you write can be visible in search results.

This can be created utilising the `sitemap` library, so you'll need to install that which can be done like so:
This can be created by utilising the `sitemap` library, which can be installed as follows:

::code-group
```bash [yarn]
Expand All @@ -18,7 +18,7 @@ This can be created utilising the `sitemap` library, so you'll need to install t

## Server Route

We will be utilising the [server routes](https://v3.nuxtjs.org/guide/features/server-routes) available within Nuxt, and to do so you'll need to create the `server/` directory within your websites root directly.
We will be utilising the [server routes](https://v3.nuxtjs.org/guide/features/server-routes) available within Nuxt, and to do so you'll need to create the `server/` directory within your website's root directly.

Once this is done, create a `routes/` directory inside this, and add a `sitemap.xml.ts` file, this will translate to `/sitemap.xml`.

Expand Down
10 changes: 5 additions & 5 deletions docs/content/3.guide/5.migration/1.from-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ There is no global `$content` variable, instead you can use `queryContent` compo
+ const { data: posts } = await useAsyncData('posts-list', () => queryContent('/blog').only(['title']).find())
```

`queryContent` provide same utilities as legacy `$content` with some improvements:
`queryContent` provides same utilities as legacy `$content` with some improvements:

- `fetch` dropped in favor of new find utils
- [`find`](/api/composables/query-content#find): retrieve a list of contents
- [`findOne`](/api/composables/query-content#findOne): retrive first matched content
- [`findOne`](/api/composables/query-content#findOne): retrieve first matched content
- `surround` dropped in favor of [`findSurround`](/api/composables/query-content#findSurround)
- [`where`](/api/composables/query-content#where) utility can be chained

Expand All @@ -58,19 +58,19 @@ There is no global `$content` variable, instead you can use `queryContent` compo
```

- There is no `search` utility for full text search.
- Find utilities does not contains body of documents and they only include meta information of parsed contents. You can fetch contents body using `getContentDocument`(non-reactive) or `useContentDocument`(reactive) composables
- Find utilities does not contain body of documents and they only include meta information of parsed contents. You can fetch the body's contents using `getContentDocument`(non-reactive) or `useContentDocument`(reactive) composables

```js
const doc = await getContentDocument(post.id)
```

- There is new [`findNavigation`](/api/composables/query-content#findnavigation) utility to retrieve navigation object
- There is a new [`findNavigation`](/api/composables/query-content#findnavigation) utility to retrieve navigation object

## Rendering Content

`<NuxtContent>` component removed in favor of a `<ContentRenderer>` component.

`<ContentDoc>` component receive document path then fetch and render the document.
`<ContentDoc>` component receives a document path and then fetches and renders the document.

```vue
<script setup lang="ts">
Expand Down
4 changes: 2 additions & 2 deletions docs/content/4.api/1.components/4.content-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ The `<ContentQuery>`{lang=html} component fetches a document and gives access to
- `without`{lang=ts}: Remove a subset of fields from an array of keys.
- Type: `Array<String>`{lang=ts}
- Default: `undefined`{lang=ts}
- `where`{lang=ts}: Filter results with a where clause definition.
- `where`{lang=ts}: Filter results with a `where` clause definition.
- Type: `{ [key: string]: any }`{lang=ts}
- Default: `undefined`{lang=ts}
- `sort`: Sort results with a sort clause definition.
- `sort`{lang=ts}: Sort results with a `sort` clause definition.
- Type: `SortParams`{lang=ts}
- Default: `undefined`{lang=ts}
- `limit`{lang=ts}: Limit the amount of results.
Expand Down
2 changes: 1 addition & 1 deletion docs/content/4.api/1.components/7.prose.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ To overwrite a prose component, create a component with the same name in your pr

::

Check out [highlight options](/api/configuration#highlight) for more about the syntax highlighting.
Check out the [highlight options](/api/configuration#highlight) for more about the syntax highlighting.

## `ProseCodeInline`

Expand Down
6 changes: 3 additions & 3 deletions docs/content/4.api/2.composables/1.query-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const articles = await queryContent('articles').where({ age: { $gt: 18 } }).find
const articles = await queryContent('articles').where({ name: { $in: ['odin', 'thor'] } }).find()
```

In order to filter in objects and array you can use nested properties style:
In order to filter in objects and an array or arrays, you can use the nested properties style:

```ts
const products = await queryContent('products').where({ 'categories': { $contains: 'top' } }).find()
Expand Down Expand Up @@ -153,7 +153,7 @@ const articles = await queryContent('articles').find()

## `findOne()`

Fetch first matched content.
Fetch the first match of content.

```ts
const firstArticle = await queryContent('articles').findOne()
Expand All @@ -168,7 +168,7 @@ const firstArticle = await queryContent('articles').findOne()
- Type: `{ before: number, after: number }`{lang=ts}
- Default: `{ before: 1, after: 1 }`{lang=ts}

Get previous and next results around the path. The path should be full path of the target content.
Get the previous and next results around the path. The path should be the full path of the target content.

You will always obtain an array of fixed length filled with the matching document or null.

Expand Down
10 changes: 5 additions & 5 deletions docs/content/4.api/3.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ The watcher is a development feature and will not be included in production.

Define different sources for contents.

Contents can located in multiple places, in multiple directories or in remote git repositories.
Contents can be located in multiple places, in multiple directories, or in remote git repositories.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
Expand Down Expand Up @@ -167,7 +167,7 @@ Whether MDC syntax should be supported or not.

Control behavior of Table of Contents generation.

- `depth`{lang=ts}: Maximum heading depth to includes in the table of contents.
- `depth`{lang=ts}: Maximum heading depth to include in the table of contents.
- `searchDepth`{lang=ts}: Maximum depth of nested tags to search for heading.

### `tags`
Expand All @@ -193,7 +193,7 @@ export default defineNuxtConfig({
- Type: `Boolean | Object`{lang=ts}
- Default: `{depth: 4, exclude: [1]}`{lang=ts}

By default Content module generates anchor links for `h2`, `h3` and `h4` heading. Using this option you can control link generation.
By default, the Content module generates anchor links for `h2`, `h3` and `h4` headings. Using this option, you can control link generation.

`false`{lang=ts} will disable link generation.

Expand All @@ -204,7 +204,7 @@ By default Content module generates anchor links for `h2`, `h3` and `h4` heading
| Option | Type | Description |
| ------- | :--------: | :------------------------------------------------------- |
| depth | `number` | Sets the maximal depth for anchor link generation. |
| exclude | `number[]` | A list of which headings to exclude from link generation |
| exclude | `number[]` | A list of headings to exclude from link generation. |


## `highlight`
Expand Down Expand Up @@ -252,7 +252,7 @@ export default defineNuxtConfig({

By default, module preloads couple of languages for syntax highlighter: `['diff', 'json', 'js', 'ts', 'css', 'shell', 'html', 'md', 'yaml']`{lang=ts}

If you plan to use code samples of other languages you need to define the language in this options.
If you plan to use code samples of other languages, you need to define the language in these options.

```ts
export default defineNuxtConfig({
Expand Down
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 @@ -77,10 +77,10 @@ Internally, the module has specific transformers for each content type to parse
You can create custom transformers to support new content types or improve functionalities of supported content types.

1. Create your transformer. A transformer consists of 4 parts:
- `name`: Transformer name
- `extensions`: List of valid file extensions
- `parse`: If provided this function will be used to parsed the raw content
- `transform`: Received that parsed content and manipulate the content.
- `name`: Transformer name.
- `extensions`: List of valid file extensions.
- `parse`: If provided, this function will be used to parse the raw content.
- `transform`: Receives that parsed content and manipulates it.

```ts [my-transformer.ts]
// filename: my-transformer.ts
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/plugins/documentDriven.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ export default defineNuxtPlugin((nuxt) => {
// Prefetch layout component
const layout = layouts[layoutName]

if (layout && layout?.__asyncLoader && !layout.__asyncResolved) {
await layout.__asyncLoader()
if (layout && typeof layout === 'function') {
await layout()
}
// Apply layout
to.meta.layout = layoutName
Expand Down

0 comments on commit 8c1f82f

Please sign in to comment.