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.11k stars 91 forks source link

Please treat headings with `is_toggleable: true` as toggle #111

Open isac322 opened 3 weeks ago

isac322 commented 3 weeks ago

image

This Notion page converted to

# Heading 1

paragraph

---

<details>
<summary>2024-09-03 </summary>

### Heading 3

paragraph

</details>

---

# Heading 

    ## Heading 2

    paragraph

The child blocks of the page is

{
  "object": "list",
  "results": [
    {
      "object": "block",
      "id": "11630451-bece-8034-b6bd-eb31a75f716a",
      "parent": {
        "type": "page_id",
        "page_id": "11530451-bece-8026-97bd-f6b5226300e6"
      },
      "created_time": "2024-10-05T15:44:00.000Z",
      "last_edited_time": "2024-10-05T15:44:00.000Z",
      "created_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "last_edited_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "has_children": false,
      "archived": false,
      "in_trash": false,
      "type": "heading_1",
      "heading_1": {
        "rich_text": [
          {
            "type": "text",
            "text": {
              "content": "Heading 1",
              "link": null
            },
            "annotations": {
              "bold": false,
              "italic": false,
              "strikethrough": false,
              "underline": false,
              "code": false,
              "color": "default"
            },
            "plain_text": "Heading 1",
            "href": null
          }
        ],
        "is_toggleable": false,
        "color": "default"
      }
    },
    {
      "object": "block",
      "id": "11630451-bece-80db-94d0-c24e0a803dd6",
      "parent": {
        "type": "page_id",
        "page_id": "11530451-bece-8026-97bd-f6b5226300e6"
      },
      "created_time": "2024-10-05T15:44:00.000Z",
      "last_edited_time": "2024-10-05T15:44:00.000Z",
      "created_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "last_edited_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "has_children": false,
      "archived": false,
      "in_trash": false,
      "type": "paragraph",
      "paragraph": {
        "rich_text": [
          {
            "type": "text",
            "text": {
              "content": "paragraph",
              "link": null
            },
            "annotations": {
              "bold": false,
              "italic": false,
              "strikethrough": false,
              "underline": false,
              "code": false,
              "color": "default"
            },
            "plain_text": "paragraph",
            "href": null
          }
        ],
        "color": "default"
      }
    },
    {
      "object": "block",
      "id": "11630451-bece-809e-b58d-f8423c4d8dd4",
      "parent": {
        "type": "page_id",
        "page_id": "11530451-bece-8026-97bd-f6b5226300e6"
      },
      "created_time": "2024-10-05T15:44:00.000Z",
      "last_edited_time": "2024-10-05T15:44:00.000Z",
      "created_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "last_edited_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "has_children": false,
      "archived": false,
      "in_trash": false,
      "type": "divider",
      "divider": {}
    },
    {
      "object": "block",
      "id": "11630451-bece-8060-ad82-f387c329c08c",
      "parent": {
        "type": "page_id",
        "page_id": "11530451-bece-8026-97bd-f6b5226300e6"
      },
      "created_time": "2024-10-05T15:43:00.000Z",
      "last_edited_time": "2024-10-05T15:45:00.000Z",
      "created_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "last_edited_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "has_children": true,
      "archived": false,
      "in_trash": false,
      "type": "toggle",
      "toggle": {
        "rich_text": [
          {
            "type": "mention",
            "mention": {
              "type": "date",
              "date": {
                "start": "2024-09-03",
                "end": null,
                "time_zone": null
              }
            },
            "annotations": {
              "bold": false,
              "italic": false,
              "strikethrough": false,
              "underline": false,
              "code": false,
              "color": "default"
            },
            "plain_text": "2024-09-03",
            "href": null
          },
          {
            "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"
      }
    },
    {
      "object": "block",
      "id": "11630451-bece-8011-b105-c6f7b297f10d",
      "parent": {
        "type": "page_id",
        "page_id": "11530451-bece-8026-97bd-f6b5226300e6"
      },
      "created_time": "2024-10-05T15:44:00.000Z",
      "last_edited_time": "2024-10-05T15:44:00.000Z",
      "created_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "last_edited_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "has_children": false,
      "archived": false,
      "in_trash": false,
      "type": "divider",
      "divider": {}
    },
    {
      "object": "block",
      "id": "11630451-bece-80f1-8244-f287922ad52c",
      "parent": {
        "type": "page_id",
        "page_id": "11530451-bece-8026-97bd-f6b5226300e6"
      },
      "created_time": "2024-10-05T15:43:00.000Z",
      "last_edited_time": "2024-10-05T15:44:00.000Z",
      "created_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "last_edited_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "has_children": true,
      "archived": false,
      "in_trash": false,
      "type": "heading_1",
      "heading_1": {
        "rich_text": [
          {
            "type": "text",
            "text": {
              "content": "Heading ",
              "link": null
            },
            "annotations": {
              "bold": false,
              "italic": false,
              "strikethrough": false,
              "underline": false,
              "code": false,
              "color": "default"
            },
            "plain_text": "Heading ",
            "href": null
          }
        ],
        "is_toggleable": true,
        "color": "default"
      }
    },
    {
      "object": "block",
      "id": "11630451-bece-8032-a9ea-fc1864c86ed0",
      "parent": {
        "type": "page_id",
        "page_id": "11530451-bece-8026-97bd-f6b5226300e6"
      },
      "created_time": "2024-10-05T15:45:00.000Z",
      "last_edited_time": "2024-10-05T15:45:00.000Z",
      "created_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "last_edited_by": {
        "object": "user",
        "id": "5fd8cd95-b114-4b75-be0c-b0425e5a071b"
      },
      "has_children": false,
      "archived": false,
      "in_trash": false,
      "type": "paragraph",
      "paragraph": {
        "rich_text": [],
        "color": "default"
      }
    }
  ],
  "next_cursor": null,
  "has_more": false,
  "type": "block",
  "block": {},
  "request_id": "63a31f6c-5428-4b27-8328-5ae633f89334"
}