-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: document from markdown contains html escaped text (#841)
- Loading branch information
Showing
3 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import 'package:appflowy_editor/src/plugins/markdown/decoder/document_markdown_decoder.dart'; | ||
import 'package:example/pages/markdown/markdown_code_block_parser.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() async { | ||
group('markdown_heading_parser.dart', () { | ||
final parser = DocumentMarkdownDecoder( | ||
markdownElementParsers: [ | ||
const MarkdownCodeBlockParserV2(), | ||
], | ||
); | ||
|
||
test('contains quote syntax', () { | ||
const codeBlockMarkdown = '''```python | ||
# Example of using the GTD class | ||
gtd_system = GTD() | ||
gtd_system.capture("Write a blog post") | ||
gtd_system.capture("Prepare presentation for Monday") | ||
gtd_system.capture("Plan vacation") | ||
gtd_system.clarify() | ||
gtd_system.review() | ||
gtd_system.engage() | ||
```'''; | ||
|
||
final result = parser.convert(codeBlockMarkdown); | ||
final codeBlock = result.root.children.first; | ||
expect(codeBlock.toJson(), { | ||
'type': 'code', | ||
'data': { | ||
'language': 'python', | ||
'delta': [ | ||
{ | ||
'insert': '''# Example of using the GTD class | ||
gtd_system = GTD() | ||
gtd_system.capture("Write a blog post") | ||
gtd_system.capture("Prepare presentation for Monday") | ||
gtd_system.capture("Plan vacation") | ||
gtd_system.clarify() | ||
gtd_system.review() | ||
gtd_system.engage()''', | ||
}, | ||
], | ||
}, | ||
}); | ||
}); | ||
}); | ||
} |
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