Replies: 1 comment
-
|
+1 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Idea: Improve Markdown Paste-Import (Headings, Lists, Hierarchy, and Long Documents)
Summary
AFFiNE’s current behavior when pasting Markdown causes structured documents to collapse into incorrect or flat blocks. I tested this using a real Markdown document (multi-level headings, lists, horizontal rules, inline formatting, long multi-section content). The paste result did not preserve the structure: headings became plain text, lists became separate paragraphs, and section hierarchy was lost.
This makes it difficult to migrate notes from tools like Obsidian, Logseq, GitHub, or any Markdown-based knowledge workflow.
Reproducible Example
Here is a small excerpt from the Markdown I pasted:
Expected result:
Actual result:
The full document I tested (a set of 4 lecture sections) contains many headings, lists, quote blocks, equations, and multi-paragraph sections—all of which flatten upon paste.
Why This Matters
Markdown is a primary format for:
Most users coming from Markdown-based systems expect paste-import to preserve structure. Without this, multi-thousand-word documents become unusable inside AFFiNE.
A reliable Markdown import path would dramatically improve adoption and migration.
Proposed Improvements
1. Auto-detect Markdown on paste
If clipboard text contains Markdown patterns (
#,-,1.,---, etc.), route it through a Markdown parser rather than plain-text insertion.2. Parse via a full Markdown AST
Use a standard library such as remark, micromark, or markdown-it to produce an AST with nodes like:
headinglist/listItemparagraphblockquotethematicBreakcode/inlineCode3. Map AST nodes into BlockSuite blocks
Examples:
heading(depth=1..6)→ HeadingBlock(level=…)list(ordered=true/false)→ ListBlocklistItem(children)→ Nested list blocksthematicBreak→ DividerBlockblockquote→ QuoteBlock4. Preserve hierarchy and nesting
The sample I tested includes deeply nested lists and multi-level headings. These should map cleanly to nested blocks in AFFiNE.
5. Add a “Paste as Markdown (Convert to Blocks)” option
A context-menu override ensures predictable behavior.
Questions for the Maintainers
MarkdownAdapterin BlockSuite, or should this be built as a separate adapter?Beta Was this translation helpful? Give feedback.
All reactions