Skip to content

Commit 629e276

Browse files
committed
Update examples
1 parent f81939a commit 629e276

File tree

3 files changed

+46
-41
lines changed

3 files changed

+46
-41
lines changed

README.md

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
<span> · </span>
99
<a href="#install">Install</a>
1010
<span> · </span>
11-
<a href="#basic-example">Example</a>
12-
<span> · </span>
1311
<a href="#docs">Docs</a>
1412
<span> · </span>
13+
<a href="#examples">Examples</a>
14+
<span> · </span>
1515
<a href="#credits">Credits</a>
1616
</h3>
1717

@@ -49,41 +49,48 @@ This package doesn't handle the communication with the API. Check out [notion-ap
4949

5050
🔮 **Syntax-Highlighting** – Beautiful themeable code highlighting using Prism.js
5151

52-
🌎 **SSR / Static Generation Support** – Functions to work with Nuxt and other frameworks
52+
🌎 **SSR / Static Generation Support** – Functions to work with NuxtJS and other frameworks
5353

5454
## Install
5555

56+
### Vue
57+
5658
```bash
5759
npm install vue-notion
5860
```
5961

6062
### NuxtJS Module
6163

64+
Install as shown above and add `"vue-notion/nuxt"` to the `buildModules` array in `nuxt.config.js`.
65+
6266
```js
6367
// nuxt.config.js
64-
6568
export default {
6669
// ...
67-
buildModules: [
68-
'vue-notion/nuxt'
69-
]
70-
notion: {
71-
// additionals configuration
72-
}
73-
}
70+
buildModules: ["vue-notion/nuxt"],
71+
};
7472
```
7573

76-
## How To
74+
## Docs
75+
76+
<!-- todo: add # links to doc links -->
7777

78-
### Docs
78+
- `NotionRenderer`: [`docs/`](https://github.com/janniks/vue-notion/tree/main/docs)
79+
- Syntax Highlighting in Code Blocks (with Prism.js): [`docs/`](https://github.com/janniks/vue-notion/tree/main/docs)
80+
- Notion API: [`docs/`](https://github.com/janniks/vue-notion/tree/main/docs)
81+
- Nuxt: [`docs/`](https://github.com/janniks/vue-notion/tree/main/docs)
7982

80-
> Check out a demo at [vue-notion.now.sh](https://vue-notion.now.sh/)
83+
> Check out a full working demo at [vue-notion.now.sh](https://vue-notion.now.sh/)
84+
> The code for the demo is in [`example/`](https://github.com/janniks/vue-notion/tree/main/example).
8185
82-
More information on the `NotionRenderer` specification, syntax-highlighting, the Notion API, and integration with Nuxt can be found at [`docs/`](https://github.com/janniks/vue-notion/tree/main/docs).
86+
## Examples
87+
88+
These examples use a simple wrapper around the [`notion-api-worker`](https://github.com/splitbee/notion-api-worker).
89+
It is also possible to store a page received from the Notion API in `.json` and use it without the `async/await` part.
8390

8491
### Basic Example for Vue
8592

86-
This example is hosted at [vue-notion.now.sh/vue](https://vue-notion.now.sh/vue).
93+
This example is a part of [`example/`](https://github.com/janniks/vue-notion/tree/main/example) and is hosted at [vue-notion.now.sh/vue](https://vue-notion.now.sh/vue).
8794

8895
```vue
8996
<template>
@@ -108,12 +115,9 @@ export default {
108115
</style>
109116
```
110117

111-
The example above uses a simple wrapper around the [notion-api-worker](https://github.com/splitbee/notion-api-worker).
112-
It is also possible to store a page received from the Notion API in `.json` and use it without the `async/await` part.
113-
114-
### Basic Example for Nuxt
118+
### Basic Example for NuxtJS
115119

116-
This example is hosted at [vue-notion.now.sh/nuxt](https://vue-notion.now.sh/nuxt).
120+
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).
117121

118122
```vue
119123
<template>
@@ -125,25 +129,25 @@ export default {
125129
data: () => ({ blockMap: null }),
126130
async asyncData({ $notion }) {
127131
// use Notion module to get Notion blocks from the API via a Notion pageId
128-
const blockMap = await $notion.getPageBlocks("8c1ab01960b049f6a282dda64a94afc7");
129-
130-
return { blockMap }
132+
const blockMap = await $notion.getPageBlocks(
133+
"8c1ab01960b049f6a282dda64a94afc7"
134+
);
135+
return { blockMap };
131136
},
132137
};
138+
</script>
133139
134140
<style>
135141
@import "vue-notion/src/styles.css"; /* optional Notion-like styles */
136142
</style>
137143
```
138144

139-
> ⚠️ Use with caution.
145+
> ⚠️ Use with caution!
140146
> The `getPageBlocks` and `getPageTable` are based on the private Notion API.
141-
> We can not gurantee it will stay stable.
147+
> We can NOT guarantee that it will stay stable.
142148
> The private API is warpped by [notion-api-worker](https://github.com/splitbee/notion-api-worker).
143149
> If you use these methods a lot, please consider hosting you own instance, as described in [`docs#notion-api`](https://github.com/janniks/vue-notion/tree/main/docs#notion-api).
144150
145-
A [full working example using Nuxt and static generation](https://vue-notion.now.sh/) can be found inside the `example` directory.
146-
147151
## Roadmap
148152

149153
[Add issues](https://github.com/janniks/vue-notion/issues/new), request features and upvote [block types](https://github.com/janniks/vue-notion/issues?q=is%3Aissue+is%3Aopen+label%3Ablock) that you want to see next!
@@ -184,7 +188,7 @@ Most common block types are supported. We happily accept pull requests to add su
184188
| Checkbox | ❌ Not planned | |
185189
| Table Of Contents | ❌ Not planned | |
186190

187-
Please, feel free to [open an issue](https://github.com/janniks/vue-notion/issues/new) if you notice any missing blocks or anything wrong with existing blocks.
191+
Please, feel free to [open an issue](https://github.com/janniks/vue-notion/issues/new) if you notice any important blocks missing or anything wrong with existing blocks.
188192

189193
## Credits
190194

@@ -196,7 +200,7 @@ Please, feel free to [open an issue](https://github.com/janniks/vue-notion/issue
196200
- [samwightt](https://github.com/samwightt) – react-notion Inspiration & API Typings
197201
- [react-notion Contributors 💕](https://github.com/splitbee/react-notion/graphs/contributors)
198202

199-
- Big thanks to [Nuxt](https://nuxtjs.org) for being awesome!
203+
- Big thanks to [NuxtJS](https://nuxtjs.org) for being awesome!
200204

201205
## License ⚖️
202206

docs/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ mapPageUrl(pageId = "") {
5757
– are used to override links to other Notion pages with custom Vue components.
5858
`pageLinkOptions` is an `Object` that requires a `component` and a `href` parameter.
5959

60-
e.g. to use `NuxtLink` components instead of HTML `a` elements
60+
e.g., to use `NuxtLink` components instead of HTML `a` elements
6161

6262
```js
6363
pageLinkOptions: {
@@ -114,7 +114,7 @@ const pageTable = await getPageTable("PAGE_ID", "ENDPOINT_URL");
114114

115115
> Feel free to open an issue if something is unclear or additional documentation is needed...
116116
117-
## Nuxt – Server-Side Rendering & Static Site Generation
117+
## NuxtJS – Server-Side Rendering & Static Site Generation
118118

119119
> For a running project check out the extensive example at [example/](/example).
120120
@@ -123,16 +123,17 @@ const pageTable = await getPageTable("PAGE_ID", "ENDPOINT_URL");
123123
There are a few required steps to allow Nuxt to work with vue-notion
124124

125125
- Install vue-notion as a dependency to your Nuxt project – `npm install vue-notion`
126-
- Add `"vue-notion"` to the `build.transpile` array in `nuxt.config.js`.
126+
- Add `"vue-notion/nuxt"` to the `buildModules` array in `nuxt.config.js`.
127127

128128
```js
129-
build: {
130-
transpile: ["vue-notion"];
131-
}
129+
// nuxt.config.js
130+
export default {
131+
// ...
132+
buildModules: ["vue-notion/nuxt"],
133+
};
132134
```
133135

134-
- Import the `NotionRenderer` in any component you want to use vue-notion in – `import { NotionRenderer } from "vue-notion"`
135-
- Voila, you can now use vue-notion as shown in the examples.
136+
- Voila, you can now use vue-notion (i.e., the `NotionRenderer` component and the Notion API methods via NuxtJS `$notion`) as shown in the examples.
136137

137138
### Static Pages
138139

example/pages/nuxt.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ export default {
1010
const blockMap = await $notion.getPageBlocks(
1111
"8c1ab01960b049f6a282dda64a94afc7"
1212
);
13-
1413
return { blockMap };
1514
},
1615
};
16+
</script>
1717

1818
<style>
19-
@import "vue-notion/src/styles.css"; /* optional Notion-like styles */
20-
</style>;
19+
@import "vue-notion/src/styles.css"; /* optional Notion-like styles */
20+
</style>

0 commit comments

Comments
 (0)