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

v2.2.0 #1618

Merged
merged 43 commits into from
Oct 19, 2022
Merged

v2.2.0 #1618

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d3e9aa7
chore: update deps
atinux Sep 16, 2022
af8c7b8
perf(build): build caches before pre-rendering contents (#1530)
farnabaz Sep 16, 2022
7b74e70
fix(module): make `documentDriven` configs optional (#1539)
farnabaz Sep 20, 2022
e610874
docs: fix type `client only` -> `client-only` (#1535)
saideepesh000 Sep 20, 2022
5fc042b
feat(document-driven): support `navigation.redirect` from `_dir` file…
farnabaz Sep 21, 2022
9c6c4d7
docs(content-list): Updated query reference and added example (#1548)
itpropro Sep 27, 2022
0cfc71c
feat: spa mode (#1525)
farnabaz Sep 29, 2022
451b000
fix: add missing imports
farnabaz Sep 29, 2022
cd15c8e
docs: add search (#1575)
atinux Oct 4, 2022
9e91948
docs: update algolia key
atinux Oct 4, 2022
f9f161b
fix: missing imports on preview mode
atinux Oct 5, 2022
cb7679e
fix: use relative `.md` link (#1556)
kecrily Oct 5, 2022
b88b557
fix(module): multi-source array (#1578)
farnabaz Oct 5, 2022
428cf8f
chore: update Docus
atinux Oct 5, 2022
7950573
chore(deps): update all non-major dependencies (#1524)
renovate[bot] Oct 6, 2022
eecf41f
fix(navigation): missing composable when navigation is disabled (#1577)
farnabaz Oct 6, 2022
a2e29e7
chore(deps): lock file maintenance (#1518)
renovate[bot] Oct 6, 2022
bc01cde
fix: ignore built content in preview mode
farnabaz Oct 6, 2022
1dba43f
docs: cleanup deps (#1582)
farnabaz Oct 6, 2022
c76c5a7
docs: upgrade Content version
farnabaz Oct 6, 2022
7afd857
fix(ClientDB): drop LocalStorage
farnabaz Oct 7, 2022
a3376ef
docs: broken link on Markdown API page (#1588)
edimitchel Oct 8, 2022
c11a480
fix(client-db): race-condition on multiple calls
farnabaz Oct 10, 2022
5d29a37
chore: add missing dep
atinux Oct 10, 2022
c2eb55d
docs(composables): fix close tag ContentRenderer (#1597)
ramsesgarate Oct 12, 2022
49b1c4c
docs: update badge style
atinux Oct 12, 2022
ba2aeb4
docs: update cover
atinux Oct 12, 2022
558add0
chore: remove preview plugin
farnabaz Oct 12, 2022
b455d0c
feat: config for anchor link generation of headings (#1564)
nobkd Oct 13, 2022
4a2937c
fix(`<ContentList>`): respect `query.path` when `path` is missing (#1…
farnabaz Oct 13, 2022
2f410e8
fix(`<ContentDoc>`): render blink in SSG (#1600)
farnabaz Oct 14, 2022
0b781f1
fix: update h3 usage with explicit `defineEventHandler` (#1603)
pi0 Oct 16, 2022
005fdfd
fix(anchorLinks): add useRuntimeConfig imports (#1605)
nobkd Oct 16, 2022
b6bbb42
docs: no need to register manually nitro plugin
atinux Oct 18, 2022
0259a90
docs: fix nitro plugins link
atinux Oct 18, 2022
15842a4
fix(runtime): detect 404 api responses in SSG (#1608)
farnabaz Oct 18, 2022
5ec049d
fix(`queryContent`): use path argument as prefix if there is another …
farnabaz Oct 18, 2022
98271a7
feat(parser): introduce `_dir` field in contents (#1613)
farnabaz Oct 18, 2022
2a92bab
docs: update `findSurround` usage (#1609)
farnabaz Oct 18, 2022
80e82a7
docs: guidance on using local images (#1617)
remiconnesson Oct 18, 2022
627cb64
chore(deps): update all non-major dependencies (#1587)
renovate[bot] Oct 19, 2022
0b56bac
chore(deps): lock file maintenance (#1591)
renovate[bot] Oct 19, 2022
23f9d7e
chore(release): release v2.2.0
farnabaz Oct 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 74 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,80 @@
# Changelog


## main (v2.1.0..v2.1.1)
## v2.2.0

[compare changes](https://github.com/nuxt/content/compare/v2.1.1...v2.2.0)


### 🚀 Enhancements

- **document-driven:** Support `navigation.redirect` from `_dir` files ([#1545](https://github.com/nuxt/content/pull/1545))
- Spa mode ([#1525](https://github.com/nuxt/content/pull/1525))
- Config for anchor link generation of headings ([#1564](https://github.com/nuxt/content/pull/1564))
- **parser:** Introduce `_dir` field in contents ([#1613](https://github.com/nuxt/content/pull/1613))

### 🔥 Performance

- **build:** Build caches before pre-rendering contents ([#1530](https://github.com/nuxt/content/pull/1530))

### 🩹 Fixes

- **module:** Make `documentDriven` configs optional ([#1539](https://github.com/nuxt/content/pull/1539))
- Add missing imports ([451b000e](https://github.com/nuxt/content/commit/451b000e))
- Missing imports on preview mode ([f9f161b1](https://github.com/nuxt/content/commit/f9f161b1))
- Use relative `.md` link ([#1556](https://github.com/nuxt/content/pull/1556))
- **module:** Multi-source array ([#1578](https://github.com/nuxt/content/pull/1578))
- **navigation:** Missing composable when navigation is disabled ([#1577](https://github.com/nuxt/content/pull/1577))
- Ignore built content in preview mode ([bc01cde3](https://github.com/nuxt/content/commit/bc01cde3))
- **ClientDB:** Drop LocalStorage ([7afd857b](https://github.com/nuxt/content/commit/7afd857b))
- **client-db:** Race-condition on multiple calls ([c11a4800](https://github.com/nuxt/content/commit/c11a4800))
- **`<ContentList>`:** Respect `query.path` when `path` is missing ([#1598](https://github.com/nuxt/content/pull/1598))
- **`<ContentDoc>`:** Render blink in SSG ([#1600](https://github.com/nuxt/content/pull/1600))
- Update h3 usage with explicit `defineEventHandler` ([#1603](https://github.com/nuxt/content/pull/1603))
- **anchorLinks:** Add useRuntimeConfig imports ([#1605](https://github.com/nuxt/content/pull/1605))
- **runtime:** Detect 404 api responses in SSG ([#1608](https://github.com/nuxt/content/pull/1608))
- **`queryContent`:** Use path argument as prefix if there is another condition ([#1612](https://github.com/nuxt/content/pull/1612))

### 📖 Documentation

- Fix type `client only` -> `client-only` ([#1535](https://github.com/nuxt/content/pull/1535))
- **content-list:** Updated query reference and added example ([#1548](https://github.com/nuxt/content/pull/1548))
- Add search ([#1575](https://github.com/nuxt/content/pull/1575))
- Update algolia key ([9e91948e](https://github.com/nuxt/content/commit/9e91948e))
- Cleanup deps ([#1582](https://github.com/nuxt/content/pull/1582))
- Upgrade Content version ([c76c5a75](https://github.com/nuxt/content/commit/c76c5a75))
- Broken link on Markdown API page ([#1588](https://github.com/nuxt/content/pull/1588))
- **composables:** Fix close tag ContentRenderer ([#1597](https://github.com/nuxt/content/pull/1597))
- Update badge style ([49b1c4cc](https://github.com/nuxt/content/commit/49b1c4cc))
- Update cover ([ba2aeb45](https://github.com/nuxt/content/commit/ba2aeb45))
- No need to register manually nitro plugin ([b6bbb42c](https://github.com/nuxt/content/commit/b6bbb42c))
- Fix nitro plugins link ([0259a901](https://github.com/nuxt/content/commit/0259a901))
- Update `findSurround` usage ([#1609](https://github.com/nuxt/content/pull/1609))
- Guidance on using local images ([#1617](https://github.com/nuxt/content/pull/1617))

### 🏡 Chore

- Update deps ([d3e9aa70](https://github.com/nuxt/content/commit/d3e9aa70))
- Update Docus ([428cf8f8](https://github.com/nuxt/content/commit/428cf8f8))
- Add missing dep ([5d29a377](https://github.com/nuxt/content/commit/5d29a377))
- Remove preview plugin ([558add0c](https://github.com/nuxt/content/commit/558add0c))

### ❤️ Contributors

- Ahad Birang
- Jan-Henrik Damaschke
- Michel EDIGHOFFER
- Nobkd
- Percy Ma
- Pooya Parsa
- Ramses Garate
- Remiconnesson
- Sai Deepesh
- Sébastien Chopin

## v2.1.1

[compare changes](https://github.com/nuxt/content/compare/v2.1.0...v2.1.1)

### 🩹 Fixes

Expand All @@ -22,8 +94,7 @@
- Okoro Redemption
- Sébastien Chopin

## main (v2.0.1..v2.1.0)

## v2.1.0

### 🚀 Enhancements

Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[![nuxt-content](/docs/public/cover.jpg "@nuxt/content cover")](https://content.nuxtjs.org)
[![nuxt-content](https://user-images.githubusercontent.com/904724/195312457-e43879c3-f1cc-4b95-9531-e54582aaff47.png "@nuxt/content cover")](https://content.nuxtjs.org)

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]
[![License][license-src]][license-href]

# Nuxt Content
Expand Down Expand Up @@ -42,14 +41,12 @@ Nuxt 2 is supported with Content v1, documentation is on https://content.nuxtjs.
[MIT](./LICENSE) - Made with 💚


[npm-version-src]: https://img.shields.io/npm/v/@nuxt/content/latest.svg
[npm-version-src]: https://img.shields.io/npm/v/@nuxt/content/latest.svg?style=flat&colorA=002438&colorB=28CF8D
[npm-version-href]: https://npmjs.com/package/@nuxt/content

[npm-downloads-src]: https://img.shields.io/npm/dt/@nuxt/content.svg
[npm-downloads-src]: https://img.shields.io/npm/dt/@nuxt/content.svg?style=flat&colorA=002438&colorB=28CF8D
[npm-downloads-href]: https://npmjs.com/package/@nuxt/content

[github-actions-ci-src]: https://github.com/nuxt/content/workflows/ci/badge.svg
[github-actions-ci-href]: https://github.com/nuxt/content/actions?query=workflow%3Aci
[license-src]: https://img.shields.io/github/license/nuxt/content.svg?style=flat&colorA=002438&colorB=28CF8D
[license-href]: https://github.com/nuxt/content/blob/main/LICENSE

[license-src]: https://img.shields.io/npm/l/@nuxt/content.svg
[license-href]: https://npmjs.com/package/@nuxt/content
12 changes: 3 additions & 9 deletions docs/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,12 @@ export default defineAppConfig({
alt: 'Content made easy for Vue developers'
},
aside: {
level: 1,
filter: [
'/v1',
'/content-v1',
'/fr',
'/ja',
'/ru'
]
level: 1
},
header: {
title: false,
logo: true
logo: true,
exclude: ['/v1', '/content-v1', '/fr', '/ja', '/ru']
},
footer: {
credits: {
Expand Down
22 changes: 22 additions & 0 deletions docs/content/3.guide/1.writing/2.markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,25 @@ Code highlighting works both on [`ProseCode`](/api/components/prose#prosecode) a
::alert{type=info}
[Read the API reference to configure or entirely disable syntax highlighting.](/api/configuration#highlight)
::

## Images

You can add images to your `public` directory:

```
my-project/
content/
index.md
public/
img/
image.png
nuxt.config.ts
package.json
tsconfig.json
```

And then use them in your markdown files in the `content` directory as such:

```md[content/index.md]
![my image](/img/image.png)
```
2 changes: 1 addition & 1 deletion docs/content/3.guide/4.deploy/2.static-hosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ defineNuxtConfig({
```

::alert{type=warning}
Nuxt Content highly depends on [Nuxt's server engine](https://v3.nuxtjs.org/guide/concepts/server-engine). The only way to have server engine in client only rendering is to use Service Workers.
Nuxt Content highly depends on [Nuxt's server engine](https://v3.nuxtjs.org/guide/concepts/server-engine). The only way to have server engine in client-only rendering is to use Service Workers.
::

22 changes: 21 additions & 1 deletion docs/content/4.api/1.components/2.content-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ An explicit `path`{lang=ts} can be given to the component.
- `path`{lang=ts}: The path of the content to load from content source.
- Type: `String`{lang=ts}
- Default: `'/'`{lang=ts}
- `query`{lang=ts}: A query to be passed to `queryContent()`.
- `query`{lang=ts}: A query builder params object to be passed to `<ContentQuery />` component.
- Type: `QueryBuilderParams`{lang=ts}
- Default: `undefined`{lang=ts}

Expand Down Expand Up @@ -48,3 +48,23 @@ An explicit `path`{lang=ts} can be given to the component.
</main>
</template>
```

## Query example

```html [pages/index.vue]
<script setup lang="ts">
import type { QueryBuilderParams } from '@nuxt/content/dist/runtime/types'
const query: QueryBuilderParams = { path: '/articles', where: { layout: 'article' }, limit: 5, sort: { date: -1 } }
</script>

<template>
<main>
<ContentList :query="query" v-slot="{ list }">
<div v-for="article in list" :key="article._path">
<h2>{{ article.title }}</h2>
<p>{{ article.description }}</p>
</div>
</ContentList>
</main>
</template>
```
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 @@ -3,7 +3,7 @@
The fastest way to inject Markdown into your Vue components.

::alert{type=danger}
**NOTE**: As of [email protected] this component is deprecated and replaced by [`<ContentSlot>`](./content-slot).
**NOTE**: As of [email protected] this component is deprecated and replaced by [`<ContentSlot>`](/api/components/content-slot).
::

The `<Markdown>`{lang=html} component makes it easier to use Markdown syntax in your Vue components.
Expand Down
9 changes: 5 additions & 4 deletions docs/content/4.api/2.composables/1.query-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,23 @@ 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 a specific path.
Get previous and next results around the path. The path should be full path of the target content.

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

```ts
const [prev, next] = await queryContent('articles')
const [prev, next] = await queryContent()
.only(['_path', 'title'])
.sort({ date: 1})
.where({ isArchived: false })
.findSurround('article-2')
.findSurround('/articles/article-2')

// Returns
[
{
title: 'Article 1',
path: 'article-1'
_path: '/articles/article-1'
//...
},
null // no article-3 here
]
Expand Down
2 changes: 1 addition & 1 deletion docs/content/4.api/2.composables/4.use-document-driven.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const { page } = useContent()
</script>

<template>
<ContentRenderer :key="page._id" :value="page">
<ContentRenderer :key="page._id" :value="page" />
</template>
```

Expand Down
27 changes: 20 additions & 7 deletions docs/content/4.api/3.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,7 @@ Whether MDC syntax should be supported or not.
### `toc`

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

Control behavior of Table of Contents generation.

Expand All @@ -194,6 +188,25 @@ export default defineNuxtConfig({
})
```

### `anchorLinks`

- 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.

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

`true`{lang=ts} will enable link generation for all headings.

**options**

| 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 |


## `highlight`

- Type: `false | Object`{lang=ts}
Expand Down
27 changes: 8 additions & 19 deletions docs/content/4.api/4.advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,16 @@ Nuxt Content is highly customizable, giving you freedom and control over how the

The module adds some hooks you can use:

`content:file:*` hooks are available in nitro runtime, in order to use them you need to create a custom [nitro plugin](https://nitro.unjs.io/guide/plugins.html).
`content:file:*` hooks are available in nitro runtime, in order to use them you need to create a custom [nitro plugin](https://nitro.unjs.io/guide/advanced/plugins).

- Create a plugin in the `server/plugins/` directory
Create a plugin in the `server/plugins/` directory

```ts [server/plugins/content.ts]
export default defineNitroPlugin((nitroApp) => {
// ...
})
```

- Register the plugin in `nuxt.config.ts`
```ts [server/plugins/content.ts]
export default defineNitroPlugin((nitroApp) => {
// ...
})
```

```ts [nuxt.config.ts]
export default defineNuxtConfig({
// ...
nitro: {
plugins: ['~/server/plugins/content.ts']
}
})
```

### `content:file:beforeParse`

Expand All @@ -44,8 +34,7 @@ Arguments:

### Example

Changing all occurrences of react to vue in all Markdown files:

Changing all occurrences of React to Vue in all Markdown files:

```ts [server/plugins/content.ts]
export default defineNitroPlugin((nitroApp) => {
Expand Down
13 changes: 12 additions & 1 deletion docs/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { resolve } from 'pathe'
import { defineNuxtConfig } from 'nuxt'
import consola from 'consola'

const alias = {}
Expand Down Expand Up @@ -70,5 +69,17 @@ export default defineNuxtConfig({
},
colorMode: {
preference: 'dark'
},
runtimeConfig: {
public: {
algolia: {
applicationId: 'Q46Q8609QS',
apiKey: '1661c72375532f074aedd9452a1270be',
langAttribute: 'lang',
docSearch: {
indexName: 'content-nuxtjs'
}
}
}
}
})
9 changes: 2 additions & 7 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@
"devDependencies": {
"@nuxt-themes/docus": "npm:@nuxt-themes/docus-edge@latest",
"@nuxtlabs/github-module": "npm:@nuxtlabs/github-module-edge@latest",
"monaco-editor-core": "^0.34.0",
"nuxt": "^3.0.0-rc.10",
"monaco-editor-core": "^0.34.1",
"nuxt": "^3.0.0-rc.12",
"vue-plausible": "^1.3.2"
},
"dependencies": {
"@typescript/ata": "^0.9.3",
"emmet-monaco-es": "^5.1.2",
"xterm": "^4.19.0"
}
}
4 changes: 2 additions & 2 deletions docs/tokens.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineTokens } from '@nuxtjs/design-tokens'
import { defineTheme } from 'pinceau'

export default defineTokens({
export default defineTheme({
colors: {
primary: {
50: { value: '#ecfdf5' },
Expand Down
Loading