You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We created the MDC syntax to supercharge Markdown and give you the ability to integrate Vue components with slots and props inside your Markdown.
65
+
To display the content of a markdown file, you can use the [`<ContentRenderer>`](/docs/components/content-renderer) component.
62
66
63
-
::callout
64
-
Install the [MDC VS Code extension](https://marketplace.visualstudio.com/items?itemName=Nuxt.mdc) to get proper syntax highlighting for your MDC components.
<!-- Render the blog post as Prose & Vue components -->
77
+
<ContentRenderer :value="post" />
78
+
</template>
79
+
```
80
+
81
+
::note
82
+
Read more about the [`<ContentRenderer>`](/docs/components/content-renderer) component and [`Prose Components`](/docs/components/prose).
65
83
::
66
84
67
85
## Front-matter
@@ -83,6 +101,17 @@ description: 'meta description of the page'
83
101
<!-- Content of the page -->
84
102
```
85
103
104
+
```ts [example.ts]
105
+
const home =awaitqueryCollection('content').path('/').first()
106
+
107
+
console.log(home.title)
108
+
// => 'Title of the page'
109
+
console.log(home.description)
110
+
// => 'meta description of the page'
111
+
console.log(home.body)
112
+
// => AST object of the page content
113
+
```
114
+
86
115
### Native parameters
87
116
88
117
| Key | Type | Default | Description |
@@ -91,68 +120,14 @@ description: 'meta description of the page'
91
120
|`description`|`string`| First `<p>`{lang="html"} of the page | Description of the page, will be shown below the title and injected into the metas |
92
121
|`navigation`|`boolean`|`true`| Define if the page is included in [`queryCollectionNavigation`](/docs/utils/query-collection-navigation) return value. |
93
122
123
+
## MDC Syntax
94
124
95
-
## Excerpt
96
-
97
-
Content excerpt or summary can be extracted from the content using `<!--more-->` as a divider.
98
-
99
-
```md [content/index.md]
100
-
---
101
-
title: Introduction
102
-
---
103
-
104
-
Learn how to use `@nuxt/content`.
105
-
106
-
<!--more-->
107
-
108
-
Full amount of content beyond the more divider.
109
-
```
110
-
111
-
Description property will contain the excerpt content unless defined within the Front Matter props.
112
-
113
-
If there is no `<!--more-->` divider in the text then excerpt is undefined.
114
-
115
-
Example variables will be injected into the document:
116
-
117
-
```json
118
-
{
119
-
"excerpt": Object
120
-
"body": Object
121
-
// ... other keys
122
-
}
123
-
```
124
-
125
-
## Code Highlighting
126
-
127
-
Nuxt Content uses [Shiki](https://github.com/shikijs/shiki), that colors tokens with VSCode themes.
128
-
129
-
Code highlighting works both on [`ProsePre`](/docs/components/prose#prosepre) and [`ProseCode`](/docs/components/prose#prosecodeinline).
130
-
131
-
Each line of a code block gets its line number in the `line` attribute so lines can be labeled or individually styled.
125
+
We created the MDC syntax to supercharge Markdown and give you the ability to integrate Vue components with slots and props inside your Markdown.
132
126
133
-
::callout
134
-
[Read the API reference to configure or entirely disable syntax highlighting.](/docs/getting-started/configuration)
Use the auto-imported `queryCollection` to find contents inside a collection.Here we assume that you havr defined `docs` collection inside `content.config.ts`.
9
+
10
+
::note
11
+
If you have not defined any collection, check [How to define a collection](/docs/collections/collections#defining-collections).
0 commit comments