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
Copy file name to clipboardExpand all lines: README.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,6 +47,8 @@ This package doesn't handle the communication with the API. Check out [notion-ap
47
47
48
48
🎨 **Custom Styles** – Styles are easily adaptable. Optional styles included
49
49
50
+
🔮 **Syntax-Highlighting** – Beautiful themeable code highlighting using Prism.js
51
+
50
52
🌎 **SSR / Static Generation Support** – Functions to work with Nuxt and other frameworks
51
53
52
54
## Install
@@ -61,7 +63,7 @@ npm install vue-notion
61
63
62
64
> Check out a demo at [vue-notion.now.sh](https://vue-notion.now.sh/) ✨
63
65
64
-
The full `NotionRenderer` specification and more information on the Notion API and integration with Nuxt can be found at [`docs/`](https://github.com/janniks/vue-notion/tree/main/docs).
66
+
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).
65
67
66
68
### Basic Example
67
69
@@ -154,4 +156,4 @@ Please, feel free to [open an issue](https://github.com/janniks/vue-notion/issue
A list of blocks by their id that may contain contents and properties.
19
19
20
-
### `contentId`
20
+
### `contentId`: String
21
21
22
22
– the id of the block that should be rendered.
23
23
If this is `undefined` the _first_ block is rendered.
24
24
_Usually the first block contains the rest of the page._
25
25
26
-
### `fullPage`
26
+
### `fullPage`: Boolean
27
27
28
28
– wether or not the page should contain the cover and header.
29
29
30
-
### `hideList`
30
+
### `hideList`: [String]
31
31
32
32
– a list of Notion blocks (e.g. `"callout"`) that should not be rendered.
33
33
34
-
### `mapImageUrl`
34
+
### `mapImageUrl`: Function
35
35
36
-
– a method that receives `(imageUrl: String, block: Object)` and returns a `url: String` that should be used during rendering.
37
-
The default method resolves images as they are used in Notion.
36
+
– a function that receives `(imageUrl: String, block: Object)` and returns a `url: String` that should be used during rendering.
37
+
The default function resolves images as they are used in Notion.
38
38
39
-
> This method could be used to upload the Notion hosted images to an own provider and replace the image URLs with new ones.
39
+
> This function could be used to upload the Notion hosted images to an own provider and replace the image URLs with new ones.
40
40
41
-
### `mapPageUrl`
41
+
### `mapPageUrl`: Function
42
42
43
-
– a method that receives `(pageId: String)` and returns a `url: String` that should be used during rendering.
44
-
The default method resolves pageIds relative to the current page root – i.e., `<pageId>` will become `/<pageId>`
43
+
– a function that receives `(pageId: String)` and returns a `url: String` that should be used during rendering.
44
+
The default function resolves pageIds relative to the current page root – i.e., `<pageId>` will become `/<pageId>`
45
45
46
46
e.g. if you're using vue-notion for blog posts at `/posts/<pageId>`
47
47
@@ -52,7 +52,7 @@ mapPageUrl(pageId = "") {
52
52
}
53
53
```
54
54
55
-
### `pageLinkOptions`
55
+
### `pageLinkOptions`: Object
56
56
57
57
– are used to override links to other Notion pages with custom Vue components.
58
58
`pageLinkOptions` is an `Object` that requires a `component` and a `href` parameter.
@@ -66,6 +66,36 @@ pageLinkOptions: {
66
66
}
67
67
```
68
68
69
+
### `prism`: Boolean
70
+
71
+
– whether or not syntax-highlighting using Prims.js should be activated.
72
+
73
+
> Check the `docs#syntax-highlighting` section below for more details.
74
+
75
+
## Syntax-highlighting
76
+
77
+
The following steps are required to add syntax-highlighting using Prism.js
78
+
79
+
- Install `prismjs` to your project – `npm install prismjs`
80
+
- Import the Prism.js css and a theme css somewhere in your application.
81
+
82
+
```js
83
+
import"prismjs";
84
+
import"prismjs/themes/prism.css";
85
+
```
86
+
87
+
- Add the `prism` flag to the `NotionRenderer`
88
+
89
+
```diff
90
+
-<NotionRenderer :blockMap="blockMap" />
91
+
+<NotionRenderer :blockMap="blockMap" prism />
92
+
```
93
+
94
+
> A list of available themes can be found at [prism/themes](https://github.com/PrismJS/prism/tree/master/themes) and more installable themes can be found at [prism-themes](https://github.com/PrismJS/prism-themes).
95
+
96
+
> ⚠️ To keep file size down, Prism.js only includes `markup`, `css`, `clike`, and `javascript` languages per default.
97
+
> To add supported languages import the language component from Prism.js – e.g. `import 'prismjs/components/prism-rust'` for `rust`.
98
+
69
99
## Notion API
70
100
71
101
The official Notion API is currently in [private beta](https://www.notion.so/api-beta).
0 commit comments