sillsdev / docu-notion

Download Notion pages as markdown and image files, preserving hierarchy and enabling workflow properties. Works with Docusaurus.
MIT License
159 stars 30 forks source link

[Problem] New notion API links response format breaks links parsing and links to database pages. #94

Open kmlbgn opened 11 months ago

kmlbgn commented 11 months ago

Unless I did something wrong with my setup, It seems notion has changed the href which now only uses the page id instead of the old https://www.notion.so/SomePageTitle-PageID format. This is now the format for raw links (using @)

 {
    "type": "mention",
    "mention": {
        "type": "page",
        "page": {
            "id": "9aa7ca32-eadd-4151-bec4-88c534773fca"
        }
    },
    "annotations": {
        "bold": false,
        "italic": false,
        "strikethrough": false,
        "underline": false,
        "code": false,
        "color": "default"
    },
    "plain_text": "Untitled",
    "href": "https://www.notion.so/9aa7ca32eadd4151bec488c534773fca"
},

"RAW" internal links no longer matches InternalLink regex and are not being processed by convertInternalUrl

Checking to see if a plugin wants to modify "[D1 P1](https://www.notion.so/9aa7ca32eadd4151bec488c534773fca)" 
plugin "standard internal link conversion" did not match this url
plugin "standard external link conversion" did not change this url

Related to: #39 and #40

It seems also that the type link_to_page has been replaced by mention

https://developers.notion.com/reference/block#mention

and the parameter is no longer located at the root but is nested as child of paragraph. This breaks the use of the database for pages.

{
    "object": "block",
    "id": "ac5a6780-4379-4fec-873d-f6aa5f91e64c",
    "parent": {
        "type": "page_id",
        "page_id": "9fad7f0e-9e49-4e7a-97b6-6008911cceeb"
    },
    "created_time": "2023-12-18T14:16:00.000Z",
    "last_edited_time": "2023-12-18T14:18:00.000Z",
    "created_by": {
        "object": "user",
        "id": "1d84dd47-93aa-4d90-94bf-e85c17ca9367"
    },
    "last_edited_by": {
        "object": "user",
        "id": "1d84dd47-93aa-4d90-94bf-e85c17ca9367"
    },
    "has_children": false,
    "archived": false,
    "type": "paragraph",
    "paragraph": {
        "rich_text": [
            {
                "type": "mention",
                "mention": {
                    "type": "page",
                    "page": {
                        "id": "9aa7ca32-eadd-4151-bec4-88c534773fca"
                    }
                },
                "annotations": {
                    "bold": false,
                    "italic": false,
                    "strikethrough": false,
                    "underline": false,
                    "code": false,
                    "color": "default"
                },
                "plain_text": "D1 P1",
                "href": "https://www.notion.so/9aa7ca32eadd4151bec488c534773fca"
            },
            {
                "type": "text",
                "text": {
                    "content": " ",
                    "link": null
                },
                "annotations": {
                    "bold": false,
                    "italic": false,
                    "strikethrough": false,
                    "underline": false,
                    "code": false,
                    "color": "default"
                },
                "plain_text": " ",
                "href": null
            }
        ],
        "color": "default"
    },
    "developer_survey": "https://notionup.typeform.com/to/bllBsoI4?utm_source=postman",
    "request_id": "c3c44aab-1f80-42d0-a21a-4b701c78c0b9"
}