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

Notion has changed `link_to_page` to `mention` for @ links #101

Open kmlbgn opened 8 months ago

kmlbgn commented 8 months ago

Notion has changed the type for its @ links , also the href is now absolute and only uses the page id instead of the old SomePageTitle-PageID format.

 {
    "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"
},
{
    "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"
}
nickjtchfind commented 5 months ago

@kmlbgn how were you able to bypass this? Thanks