├── .vscode └── extensions.json ├── demo ├── vue │ ├── .vscode │ │ └── extensions.json │ ├── public │ │ └── favicon.ico │ ├── src │ │ ├── assets │ │ │ └── logo.png │ │ ├── App.vue │ │ ├── main.ts │ │ ├── router │ │ │ └── index.ts │ │ ├── view │ │ │ ├── Index.vue │ │ │ └── Page.vue │ │ └── components │ │ │ └── HelloWorld.vue │ ├── tsconfig.node.json │ ├── vite.config.ts │ ├── .gitignore │ ├── index.html │ ├── package.json │ ├── tsconfig.json │ ├── README.md │ └── pnpm-lock.yaml └── nuxt │ ├── public │ └── logo.png │ ├── server │ └── api │ │ └── page │ │ └── [pageId].ts │ ├── composables │ └── useProps.ts │ ├── pages │ ├── index.vue │ └── page │ │ └── [id].vue │ ├── tsconfig.json │ ├── nuxt.config.ts │ ├── package.json │ └── app.vue ├── src ├── components │ ├── index.ts │ ├── notion-renderer.vue │ └── block.vue ├── lib │ ├── props.ts │ ├── constant.ts │ ├── api.ts │ ├── composables.ts │ ├── types.ts │ ├── utils.ts │ └── blockable.ts ├── blocks │ ├── sync-block.vue │ ├── helpers │ │ ├── default-page-icon.vue │ │ ├── column-spacer.vue │ │ ├── page-header.vue │ │ ├── katex.vue │ │ ├── text-renderer.vue │ │ ├── table-of-contents-item.vue │ │ ├── tweet.ts │ │ ├── nested-list.vue │ │ ├── header-renderer.vue │ │ ├── prism.vue │ │ ├── page-icon.vue │ │ ├── figure.vue │ │ ├── prism.ts │ │ ├── asset.vue │ │ ├── image.vue │ │ └── google-drive.vue │ ├── table.vue │ ├── quote.vue │ ├── toggle.vue │ ├── text.vue │ ├── equation.vue │ ├── sync-pointer-block.vue │ ├── column.vue │ ├── todo.vue │ ├── header.vue │ ├── callout.vue │ ├── tweet.vue │ ├── table-row.vue │ ├── bookmark.vue │ ├── list.vue │ ├── table-of-contents.vue │ ├── code.vue │ ├── page.vue │ └── decorator.vue ├── index.ts └── style.css ├── assets └── vue3-notion.png ├── playground ├── assets │ └── logo.png ├── public │ └── favicon.ico ├── tsconfig.json ├── App.vue ├── main.ts ├── vite.config.ts ├── index.html ├── router │ └── index.ts └── view │ ├── Page.vue │ └── Index.vue ├── .gitignore ├── env.d.ts ├── scripts └── postpublish.sh ├── nuxt ├── plugin.ts └── index.ts ├── tsconfig.json ├── .github └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── vite.config.ts ├── LICENSE ├── package.json └── README.md /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["Vue.volar"] 3 | } 4 | -------------------------------------------------------------------------------- /demo/vue/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["johnsoncodehk.volar"] 3 | } 4 | -------------------------------------------------------------------------------- /src/components/index.ts: -------------------------------------------------------------------------------- 1 | export { default as NotionRenderer } from "./notion-renderer.vue" 2 | -------------------------------------------------------------------------------- /assets/vue3-notion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zernonia/vue3-notion/HEAD/assets/vue3-notion.png -------------------------------------------------------------------------------- /demo/nuxt/public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zernonia/vue3-notion/HEAD/demo/nuxt/public/logo.png -------------------------------------------------------------------------------- /playground/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zernonia/vue3-notion/HEAD/playground/assets/logo.png -------------------------------------------------------------------------------- /demo/vue/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zernonia/vue3-notion/HEAD/demo/vue/public/favicon.ico -------------------------------------------------------------------------------- /demo/vue/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zernonia/vue3-notion/HEAD/demo/vue/src/assets/logo.png -------------------------------------------------------------------------------- /playground/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zernonia/vue3-notion/HEAD/playground/public/favicon.ico -------------------------------------------------------------------------------- /playground/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["vite/client"] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | dist-ssr 5 | *.log 6 | *.local 7 | .nuxt 8 | .output 9 | .env 10 | .log 11 | .vercel 12 | -------------------------------------------------------------------------------- /playground/App.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /env.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.vue" { 2 | import { DefineComponent } from "vue"; 3 | const component: DefineComponent<{}, {}, any>; 4 | export default component; 5 | } 6 | -------------------------------------------------------------------------------- /src/lib/props.ts: -------------------------------------------------------------------------------- 1 | export const mapPageUrl = (pageId: String) => { 2 | return `/page/${pageId}` 3 | } 4 | export const pageLinkOptions = { 5 | component: "RouterLink", 6 | href: "to", 7 | } 8 | -------------------------------------------------------------------------------- /demo/vue/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "module": "esnext", 5 | "moduleResolution": "node" 6 | }, 7 | "include": ["vite.config.ts"] 8 | } 9 | -------------------------------------------------------------------------------- /demo/vue/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import vue from '@vitejs/plugin-vue' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [vue()] 7 | }) 8 | -------------------------------------------------------------------------------- /playground/main.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from "vue"; 2 | import App from "./App.vue"; 3 | import { router } from "./router"; 4 | import "@/style.css"; 5 | 6 | createApp(App).use(router).mount("#app"); 7 | -------------------------------------------------------------------------------- /demo/vue/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | -------------------------------------------------------------------------------- /src/blocks/sync-block.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /scripts/postpublish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | GIT_TAG=$(git describe --abbrev=0 --tags) 4 | 5 | $(cd demo && npm install -f vue3-notion@latest) 6 | 7 | git add --all 8 | git commit -m 'Update demo' 9 | git push --tags 10 | 11 | gh release create $GIT_TAG -t "$GIT_TAG" -------------------------------------------------------------------------------- /src/blocks/helpers/default-page-icon.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /demo/vue/src/main.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from "vue"; 2 | import App from "./App.vue"; 3 | import { router } from "./router"; 4 | 5 | import "vue3-notion/dist/style.css"; 6 | import "prismjs/themes/prism.css"; 7 | import "katex/dist/katex.min.css"; 8 | 9 | createApp(App).use(router).mount("#app"); 10 | -------------------------------------------------------------------------------- /demo/nuxt/server/api/page/[pageId].ts: -------------------------------------------------------------------------------- 1 | import { NotionAPI } from "notion-client"; 2 | 3 | export default defineEventHandler(async (event) => { 4 | const pageId = event.context.params.pageId; 5 | 6 | const api = new NotionAPI(); 7 | const page = await api.getPage(pageId.toString()); 8 | 9 | return page; 10 | }); 11 | -------------------------------------------------------------------------------- /src/blocks/table.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 16 | -------------------------------------------------------------------------------- /playground/vite.config.ts: -------------------------------------------------------------------------------- 1 | import path from "path"; 2 | import { defineConfig } from "vite"; 3 | import vue from "@vitejs/plugin-vue"; 4 | 5 | // https://vitejs.dev/config/ 6 | export default defineConfig({ 7 | plugins: [vue()], 8 | resolve: { 9 | alias: { 10 | "@": path.resolve(__dirname, "../src"), 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /demo/nuxt/composables/useProps.ts: -------------------------------------------------------------------------------- 1 | export const useProps = () => { 2 | const mapPageUrl = (pageId: String) => { 3 | return `/page/${pageId}` 4 | } 5 | 6 | const pageLinkOptions = computed(() => ({ 7 | component: defineNuxtLink({}), 8 | href: "to", 9 | })) 10 | 11 | return { 12 | mapPageUrl, 13 | pageLinkOptions, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /demo/vue/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /src/blocks/helpers/column-spacer.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 14 | -------------------------------------------------------------------------------- /nuxt/plugin.ts: -------------------------------------------------------------------------------- 1 | import VueNotion from "vue3-notion"; 2 | import { getPageBlocks, getPageTable } from "vue3-notion"; 3 | import { defineNuxtPlugin } from "#app"; 4 | 5 | export default defineNuxtPlugin(({ vueApp }) => { 6 | const notion = { getPageBlocks, getPageTable }; 7 | vueApp.use(VueNotion); 8 | return { 9 | provide: { 10 | notion, 11 | }, 12 | }; 13 | }); 14 | -------------------------------------------------------------------------------- /demo/vue/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /playground/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /demo/vue/src/router/index.ts: -------------------------------------------------------------------------------- 1 | import { createRouter, createWebHistory } from "vue-router"; 2 | import Home from "../view/Index.vue"; 3 | import Page from "../view/Page.vue"; 4 | 5 | const routes = [ 6 | { path: "/", name: "Home", component: Home }, 7 | { path: "/:id", name: "Page", component: Page }, 8 | ]; 9 | 10 | export const router = createRouter({ 11 | history: createWebHistory(), 12 | routes, 13 | }); 14 | -------------------------------------------------------------------------------- /playground/router/index.ts: -------------------------------------------------------------------------------- 1 | import { createRouter, createWebHistory } from "vue-router"; 2 | import Home from "../view/Index.vue"; 3 | import Page from "../view/Page.vue"; 4 | 5 | const routes = [ 6 | { path: "/", name: "Home", component: Home }, 7 | { path: "/:id", name: "Page", component: Page }, 8 | ]; 9 | 10 | export const router = createRouter({ 11 | history: createWebHistory(), 12 | routes, 13 | }); 14 | -------------------------------------------------------------------------------- /demo/nuxt/pages/index.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /demo/nuxt/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./.nuxt/tsconfig.json", 3 | "compilerOptions": { 4 | "target": "esnext", 5 | "module": "esnext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "lib": ["esnext", "dom"], 14 | "types": ["@nuxt/types"] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /demo/vue/src/view/Index.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 19 | -------------------------------------------------------------------------------- /demo/nuxt/nuxt.config.ts: -------------------------------------------------------------------------------- 1 | export default defineNuxtConfig({ 2 | app: { 3 | head: { 4 | title: "Nuxt3 Notion", 5 | meta: [{ charset: "utf-8" }, { name: "viewport", content: "width=device-width, initial-scale=1" }], 6 | link: [{ rel: "icon", type: "image/png", href: "/logo.png" }], 7 | }, 8 | }, 9 | modules: ["@nuxt/devtools", ["vue3-notion/nuxt", { css: true }]], 10 | routeRules:{ 11 | '**': { isr: 120 } // every 2 * 60 seconds 12 | } 13 | }); 14 | -------------------------------------------------------------------------------- /demo/nuxt/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nuxt3-notion", 3 | "version": "0.0.1", 4 | "type": "module", 5 | "description": "Nuxt 3 Notion Renderer.", 6 | "license": "MIT", 7 | "scripts": { 8 | "dev": "nuxt dev", 9 | "build": "nuxt build", 10 | "preview": "nuxt preview", 11 | "start": "node .output/server/index.mjs" 12 | }, 13 | "dependencies": { 14 | "notion-client": "^6.15.6", 15 | "nuxt": "^3.13.2", 16 | "vue3-notion": "^0.1.46" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/blocks/helpers/page-header.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 11 | 12 | 19 | -------------------------------------------------------------------------------- /src/blocks/helpers/katex.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 20 | 21 | 24 | -------------------------------------------------------------------------------- /demo/vue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "preview": "vite preview" 9 | }, 10 | "dependencies": { 11 | "vue": "^3.2.25", 12 | "vue-router": "^4.0.14", 13 | "vue3-notion": "^0.1.46" 14 | }, 15 | "devDependencies": { 16 | "@vitejs/plugin-vue": "^2.2.0", 17 | "typescript": "^4.5.4", 18 | "vite": "^2.8.6", 19 | "vue-tsc": "^0.29.8" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /demo/vue/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "useDefineForClassFields": true, 5 | "module": "esnext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "esModuleInterop": true, 12 | "lib": ["esnext", "dom"] 13 | }, 14 | "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], 15 | "references": [{ "path": "./tsconfig.node.json" }] 16 | } 17 | -------------------------------------------------------------------------------- /demo/vue/src/view/Page.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 16 | 22 | -------------------------------------------------------------------------------- /demo/nuxt/app.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 30 | -------------------------------------------------------------------------------- /demo/nuxt/pages/page/[id].vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 16 | -------------------------------------------------------------------------------- /src/lib/constant.ts: -------------------------------------------------------------------------------- 1 | export const availableType = [ 2 | "page", 3 | "header", 4 | "sub_header", 5 | "sub_sub_header", 6 | "bookmark", 7 | "callout", 8 | "code", 9 | "equation", 10 | "text", 11 | "quote", 12 | "to_do", 13 | "toggle", 14 | "column_list", 15 | "column", 16 | "bulleted_list", 17 | "numbered_list", 18 | "image", 19 | "embed", 20 | "figma", 21 | "video", 22 | "audio", 23 | "table", 24 | "table_row", 25 | "tweet", 26 | "divider", 27 | "table_of_contents", 28 | "transclusion_container", 29 | "transclusion_reference", 30 | ] 31 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "useDefineForClassFields": true, 5 | "module": "esnext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "esModuleInterop": true, 12 | "declaration": false, 13 | "lib": ["esnext", "dom"], 14 | "baseUrl": ".", 15 | "outDir": "dist", 16 | "skipLibCheck": true, 17 | "paths": { 18 | "@/*": ["src/*"], 19 | } 20 | }, 21 | 22 | "include": ["src/**/*.ts", "src/**/*.vue"] 23 | } 24 | -------------------------------------------------------------------------------- /src/blocks/quote.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 16 | 21 | -------------------------------------------------------------------------------- /src/blocks/toggle.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 16 | 22 | -------------------------------------------------------------------------------- /src/lib/api.ts: -------------------------------------------------------------------------------- 1 | import { BlockMap } from "../lib/types"; 2 | 3 | const getPageTable = async (pageId: string, apiUrl = "https://api.vue-notion.workers.dev/v1"): Promise => 4 | await fetch(`${apiUrl}/table/${pageId}`) 5 | .then((res) => res.json()) 6 | .then((data) => data as BlockMap) 7 | .catch((err) => err); 8 | 9 | const getPageBlocks = async (pageId: string, apiUrl = "https://api.vue-notion.workers.dev/v1"): Promise => 10 | await fetch(`${apiUrl}/page/${pageId}`) 11 | .then((res) => res.json()) 12 | .then((data) => data as BlockMap) 13 | .catch((err) => err); 14 | 15 | export { getPageTable, getPageBlocks }; 16 | -------------------------------------------------------------------------------- /src/blocks/helpers/text-renderer.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 16 | 17 | 22 | -------------------------------------------------------------------------------- /src/blocks/helpers/table-of-contents-item.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 16 | 17 | 20 | -------------------------------------------------------------------------------- /src/blocks/text.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 21 | -------------------------------------------------------------------------------- /src/blocks/helpers/tweet.ts: -------------------------------------------------------------------------------- 1 | import { reactive, onBeforeMount } from "vue" 2 | 3 | const store = reactive({ 4 | callbacks: [] as any[], 5 | }) 6 | 7 | export const useTwttr = (cb: () => any) => { 8 | onBeforeMount(() => { 9 | let twttrScript = document.getElementById("twitter-widgets-js") 10 | if (!twttrScript) { 11 | store.callbacks.push(cb) 12 | var s = document.createElement("script") 13 | s.id = "twitter-widgets-js" 14 | s.src = "https://platform.twitter.com/widgets.js" 15 | s.onload = () => store.callbacks.forEach((cb) => cb()) 16 | document.body.appendChild(s) 17 | } else { 18 | store.callbacks.push(cb) 19 | } 20 | }) 21 | } 22 | -------------------------------------------------------------------------------- /src/blocks/helpers/nested-list.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 16 | 17 | 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vite"; 2 | import path from "path"; 3 | import vue from "@vitejs/plugin-vue"; 4 | import dts from "vite-plugin-dts"; 5 | 6 | // https://vitejs.dev/config/ 7 | export default defineConfig({ 8 | plugins: [ 9 | vue(), 10 | dts({ 11 | insertTypesEntry: true, 12 | }), 13 | ], 14 | build: { 15 | target: "esnext", 16 | lib: { 17 | entry: path.resolve(__dirname, "src/index.ts"), 18 | name: "vue3-notion", 19 | }, 20 | rollupOptions: { 21 | external: ["vue"], 22 | output: { 23 | globals: { 24 | vue: "Vue", 25 | }, 26 | exports: "named", 27 | }, 28 | }, 29 | }, 30 | }); 31 | -------------------------------------------------------------------------------- /src/lib/composables.ts: -------------------------------------------------------------------------------- 1 | import { onMounted, ref } from "vue" 2 | import { getPageBlocks, getPageTable } from "./api" 3 | import { BlockMap } from "./types" 4 | 5 | const useGetPageBlocks = (...arg: Parameters) => { 6 | const data = ref() 7 | 8 | onMounted(async () => { 9 | data.value = await getPageBlocks(...arg) 10 | }) 11 | 12 | return { 13 | data, 14 | } 15 | } 16 | 17 | const useGetPageTable = (...arg: Parameters) => { 18 | const data = ref() 19 | 20 | onMounted(async () => { 21 | data.value = await getPageTable(...arg) 22 | }) 23 | 24 | return { 25 | data, 26 | } 27 | } 28 | 29 | export { useGetPageBlocks, useGetPageTable } 30 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { App } from "vue"; 2 | import * as components from "./components"; 3 | import "./style.css"; 4 | 5 | // Default export is library as a whole, registered via Vue.use() 6 | export default { 7 | install: (app: App) => { 8 | Object.entries(components).forEach(([componentName, component]) => { 9 | app.component(componentName, component); 10 | }); 11 | }, 12 | }; 13 | 14 | // To allow individual component use, export components 15 | // each can be registered via Vue.component() 16 | export * from "./components"; 17 | 18 | // export additional js methods 19 | export * from "./lib/api"; 20 | 21 | // export types 22 | export * from "./lib/types"; 23 | 24 | // export composables 25 | export * from "./lib/composables"; 26 | -------------------------------------------------------------------------------- /playground/view/Page.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 27 | -------------------------------------------------------------------------------- /src/components/notion-renderer.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 16 | 28 | -------------------------------------------------------------------------------- /src/blocks/equation.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 19 | 20 | 26 | -------------------------------------------------------------------------------- /nuxt/index.ts: -------------------------------------------------------------------------------- 1 | import { defineNuxtModule, addPlugin, createResolver } from "@nuxt/kit"; 2 | 3 | export default defineNuxtModule({ 4 | meta: { 5 | name: "vue3-notion", 6 | configKey: "notion", 7 | compatibility: { 8 | nuxt: "^3.0.0-rc.8", 9 | }, 10 | }, 11 | setup(options, nuxt) { 12 | const { resolve } = createResolver(import.meta.url); 13 | addPlugin(resolve("./plugin")); 14 | 15 | const notionDeps = ["katex", "prismjs"]; 16 | 17 | notionDeps.forEach((dep) => { 18 | nuxt.options.build.transpile.push(dep); 19 | }); 20 | 21 | if (options.css) { 22 | nuxt.options.css.push("vue3-notion/dist/style.css"); 23 | nuxt.options.css.push("prismjs/themes/prism.css"); 24 | nuxt.options.css.push("katex/dist/katex.min.css"); 25 | } 26 | }, 27 | }); 28 | -------------------------------------------------------------------------------- /src/blocks/sync-pointer-block.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 23 | 24 | 29 | -------------------------------------------------------------------------------- /src/blocks/column.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 26 | 27 | 33 | -------------------------------------------------------------------------------- /src/blocks/todo.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 17 | 18 | 26 | -------------------------------------------------------------------------------- /src/blocks/helpers/header-renderer.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 16 | 27 | -------------------------------------------------------------------------------- /demo/vue/README.md: -------------------------------------------------------------------------------- 1 | # Vue 3 + Typescript + Vite 2 | 3 | This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 ` 18 | 19 | 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /src/blocks/helpers/prism.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 35 | -------------------------------------------------------------------------------- /src/blocks/helpers/page-icon.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 16 | 17 | 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 zernonia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/blocks/header.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 16 | 17 | 33 | -------------------------------------------------------------------------------- /src/blocks/helpers/figure.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 18 | 28 | -------------------------------------------------------------------------------- /demo/vue/src/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 35 | 36 | 53 | -------------------------------------------------------------------------------- /src/blocks/callout.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 17 | 18 | 37 | -------------------------------------------------------------------------------- /src/blocks/tweet.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 40 | 41 | 45 | -------------------------------------------------------------------------------- /src/blocks/helpers/prism.ts: -------------------------------------------------------------------------------- 1 | import * as Vue from "vue" 2 | import Prism from "prismjs" 3 | import { Slots, VNode } from "vue" 4 | 5 | declare type Data = Record 6 | 7 | export default Vue.defineComponent({ 8 | props: { 9 | code: { 10 | type: String, 11 | }, 12 | inline: { 13 | type: Boolean, 14 | default: false, 15 | }, 16 | language: { 17 | type: String, 18 | default: "markup", 19 | }, 20 | }, 21 | setup(props, { slots, attrs }: { slots: Slots; attrs: Data }) { 22 | const { h } = Vue 23 | const slotsData = (slots && slots.default && slots.default()) || [] 24 | const code = props.code || (slotsData.length > 0 ? slotsData[0].children : "") 25 | const { inline, language } = props 26 | const prismLanguage = Prism.languages[language] 27 | const className = `language-${language}` 28 | 29 | if (inline) { 30 | return (): VNode => 31 | //@ts-ignore 32 | h("code", { ...attrs, class: [attrs.class, className], innerHTML: Prism.highlight(code, prismLanguage) }) 33 | } 34 | 35 | //@ts-ignore 36 | const d = Prism.highlight(code, prismLanguage) 37 | return (): VNode => 38 | h("pre", { ...attrs, class: [attrs.class] }, [ 39 | h("code", { 40 | class: className, 41 | innerHTML: d, 42 | }), 43 | ]) 44 | }, 45 | }) 46 | -------------------------------------------------------------------------------- /src/blocks/table-row.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 29 | 30 | 41 | -------------------------------------------------------------------------------- /src/blocks/helpers/asset.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 38 | 39 |