Skip to content

Commit 9fcc658

Browse files
committed
Update readme
1 parent a668ed5 commit 9fcc658

File tree

2 files changed

+22
-41
lines changed

2 files changed

+22
-41
lines changed

README.md

+22-38
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,13 @@
2525
<a href="https://github.com/janniks/vue-notion/blob/master/LICENSE">
2626
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT license" />
2727
</a>
28-
<a href="https://twitter.com/intent/follow?screen_name=jnnksbrt">
29-
<img src="https://img.shields.io/twitter/url?label=Follow&style=social&url=https%3A%2F%2Ftwitter.com%2Fjnnksbrt" alt="Follow on Twitter" />
28+
<a href="https://twitter.com/intent/follow?screen_name=janniksco">
29+
<img src="https://img.shields.io/twitter/url?label=Follow&style=social&url=https%3A%2F%2Ftwitter.com%2Fjanniksco" alt="Follow on Twitter" />
3030
</a>
3131
</p>
3232

3333
---
3434

35-
A Vue renderer for Notion pages.
36-
Use Notion as CMS for your blog, documentation or personal site.
37-
38-
Also check out [react-notion](https://github.com/splitbee/react-notion) (developed by [Splitbee 🐝](https://splitbee.io/) – a fast, reliable, free, and modern analytics for any team)
39-
40-
This package doesn't handle the communication with the API. Check out [notion-api-worker](https://github.com/splitbee/notion-api-worker) from [Splitbee](https://splitbee.io/) for an easy solution.
41-
42-
<sub>Created by <a href="https://twitter.com/jnnksbrt">Jannik Siebert</a></sub>
43-
4435
## Features
4536

4637
🎯 **Accurate** – Results are _almost_ identical
@@ -53,30 +44,25 @@ This package doesn't handle the communication with the API. Check out [notion-ap
5344

5445
## Install
5546

47+
> **Warning**
48+
> This is the documentation for the upcoming Vue 3 compatible release of vue-notion.
49+
> For the Vue 2 version, check out the [vue2 branch](https://github.com/janniks/vue-notion/tree/vue2).
50+
5651
### Vue
5752

5853
```bash
59-
npm install vue-notion
54+
npm install vue-notion@3.0.0-beta.1
6055
```
6156

6257
### NuxtJS Module
6358

64-
Install as a dev-dependency and add `"vue-notion/nuxt"` to the `buildModules` array in `nuxt.config.js`.
65-
66-
```bash
67-
npm install vue-notion --save-dev
68-
```
69-
70-
```js
71-
// nuxt.config.js
72-
export default {
73-
// ...
74-
buildModules: ["vue-notion/nuxt"],
75-
};
76-
```
59+
Check out the `/example` folder for a full working example using Nuxt 3.
7760

7861
## Docs
7962

63+
> **Note**
64+
> Potentially outdated -- 3.0.0 docs are a work-in-progress
65+
8066
- `NotionRenderer`: [`docs/`](https://github.com/janniks/vue-notion/tree/main/docs#notionrenderer)
8167
- Syntax-Highlighting in Code Blocks (with Prism.js): [`docs/`](https://github.com/janniks/vue-notion/tree/main/docs#syntax-highlighting)
8268
- Notion API: [`docs/`](https://github.com/janniks/vue-notion/tree/main/docs#notion-api)
@@ -105,7 +91,7 @@ This example is a part of [`example/`](https://github.com/janniks/vue-notion/tre
10591
<NotionRenderer :blockMap="blockMap" fullPage />
10692
</template>
10793
108-
<script>
94+
<script lang="ts">
10995
import { NotionRenderer, getPageBlocks } from "vue-notion";
11096
11197
export default {
@@ -119,30 +105,28 @@ export default {
119105
</script>
120106
121107
<style>
122-
@import "vue-notion/src/styles.css"; /* optional Notion-like styles */
108+
/* optional Notion-like styles */
109+
@import "vue-notion/src/styles.css";
123110
</style>
124111
```
125112

126113
### Basic Example for NuxtJS
127114

128115
This example is a part of [`example/`](https://github.com/janniks/vue-notion/tree/main/example) and is hosted at [vue-notion.now.sh/nuxt](https://vue-notion.now.sh/nuxt).
116+
The page assumes a Nuxt plugin in `~/plugins/vue-notion.js` that registers via the `useNuxtApp` hook.
129117

130118
```vue
131119
<template>
132120
<NotionRenderer :blockMap="blockMap" fullPage />
133121
</template>
134122
135-
<script>
136-
export default {
137-
data: () => ({ blockMap: null }),
138-
async asyncData({ $notion }) {
139-
// use Notion module to get Notion blocks from the API via a Notion pageId
140-
const blockMap = await $notion.getPageBlocks(
141-
"8c1ab01960b049f6a282dda64a94afc7"
142-
);
143-
return { blockMap };
144-
},
145-
};
123+
<script lang="ts" setup>
124+
const { $notion } = useNuxtApp();
125+
126+
// use Notion module to get Notion blocks from the API via a Notion pageId
127+
const { data: blockMap } = useAsyncData("page_nuxt", () =>
128+
$notion.getPageBlocks("8c1ab01960b049f6a282dda64a94afc7")
129+
);
146130
</script>
147131
148132
<style>

example/pages/vue.vue

-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
<script lang="ts">
66
import { NotionRenderer, getPageBlocks } from "vue-notion";
77
8-
// instead the following works in a ES module environment
9-
// import { NotionRenderer, getPageBlocks } from "vue-notion";
10-
118
export default {
129
components: { NotionRenderer },
1310
data: () => ({ blockMap: null }),

0 commit comments

Comments
 (0)