Overview
The Markdown plugin provides bidirectional conversion between Markdown text and AppFlowy Editor documents. It supports GitHub Flavored Markdown and custom syntax extensions.Installation
The Markdown plugin is included with AppFlowy Editor:Importing Markdown
Basic Usage
Convert Markdown text to an AppFlowy document:With Custom Parsers
Extend the parser with custom markdown elements:Supported Markdown Elements
The decoder supports these Markdown elements out of the box:- Headings:
# H1through###### H6 - Lists: Bulleted (
-,*), numbered (1.), and todo lists (- [ ],- [x]) - Formatting: Bold (
**text**), italic (*text*), strikethrough (~~text~~) - Links:
[text](url) - Images:
 - Code: Inline code and code blocks
- Quotes: Block quotes (
>) - Tables: GitHub Flavored Markdown tables
- Dividers: Horizontal rules (
---)
Exporting to Markdown
Basic Usage
Convert an AppFlowy document to Markdown:With Line Breaks
Add custom line breaks between blocks:With Custom Parsers
Handle custom node types during export:Implementation Details
Markdown Codec
The plugin uses aCodec<Document, String> implementation:
Built-in Parsers
Decoder Parsers
The decoder uses these parsers (from/lib/src/plugins/markdown/document_markdown.dart:18-31):
MarkdownParagraphParserV2MarkdownHeadingParserV2MarkdownTodoListParserV2MarkdownUnorderedListParserV2MarkdownOrderedListParserV2MarkdownBlockQuoteParserV2MarkdownTableListParserV2MarkdownDividerParserV2MarkdownImageParserV2
Encoder Parsers
The encoder uses these parsers (from/lib/src/plugins/markdown/document_markdown.dart:44-56):
TextNodeParserBulletedListNodeParserNumberedListNodeParserTodoListNodeParserQuoteNodeParserCodeBlockNodeParserHeadingNodeParserImageNodeParserTableNodeParserDividerNodeParser
Creating Custom Parsers
Custom Node Parser (Encoder)
Implement theNodeParser interface:
Custom Markdown Parser (Decoder)
Implement theCustomMarkdownParser interface:
Custom Inline Syntax
Extend markdown’s inline syntax:Limitations
Some advanced formatting may not be preserved during conversion:- Font size and font family
- Text alignment
- Custom colors (unless using custom parsers)
- Nested formatting in some edge cases
Example: Complete Import Flow
Here’s a complete example from the source code:See Also
- HTML Plugin - HTML import/export
- Quill Delta Plugin - Quill Delta support
- Contributing Guide - Contributing to the project