Cobertos / md2notion

A better Notion.so Markdown importer
MIT License
657 stars 66 forks source link

IS there a way to *export* Notion pages as MD? #12

Closed BenBlumer closed 4 years ago

BenBlumer commented 4 years ago

Thanks for the package! I'm hoping someone here will have insight: What's the best way to programmatically export notion pages as markdown?

Cobertos commented 4 years ago

Notion has a Markdown export feature, though I've never used it so I can't say what sort of quality it has.

Have you tried using that already?

image image

BenBlumer commented 4 years ago

Yeah - it works. I'm looking for a way to access that programmitically.

If you're curious: I'm writing a piece of code to monitor changes in notion docs and trigger an export to MD, Which I then convert to ODT and upload to google docs. And vice versa. The idea is to keep Google docs synched with Notion and vice versa.

Notion has a Markdown export feature, though I've never used it so I can't say what sort of quality it has.

Have you tried using that already?

image image

Cobertos commented 4 years ago

Oh I see... I feel like I recall there being an API endpoint for this. I don't see any in notion-py but after looking at the API calls from the web client it looks like there's a way to at least call it programmatically.

There's an enqueueTask endpoint that begins the export with the payload shown image image

and then there's a getTasks endpoint that allows you to get the final output. The result is in the payload image image

If you want to see this and tinker with it yourself, you can open the Notion web client in Chrome, open the network tab, and then do an export.

AlexMikhalev commented 3 years ago

For those who find this ticket googling "notion to markdown" export: Gist to export blog post using notion-py https://gist.github.com/AlexMikhalev/8c8ff3b7d657a106b39a1038715aa56b