Socket
Book a DemoInstallSign in
Socket

notion-in-svelte

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

notion-in-svelte

Render Notion blocks in Svelte

0.2.0
unpublished
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Notion-in-Svelte

NPM

An unofficial Notion API tool set for Svelte & Sapper

This package uses https://github.com/splitbee/notion-api-worker to generate the API. You can host this yourself, but OOTB it uses https://notion-api.splitbee.io/

This package is very experimental and subject to change. Check out a working page here: https://www.scotttolinski.com/notion

How To Use

npm install @leveluptuts/svelte-notion

Svelte


<script context="module">
    import { Notion, fetchNotion } from "@leveluptuts/svelte-notion";

    const fetchImage = (async () => {
        const pageId = `3e03212e646e41caaa560408162dee99`
        return await fetchNotion({ id: pageId, context: this })
    })()
</script>

{#await fetchImage}
    <p>...waiting</p>
{:then blocks}
    <Notion {blocks} />
{:catch error}
    <p>An error occurred!</p>
{/await}


Sapper


<script context="module">
  import { Notion, fetchNotion } from "@leveluptuts/svelte-notion";

  export async function preload() {
    const pageId = `3e03212e646e41caaa560408162dee99`;
    const blocks = await fetchNotion({ id: pageId, context: this });
    return { blocks };
  }
</script>

<script>
  export let blocks;
</script>

<Notion {blocks} />

What's supported currently

(shout-out to splitbee for this dope table. I borrowed from his React Notion repo)

We happily accept pull requests to add support for the missing blocks. I'll be adding as many as I can asap.

Block TypeSupportedNotes
Text✅ Yes
Heading✅ Yes
Image❌ Missing
Image Caption❌ Missing
Bulleted List❌ Missing
Numbered List❌ Missing
Quote✅ Yes
Callout❌ Missing
Column❌ Missing
iframe❌ Missing
Video❌ MissingOnly embedded videos
Divider✅ Yes
Link✅ Yes
Code✅ Yes
Web Bookmark❌ Missing
Databases❌ Missing
Checkbox❌ Missing
Toggle List❌ Missing
Table Of Contents❌ Missing

How To Host Your Own API

Coming Soon

FAQ

Is this practical?

Maybe? I could be much more very soon.

I thought Notion didn't have an API?

It don't. Don't hold your breath on this working forever. See the Splitbee package for more info. The intention would be to migrate this to the official API once it's released.

Credits

Heavily inspired by https://github.com/splitbee/react-notion

Keywords

svelte

FAQs

Package last updated on 13 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.