@@ -2,6 +2,7 @@ const { getPages } = require("./src/notion-api/get-pages")
2
2
const { getNotionPageMD } = require ( "./src/transformers/get-page-md" )
3
3
const { getNotionPageProperties } = require ( "./src/transformers/get-page-properties" )
4
4
const { getNotionPageTitle } = require ( "./src/transformers/get-page-title" )
5
+ const YAML = require ( "yaml" )
5
6
6
7
const NODE_TYPE = "Notion"
7
8
@@ -15,20 +16,28 @@ exports.sourceNodes = async (
15
16
)
16
17
17
18
pages . forEach ( ( page ) => {
19
+ const title = getNotionPageTitle ( page )
20
+ const properties = getNotionPageProperties ( page )
21
+ const markdown = "---\n"
22
+ . concat ( YAML . stringify ( { title, ...properties } ) )
23
+ . concat ( "\n---\n\n" )
24
+ . concat ( getNotionPageMD ( page ) )
25
+
18
26
actions . createNode ( {
19
27
id : createNodeId ( `${ NODE_TYPE } -${ page . id } ` ) ,
20
- title : getNotionPageTitle ( page ) ,
21
- properties : getNotionPageProperties ( page ) ,
28
+ title,
29
+ properties,
22
30
archived : page . archived ,
23
31
createdAt : page . created_time ,
24
32
updatedAt : page . last_edited_time ,
25
- markdown : getNotionPageMD ( page ) ,
33
+ markdownString : markdown ,
26
34
raw : page ,
27
35
parent : null ,
28
36
children : [ ] ,
29
37
internal : {
30
38
type : NODE_TYPE ,
31
- content : JSON . stringify ( page ) ,
39
+ mediaType : "text/markdown" ,
40
+ content : markdown ,
32
41
contentDigest : createContentDigest ( page ) ,
33
42
} ,
34
43
} )
0 commit comments