0.0.1 • Published 4 years ago

notionso2markdown v0.0.1

Weekly downloads
4
License
Commercial
Repository
-
Last release
4 years ago

renotionso

unified processor to parse notion.so pages into a mdast syntax tree

#notion API

fetch("https://www.notion.so/api/v3/syncRecordValues", { "headers": { "accept": "/", "accept-language": "en-US,en;q=0.9,fr;q=0.8,zh-TW;q=0.7,zh;q=0.6", "content-type": "application/json", "notion-client-version": "22.7.16", "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", "sec-fetch-site": "same-origin", "x-notion-active-user-header": "616c09a4-d101-4d78-919a-31e63e9ab1fd", "cookie": "__cfduid=d17c32ad25575d97399ac4bee251326131571593248; logglytrackingsession=4dddac8a-e4ed-494e-b24b-bbf1af15a98a; ajs_user_id=%22616c09a4d1014d78919a31e63e9ab1fd%22; ajs_group_id=%22b105e0ae5ae740dea09daa2e213250c4%22; ajs_anonymous_id=%228c93c43f-efae-4969-b197-fdfeeb6e34d1%22; intercom-id-gpfdrxfd=3855be0f-9de1-437b-a5a5-13a01e292a18; notion_browser_id=14164509-314c-46e5-878c-166814b9a606; notion_user_id=616c09a4-d101-4d78-919a-31e63e9ab1fd; notion_users=%5B%22616c09a4-d101-4d78-919a-31e63e9ab1fd%22%5D; notion_locale=en-US%2Flegacy; _fbp=fb.1.1593048004803.1421074672; token_v2=46daffb3fa2e03a5447dfa5667febb252547f8e0bd71d2522c4116c2ff19afb956b6ee06955cd6e86d00459bc776712ebdefb3777ec7446e61c62d5307806171494e1e54fa78bf401b745704943e; intercom-session-gpfdrxfd=SWFjNUhEZGVqdUtQRHJ6ek9tdXN3czBrdHo0dE1vYnJNeDJhTXdVSnFENTA0QUdjSkFyOEpkTm9GR3l5VW9lWC0tbldhaHJxNjdNUDFuem0zdVdTbnJEdz09--82d88bf94a86d8db53d4b9801123bea58923991f; amplitude_id_af43d4b535912f7751949bfb061d8659notion.so=eyJkZXZpY2VJZCI6IjQzODdkZjdmLWNhMDEtNDE4Zi1hN2RiLWNmN2I3MGZjY2UxNVIiLCJ1c2VySWQiOiI2MTZjMDlhNGQxMDE0ZDc4OTE5YTMxZTYzZTlhYjFmZCIsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTU5MzIyMzkwODU1NSwibGFzdEV2ZW50VGltZSI6MTU5MzIyMzk1ODExOCwiZXZlbnRJZCI6NDkwLCJpZGVudGlmeUlkIjo0OTIsInNlcXVlbmNlTnVtYmVyIjo5ODJ9" }, "referrer": "https://www.notion.so/Test-Page-for-notion-to-markdown-527ae91211aa48efae2c66d751ab819d", "referrerPolicy": "same-origin", "body": "{\"recordVersionMap\":{\"block\":{\"e3dd32e4-9e66-42e1-8f7d-64191da258ec\":-1,\"b095822f-f2c2-4dc5-b493-ff0af30aecef\":-1}}}", "method": "POST", "mode": "cors" });

seems to be called for the 2 missing blocks in a toggle node

Response is the usual recordMap object with the missing blocks

references

https://github.com/redotjs/redot/blob/master/packages/redot-parse/redot-parse.js

https://www.npmjs.com/package/unist-builder

https://github.com/remarkjs/remark/tree/main/packages/remark-stringify

tests

# This is header 1

This is the [li**s**t](https://www.lemonde.fr) of **pages**:

[My first sub page](https://www.notion.so/My-first-sub-page-09b263db115e48688d73fc254078ddd0)

becomes:

[root]
 [heading] depth: 1
  [text] value: This is header 1
 [paragraph]
  [text] value: This is the
  [link] title: null, url: https://www.lemonde.fr
   [text] value: li
   [strong]
    [text] value: s
   [text] value: t
  [text] value:  of
  [strong]
   [text] value: pages
  [text] value: :
 [paragraph]
  [link] title: null, url: https://www.notion.so/My-first-sub-page-09b263db115e48688d73fc254078ddd0
   [text] value: My first sub page