Skip to main content

Notion markdown 导出

¥Notion markdown export

本示例介绍如何从 Notion 仪表板导出的 Notion 页面加载数据。

¥This example goes over how to load data from your Notion pages exported from the notion dashboard.

首先,按照官方说明 此处 将你的 Notion 页面导出为 Markdown 和 CSV。确保选择 include subpagesCreate folders for subpages.

¥First, export your notion pages as Markdown & CSV as per the offical explanation here. Make sure to select include subpages and Create folders for subpages.

然后,解压下载的文件,并将解压后的文件夹移动到你的代码库中。它应该包含你页面的 Markdown 文件。

¥Then, unzip the downloaded file and move the unzipped folder into your repository. It should contain the markdown files of your pages.

将文件夹添加到你的存储库后,只需运行以下示例:

¥Once the folder is in your repository, simply run the example below:

import { NotionLoader } from "@langchain/community/document_loaders/fs/notion";

export const run = async () => {
/** Provide the directory path of your notion folder */
const directoryPath = "Notion_DB";
const loader = new NotionLoader(directoryPath);
const docs = await loader.load();
console.log({ docs });
};

API Reference:

  • NotionLoader from @langchain/community/document_loaders/fs/notion