Laid groundwork for formal notion renderer

This commit is contained in:
Ian Cooperman 2022-08-06 17:44:58 -07:00
parent 2c7084028f
commit 6f67346a1f
4 changed files with 39 additions and 1 deletions

View File

@ -2,6 +2,7 @@
import 'dotenv/config'
import { Client } from '@notionhq/client'
import Joplin from './joplin.js'
import render from './joplinToNotionFormatting.js'
const joplin = new Joplin(process.env.JOPLIN_TOKEN, process.env.JOPLIN_CLIPPER_PORT)
const notion = new Client({auth: process.env.NOTION_TOKEN});
@ -13,7 +14,8 @@ const notionDatabaseID = process.env.NOTION_DATABASE_ID;
async function processNotes() {
const data = await joplin.getNotesFromNotebook(joplinNotebookID, ["title", "body", "created_time", "updated_time"])
for (let note of data) {
addPageToNotionDatabase(notionDatabaseID, note.title, note.body)
render(note.body)
// addPageToNotionDatabase(notionDatabaseID, note.title, note.body)
}
}

View File

@ -0,0 +1,18 @@
import { marked } from 'marked'
function render (md) {
const result = marked.parse(md)
console.log(result)
}
function renderParagraph(pTag) {
}
export default render

17
package-lock.json generated
View File

@ -7,6 +7,7 @@
"dependencies": {
"@notionhq/client": "^2.1.1",
"dotenv": "^16.0.1",
"marked": "^4.0.18",
"node-fetch": "^3.2.10"
}
},
@ -141,6 +142,17 @@
"node": ">=12.20.0"
}
},
"node_modules/marked": {
"version": "4.0.18",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.18.tgz",
"integrity": "sha512-wbLDJ7Zh0sqA0Vdg6aqlbT+yPxqLblpAZh1mK2+AO2twQkPywvvqQNfEPVwSSRjZ7dZcdeVBIAgiO7MMp3Dszw==",
"bin": {
"marked": "bin/marked.js"
},
"engines": {
"node": ">= 12"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
@ -312,6 +324,11 @@
"fetch-blob": "^3.1.2"
}
},
"marked": {
"version": "4.0.18",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.18.tgz",
"integrity": "sha512-wbLDJ7Zh0sqA0Vdg6aqlbT+yPxqLblpAZh1mK2+AO2twQkPywvvqQNfEPVwSSRjZ7dZcdeVBIAgiO7MMp3Dszw=="
},
"mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",

View File

@ -3,6 +3,7 @@
"dependencies": {
"@notionhq/client": "^2.1.1",
"dotenv": "^16.0.1",
"marked": "^4.0.18",
"node-fetch": "^3.2.10"
}
}