https://github.com/toeverything/affine-reader
https://github.com/toeverything/affine-reader
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/toeverything/affine-reader
- Owner: toeverything
- Created: 2023-02-19T14:19:16.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-04-14T02:34:21.000Z (about 1 year ago)
- Last Synced: 2025-04-14T03:34:14.229Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://affine-reader-playground.vercel.app
- Size: 563 KB
- Stars: 18
- Watchers: 5
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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.
```js
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](https://affine-reader.vercel.app//) and the code in [playground](./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]
```