souvikinator / notion-to-md

Convert notion pages, block and list of blocks to markdown (supports nesting and custom parsing)
https://www.npmjs.com/package/notion-to-md
MIT License
1.08k stars 89 forks source link

Detailed walkthrough? #69

Closed kerim closed 1 year ago

kerim commented 1 year ago

Is there a walkthrough or tutorial somewhere that offers step-by-step instructions on how to use this? Thanks!

kerim commented 1 year ago

What I've figured out so far:

Install:

npm install @notionhq/client npm i notion-to-md@latest

Create Custom Integration: https://www.notion.so/my-integrations (Copy API key created in this step.) Open workspace in browser (doesn't work on mac app), and add integration to workspace from menu.

Now what? I know it has something to do with the javascript code in the readme, and that I need to put the API key into that, but I'm not sure how to do this?

souvikinator commented 1 year ago

As of now, the README is the only detailed usage guide. Yep that's right here are the steps as you mentioned:

  1. Install dependencies:

    npm install @notionhq/client
    npm i notion-to-md@latest
  2. Create Custom Integration: notion.so/my-integrations (Copy API key created in this step.)

  3. Add integration to the workspace from the menu.

  4. Use API key with notion-to-md like so:

    const notion = new Client({
    auth: "your API key",
    });
  5. Copy the target page link from here: image

Get the target page id from the link: image

  1. Use the page id here:
    const mdblocks = await n2m.pageToMarkdown("target_page_id");

rest of the code you can get from the README.

kerim commented 1 year ago

Thanks. But how do I run the code shown in the README? What is the process? It looks like javascript, but I don't know how to run that from the terminal - I usually run that only within HTML web pages. (Sorry, I'm not very experienced at this...)

souvikinator commented 1 year ago

Ah so first you need to install nodejs on your computer. Once it's done just run the code like so:

node your_script.js

Don't be sorry, it's absolutely fine to seek help :))

kerim commented 1 year ago

Great. I was able to run the code, but got an error. I will open a separate issue for that.