diff --git a/frontend/app_flowy/lib/workspace/infrastructure/markdown/src/delta_markdown_encoder.dart b/frontend/app_flowy/lib/workspace/infrastructure/markdown/src/delta_markdown_encoder.dart index 12f57e6e8e..bd2aa4c281 100644 --- a/frontend/app_flowy/lib/workspace/infrastructure/markdown/src/delta_markdown_encoder.dart +++ b/frontend/app_flowy/lib/workspace/infrastructure/markdown/src/delta_markdown_encoder.dart @@ -65,8 +65,7 @@ class DeltaMarkdownEncoder extends Converter { // First close any current styles if needed final markedForRemoval = []; // Close the styles in reverse order, e.g. **_ for _**Test**_. - for (final value - in currentInlineStyle.attributes.values.toList().reversed) { + for (final value in currentInlineStyle.attributes.values.toList().reversed) { // TODO(tillf): Is block correct? if (value.scope == AttributeScope.BLOCK) { continue; @@ -123,10 +122,8 @@ class DeltaMarkdownEncoder extends Converter { // Close any open inline styles. _handleInline(lineBuffer, '', null); - final lineBlock = Style.fromJson(attributes) - .attributes - .values - .singleWhereOrNull((a) => a.scope == AttributeScope.BLOCK); + final lineBlock = + Style.fromJson(attributes).attributes.values.singleWhereOrNull((a) => a.scope == AttributeScope.BLOCK); if (lineBlock == currentBlockStyle) { currentBlockLines.add(lineBuffer.toString()); @@ -220,6 +217,16 @@ class DeltaMarkdownEncoder extends Converter { buffer.write(!close ? '[' : '](${attribute.value})'); } else if (attribute == Attribute.codeBlock) { buffer.write(!close ? '```\n' : '\n```'); + } else if (attribute.key == Attribute.background.key) { + buffer.write(!close ? '' : ''); + } else if (attribute.key == Attribute.underline.key) { + buffer.write(!close ? '' : ''); + } else if (attribute.key == Attribute.codeBlock.key) { + buffer.write(!close ? '```\n' : '\n```'); + } else if (attribute.key == Attribute.inlineCode.key) { + buffer.write(!close ? '`' : '`'); + } else if (attribute.key == Attribute.strikeThrough.key) { + buffer.write(!close ? '~~' : '~~'); } else { throw ArgumentError('Cannot handle $attribute'); } @@ -246,6 +253,8 @@ class DeltaMarkdownEncoder extends Converter { buffer.write('## '); } else if (block.key == Attribute.h3.key && block.value == 3) { buffer.write('### '); + } else if (block.key == Attribute.list.key) { + buffer.write('* '); } else { throw ArgumentError('Cannot handle block $block'); }