diff --git a/packages/parchment/lib/src/codecs/markdown.dart b/packages/parchment/lib/src/codecs/markdown.dart index 42dd2c4c..ed621765 100644 --- a/packages/parchment/lib/src/codecs/markdown.dart +++ b/packages/parchment/lib/src/codecs/markdown.dart @@ -409,6 +409,14 @@ class _ParchmentMarkdownEncoder extends Converter { ParchmentAttribute? currentBlockAttribute; void handleLine(LineNode node) { + if (node.hasBlockEmbed) { + if (node.embedNode.value == BlockEmbed.horizontalRule) { + _writeHorizontalLineTag(buffer); + } + + return; + } + for (final attr in node.style.lineAttributes) { if (attr.key == ParchmentAttribute.block.key) { if (currentBlockAttribute != attr) { @@ -586,4 +594,8 @@ class _ParchmentMarkdownEncoder extends Converter { } } } + + void _writeHorizontalLineTag(StringBuffer buffer) { + buffer.write('---'); + } }