npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ts-vue3-notion

v0.1.43

Published

Vue 3 Unofficial Notion Renderer

Downloads

9

Readme


A Vue 3 renderer for Notion pages (ported from vue-notion). Special thanks to Jannik Siebert & all the vue-notion contributors that made the vue-notion possible!

Use Notion as CMS for your blog, documentation or personal site. Also check out 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 (I planned to add this!). Check out notion-api-worker from Splitbee for an easy solution.

Created by Zernonia

Features

🌎 SSR / Static Generation Support – Functions to work with Nuxt3 and other frameworks

🎯 Accurate – Results are almost identical

🎨 Custom Styles – Styles are easily adaptable. Optional styles included

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

Install

Vue 3

npm install vue3-notion
# yarn add vue3-notion

Nuxt3 Module

Install as a dev-dependency and add "vue3-notion/nuxt" to the buildModules array in nuxt.config.js.

npm install vue3-notion --save-dev
// nuxt.config.ts
import { defineNuxtConfig } from "nuxt3"

export default defineNuxtConfig({
  //...
  modules: [
    ["vue3-notion/nuxt", { css: true }], // css is not imported by default. Set `true` to import css
  ],
})

Examples

These examples use a simple wrapper around the notion-api-worker to access the Notion page data. It is also possible to store a page received from the Notion API in .json and use it without the async/await part.

Use the getPageBlocks and getPageTable methods with caution! They are based on the private Notion API. We can NOT guarantee that it will stay stable. The private API is warpped by notion-api-worker.

Basic Example for Vue 3

This example is a part of demo/ and is hosted at vue3-notion.vercel.app.

<script setup lang="ts">
import { NotionRenderer, getPageBlocks, useGetPageBlocks } from "vue3-notion"
import { ref, onMounted } from "vue"

const data = ref()

onMounted(async () => {
  data.value = await getPageBlocks("4b2dc28a5df74034a943f8c8e639066a")
})

// ---- or using Composables ----

const { data } = useGetPageBlocks("4b2dc28a5df74034a943f8c8e639066a")
</script>

<template>
  <NotionRenderer v-if="data" :blockMap="data" fullPage />
</template>

<style>
@import "vue3-notion/dist/style.css"; /* optional Notion-like styles */
@import "prismjs/themes/prism.css";
@import "katex/dist/katex.min.css";
</style>

Basic Example for Nuxt3

This example is a part of demo/ and is hosted at vue3-notion.vercel.app.

<script setup lang="ts">
const { $notion } = useNuxtApp()
const { data } = await useAsyncData("notion", () => $notion.getPageBlocks("2e22de6b770e4166be301490f6ffd420"))
</script>

<template>
  <NotionRenderer :blockMap="data" fullPage prism />
</template>

Supported Blocks

Most common block types are supported. We happily accept pull requests to add support for the missing blocks.

| Block Type | Supported | Notes | | ----------------- | ---------- | ---------------------- | | 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 | ✅ Yes | | | Web Bookmark | ✅ Yes | | | Toggle List | ✅ Yes | | | Page Links | ✅ Yes | | | Cover | ✅ Yes | Enable with fullPage | | Equations | ✅ Yes | | | Checkbox | ✅ Yes | | | Simple Tables | ✅ Yes | | | Table Of Contents | ✅ Yes | | | Databases | ☑️ working on it | |

Please, feel free to open an issue if you notice any important blocks missing or anything wrong with existing blocks.

🌎 Local Development

Prerequisites

Yarn

  • npm install --global yarn

Development

  1. Clone the repo
    git clone https://github.com/zernonia/vue3-notion.git
  2. Install NPM packages
    yarn
  3. Run Development instance
    yarn dev

Credits

License ⚖️

MIT © zernonia