-
-
Notifications
You must be signed in to change notification settings - Fork 403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add markdown export from synced doc block #7405
Merged
graphite-app
merged 1 commit into
master
from
06-24-feat_add_markdown_export_from_synced_doc_block
Jun 24, 2024
Merged
feat: add markdown export from synced doc block #7405
graphite-app
merged 1 commit into
master
from
06-24-feat_add_markdown_export_from_synced_doc_block
Jun 24, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
Your org has enabled the Graphite merge queue for merging into masterAdd the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
fourdim
approved these changes
Jun 24, 2024
Merge activity
|
Closes: [BS-665](https://linear.app/affine-design/issue/BS-665/%E6%94%AF%E6%8C%81-embed-synced-doc-%E7%9A%84-markdown-%E5%AF%BC%E5%87%BA) ### TL;DR This PR adds support for exporting synced documents using `embedSyncedDocMiddleware` with `MakrdownAdapter`. ### Example ```ts const job = new Job({ collection, middlewares: [embedSyncedDocMiddleware('content')], }); const adapter = new MarkdownAdapter(job); // Do what you want to exporting here using markdown adapter const content = adapter.fromSliceSnapshot({snapshot}); ``` There is a output example that export `doc -> synced doc -> nested synced doc` ```md # Doc Hello, I' m Doc // Begin: Embed synced doc block, export all content of synced doc # Synced Doc Hello, I'm Synced Doc // Begin: Nested embed synced doc block, just export it's title Nested Doc // End: Nested embed synced doc block // End: Embed synced doc block ``` ### What changed? 1. **Transformers**: Updated middlewares to include `embedSyncedDocMiddleware`. 2. **MarkdownAdapter**: Added logic to handle 'embedSyncedDoc' nodes. 3. **Job Class**: Added `collection` getter. 4. **Tests**: Added unit tests for the synced-doc export logic. 5. **Uint Test Utilities**: Modified `createJob` to accept middlewares and initialize with `AffineSchemas`. ### Why make this change? To enable loading content of `embed-synced-doc` for AI context. Related issue: [BS-632](https://linear.app/affine-design/issue/BS-632/synced-block-%E6%96%87%E6%A1%A3%E6%94%AF%E6%8C%81%EF%BC%9A%E8%AF%BB%E5%8F%96%E6%96%87%E6%A1%A3%E5%86%85%E5%AE%B9%E4%BD%9C%E4%B8%BA-ai-%E7%9A%84%E4%B8%8A%E4%B8%8B%E6%96%87-cotent)
L-Sun
force-pushed
the
06-24-feat_add_markdown_export_from_synced_doc_block
branch
from
June 24, 2024 11:28
aebf16c
to
9d17ecf
Compare
graphite-app
bot
deleted the
06-24-feat_add_markdown_export_from_synced_doc_block
branch
June 24, 2024 11:38
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: BS-665
TL;DR
This PR adds support for exporting synced documents using
embedSyncedDocMiddleware
withMakrdownAdapter
.Example
There is a output example that export
doc -> synced doc -> nested synced doc
What changed?
embedSyncedDocMiddleware
.collection
getter.createJob
to accept middlewares and initialize withAffineSchemas
.Why make this change?
To enable loading content of
embed-synced-doc
for AI context. Related issue: BS-632