Laid groundwork for formal notion renderer
This commit is contained in:
parent
2c7084028f
commit
6f67346a1f
4
index.js
4
index.js
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
"dependencies": {
|
||||
"@notionhq/client": "^2.1.1",
|
||||
"dotenv": "^16.0.1",
|
||||
"marked": "^4.0.18",
|
||||
"node-fetch": "^3.2.10"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue