Skip to main content

Notion Markdown 导出

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

首先,按照官方说明此处将你的 Notion 页面导出为 Markdown & CSV 格式。请确保勾选 包含子页面为子页面创建文件夹

然后,解压下载的文件,并将解压后的文件夹移至你的代码仓库中。该文件夹应包含你所有页面的 Markdown 文件。

一旦文件夹放入你的仓库中,只需运行下面的示例代码:

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

Was this page helpful?


You can also leave detailed feedback on GitHub.