diff --git a/index.js b/index.js index 3f29711..a82ae4f 100644 --- a/index.js +++ b/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) } } diff --git a/joplinToNotionFormatting.js b/joplinToNotionFormatting.js new file mode 100644 index 0000000..64821ef --- /dev/null +++ b/joplinToNotionFormatting.js @@ -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 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 9c06d67..0e633db 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 296324a..5477c28 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "dependencies": { "@notionhq/client": "^2.1.1", "dotenv": "^16.0.1", + "marked": "^4.0.18", "node-fetch": "^3.2.10" } }