Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown encoding throws exception for multi level lists #361

Closed
simonbengtsson opened this issue May 30, 2024 · 3 comments · Fixed by #411
Closed

Markdown encoding throws exception for multi level lists #361

simonbengtsson opened this issue May 30, 2024 · 3 comments · Fixed by #411
Labels
bug Something isn't working

Comments

@simonbengtsson
Copy link
Contributor

simonbengtsson commented May 30, 2024

Steps to Reproduce

With editor

  • Create list item (using for example "- " markdown shortcut)
  • Create indented list item (using for example enter + tab)
  • Encode document to markdown (exception thrown)

With code

final doc = ParchmentDocument.fromDelta(
  Delta()
    ..insert('Hello')
    ..insert('\n', {'block': 'ul'})
    ..insert('World')
    ..insert('\n', {'block': 'ul', 'indent': 1})
    ..insert('\n'),
  );
final markdown = parchmentMarkdown.encode(doc); // Throws exception (see below)
print('Markdown: $markdown');

Environment

  • OS macos
  • Flutter version 3.22.1
  • Fleather version: master

Logs

Unhandled Exception: Invalid argument(s): Cannot handle indent: 1
#0      _ParchmentMarkdownEncoder._writeAttribute (package:parchment/src/codecs/markdown.dart:495:7)
#1      _ParchmentMarkdownEncoder.convert.handleLine (package:parchment/src/codecs/markdown.dart:412:11)
[...]
@simonbengtsson simonbengtsson changed the title Markdown encoding throws exxception for multi level lists Markdown encoding throws exception for multi level lists Jun 4, 2024
@Amir-P Amir-P added the bug Something isn't working label Jun 9, 2024
@amantoux
Copy link
Member

@simonbengtsson thank you for reporting this
Can you please try with the below and tell me if it covers all your use cases

  fleather:
    git:
      url: https://github.com/fleather-editor/fleather
      ref: fix/fix/mardown_codec_list_with_indent
      path: packages/fleather

@simonbengtsson
Copy link
Contributor Author

Worked perfectly! Awesome! Had to use the following dependency override, but might be related to my setup.

dependency_overrides:
  parchment:
    git:
      url: https://github.com/fleather-editor/fleather
      ref: fix/mardown_codec_list_with_indent
      path: packages/parchment
  fleather:
    git:
      url: https://github.com/fleather-editor/fleather
      ref: fix/mardown_codec_list_with_indent
      path: packages/fleather

@amantoux
Copy link
Member

Worked perfectly! Awesome! Had to use the following dependency override, but might be related to my setup.

dependency_overrides:
  parchment:
    git:
      url: https://github.com/fleather-editor/fleather
      ref: fix/mardown_codec_list_with_indent
      path: packages/parchment
  fleather:
    git:
      url: https://github.com/fleather-editor/fleather
      ref: fix/mardown_codec_list_with_indent
      path: packages/fleather

My bad!

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants