notion-enhancer icon indicating copy to clipboard operation
notion-enhancer copied to clipboard

Button to export markdown-file

Open theotheo opened this issue 2 years ago • 4 comments

Hi there! I need some advice. I would like to download markdown-version opened page without extra fuss. Default UI export zip-archive with images and not-human-readable name. It's cool, but kind of overkill for me. I want to get just single markdown-file.

There are some packages to do it so I guess it possible achieve with (non-official?) API. For example, https://github.com/yannbolliger/notion-exporter. But sometimes using CLI not conveniently.

So my question: is it possible to add a button to do it. I can implement it by myself, but want some more experted opinion about this possibility

theotheo avatar Jan 21 '22 06:01 theotheo

It's possible with the notion-enhancer via the builtin unofficial notion API (but not necessarily easy): https://notion-enhancer.github.io/documentation/api/#notion

dragonwocky avatar Jan 21 '22 06:01 dragonwocky

Thank you! It seems I can use enqueueTask-endpoint to create a export-task, then wait until it finished and export md-file from resulted archive. If I understand correctly builtin API doesn't have a method to request enqueueTask? Of course I can just use any http-client.

theotheo avatar Jan 21 '22 06:01 theotheo

@theotheo that's one way to do it. Processing actual archive files in a web environment as a notion-enhancer mod comes with some difficulties, though. I would probably recurse the notion.get method and manually process the content of each block into markdown- not easy, but a bit more plausible/simple. That way you could also get a more accurate markdown output (e.g. including code block languages) and be able to customise/process the output (e.g. linking to an image/asset hosted on notion instead of to a nonexistent relative file).

dragonwocky avatar Jan 21 '22 07:01 dragonwocky

@dragonwocky thank you! Appreciate your advices! I should think about it.

theotheo avatar Jan 21 '22 07:01 theotheo