1. Notion original
2. Notion API
{
"object": "block",
…
"type": "child_page",
"child_page": {
"title": "I’m a child page with 3 blocks: some Lorem, another child page, and a link to same"
},
"blocks": [
{
…
"paragraph": {
…
"plain_text": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam.",
…
}
},
{
"object": "block",
…
"type": "child_page",
"child_page": {
"title": "I’m the grandchild"
}
},
{
…
"paragraph": {
"text": [
…
"plain_text": "I’m the grandchild",
"href": "https://www.notion.so/ebe7d6569bd440b18435d8f6f792227b"
},
{
…
"plain_text": " ",
…
}
]
}
}
]
}
javascript
3. Svelte output
<ChildPage
title="I’m a child page with 3 blocks: some Lorem, another child page, and a link to same"
>
<Paragraph blockProps={{…}}>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam.
</Paragraph>
<p
style="display: inline-block; background: floralwhite; padding: 1rem; margin: 0.25rem 0; border: 1px fuchsia solid; border-radius: 6px; "
>⚠️ child_page: <span
style="font-weight: 600; display: inline; padding: 3px; border-radius: 3px;"
>I’m the grandchild.</span
> has no content</p
>
<Error
pageId="991f1062fc784019aea56e890ca04ca2"
blockId="116422a3e16e4329b95d3f8575a43781"
message="pageId is not defined"
stack="ReferenceError: pageId is not defined
at linkOrWarning (file:///Users/c/Documents/1-Due/notion2svelte/lib/decorators.js:124:40)
at maybeLink (file:///Users/c/Documents/1-Due/notion2svelte/lib/decorators.js:132:14)
at decorateInlineContent (file:///Users/c/Documents/1-Due/notion2svelte/lib/decorators.js:165:14)
at file:///Users/c/Documents/1-Due/notion2svelte/lib/sveltifier.js:23:23
at Array.map (<anonymous>)
at richText (file:///Users/c/Documents/1-Due/notion2svelte/lib/sveltifier.js:23:12)
at renderBlock (file:///Users/c/Documents/1-Due/notion2svelte/lib/sveltifier.js:298:35)
at file:///Users/c/Documents/1-Due/notion2svelte/lib/sveltifier.js:208:20
at Array.map (<anonymous>)
at renderBlock (file:///Users/c/Documents/1-Due/notion2svelte/lib/sveltifier.js:206:10)"
/>
</ChildPage>
html
By including a grandchild page and a link to the same grandchild page, we’ve
generated two distinct errors. The first (⚠️) is a “warning” generated while rendering “annotated”
spans of text. The second (the wiggly one below) is a catch-all for all uncaught errors thrown
during notion2svelte execution.
See Error.
See Error.
4. Example rendering
I’m a child page with 3 blocks: some Lorem, another child page, and a link to same
This is the first block. It’s just a simple paragraph. Next comes another sub-page — call it a
grandchild? — which notion2svelte isn’t currently equipped to handle. The
block after that, which also errors out, is an alias to the same grandchild
page.
⚠️ child_page: I’m the grandchild. has no content
⚠️ l(t, type, url): I’m the grandchild. No slug found for mention w/text: I’m the grandchild'. Have you imported the target page with notion2svelte yet?
↑ About that Error
🏠 Browse the docs ⚘
High-level Discussion
Turn-intoable Block Components
Toggle Headings (not yet implemented)
Layout-only Components
Page-level Components
Annotation Components
bold → <strong>
italic → <em>
strikethrough → <s>