An unofficial Notion renderer
A Vue renderer for Notion pages.
Use Notion as CMS for your blog, documentation or personal site.
vue-notion was ported to Vue from react-notion (developed by Splitbee ๐ โ a fast, reliable, free, and modern analytics for any team)
This package doesn't handle the communication with the API. Check out notion-api-worker from Splitbee for an easy solution.
Created by Jannik Siebert
Features
๐ฏ Accurate โ Results are almost identical
๐จ Custom Styles โ Styles are easily adaptable. Optional styles included
๐ SSR / Static Generation Support โ Functions to work with Nuxt and other frameworks
Install
npm install vue-notion
How To
Docs
Check out a demo at vue-notion.now.sh โจ
The full NotionRenderer
specification and more information on the Notion API and integration with Nuxt can be found at docs/
.
Basic Example
This example is hosted at vue-notion.now.sh/welcome.
<template>
<NotionRenderer :blockMap="blockMap" fullPage />
</template>
<script>
import { NotionRenderer, getPageBlocks } from "vue-notion";
export default {
components: { NotionRenderer },
data: () => ({ blockMap: null }),
async created() {
// get Notion blocks from the API via a Notion pageId
this.blockMap = await getPageBlocks("8c1ab01960b049f6a282dda64a94afc7");
},
};
</script>
<style>
@import "vue-notion/dist/styles.css"; /* optional Notion-like styles */
</style>
The example above uses a simple wrapper around the notion-api-worker.
It is also possible to store and use plain .json
objects received from the Notion API.
โ ๏ธ Use with caution.
The getPageBlocks
and getPageTable
are based on the private Notion API.
We can not gurantee it will stay stable.
The private API is warpped by notion-api-worker.
If you use these methods a lot, please consider hosting you own instance, as described in docs#notion-api
.
A full working example using Nuxt and static generation can be found inside the example
directory.
Roadmap
Add issues, request features and upvote block types that you want to see next!
Sites using vue-notion
List of pages that are using this library.
- StorePreviewer
- ...if you're using
vue-notion
, we'd be happy to feature you here
Supported Blocks
Most common block types are supported. We happily accept pull requests to add support for the missing blocks.
Text | โ
Yes | |
Heading | โ
Yes | |
Image | โ
Yes | |
Image Caption | โ
Yes | |
Bulleted List | โ
Yes | |
Numbered List | โ
Yes | |
Quote | โ
Yes | |
Callout | โ
Yes | |
Column | โ
Yes | |
iframe | โ
Yes | |
Video | โ
Yes | Only embedded videos |
Divider | โ
Yes | |
Link | โ
Yes | |
Code | โ
Partially | Highlighting coming soon |
Web Bookmark | โ
Soon | |
Toggle List | โ
Yes | |
Page Links | โ
Yes | |
Header | โ
Yes | Enable with fullPage |
Databases | โ Not planned | |
Checkbox | โ Not planned | |
Table Of Contents | โ Not planned | |
Please, feel free to open an issue if you notice any missing blocks or anything wrong with existing blocks.
Credits
License โ๏ธ
MIT ยฉ๏ธ Jannik Siebert