๐Ÿ“ฆ toeverything / affine-reader

โ˜… 26 stars โ‘‚ 15 forks ๐Ÿ‘ 26 watching
๐Ÿ“ฅ Clone https://github.com/toeverything/affine-reader.git
HTTPS git clone https://github.com/toeverything/affine-reader.git
SSH git clone git@github.com:toeverything/affine-reader.git
CLI gh repo clone toeverything/affine-reader
github-actions[bot] github-actions[bot] chore(release): affine-reader@3.8.8 e7f4743 8 months ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ node-playground
๐Ÿ“ packages
๐Ÿ“ playground
๐Ÿ“„ .gitignore
๐Ÿ“„ package.json
๐Ÿ“„ pnpm-lock.yaml
๐Ÿ“„ README.md
๐Ÿ“„ tsconfig.json
๐Ÿ“„ README.md

affine-reader

This is a simple reader for the blocksuite YJS doc format. The main goal right now is to convert a random YJS doc into a markdown file.

Install

pnpm install affine-reader

Usage

The following will create a reader for a workspace and then get all the pages in that workspace. Page markdown is available in .md property.

const { getBlocksuiteReader } = require("affine-reader");

const reader = await getBlocksuiteReader({ workspaceId: "workspace-id" });
const pages = await reader.getWorkspacePages(true);

For a real world use case, see the demo here and the code in playground directory, which integrates affine-reader with Next.js.

Export a affine to markdown locally

Usage: affine-exporter -w [workspace_id] -t [token]

Options:
      --help          Show help                                        [boolean]
      --version       Show version number                              [boolean]
  -t, --token         refresh token                                     [string]
  -w, --workspace_id  workspace id                                      [string]