Skip to content

arpitBhalla/notion2mdblog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b8f61e4 ยท Dec 3, 2022

History

4 Commits
Dec 3, 2022
Jan 1, 2022
Jan 1, 2022
Jan 1, 2022
Jan 1, 2022
Jan 1, 2022

Repository files navigation

Notion to markdown blog

Install

npm install notion2mdblog
yarn add notion2mdblog

Usage

// Client is extended from @notionhq/client
import { Client } from "notion2mdblog";
import fs from "node:fs";

// Initializing a client
const notion = new Client({
  auth: process.env.NOTION_KEY,
});

async function main() {
  const blogPages = await notion.markdown.db2md({
    database_id: NOTION_DATABASE_ID,
  });
  blogPages.map((blogPage) => {
    fs.writeFileSync(`blogs/${blogPage.title}`, blogPage.content);
  });
}
main();