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

Converting Markdown to Quill document (Delta) format #1852

Open
1 task done
781flyingdutchman opened this issue May 8, 2024 · 1 comment
Open
1 task done

Converting Markdown to Quill document (Delta) format #1852

781flyingdutchman opened this issue May 8, 2024 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@781flyingdutchman
Copy link

Is there an existing issue for this?

The question

I am trying to convert basic MarkDown to a formatted Quill document, but the approach that I believe is right only parses the in-line markdown (like bold and italics) and not markdown like headers and block markdown like an ordered list. What am I doing wrong?

Code snippet:

final markdownDocument = md.Document(inlineSyntaxes: [ // not sure I need to specify these, but I did
            md.EmphasisSyntax.asterisk(),
            md.EmphasisSyntax.underscore()
          ], blockSyntaxes: const [ // similarly, not sure I need to specify these as they are pretty standard
            md.HeaderSyntax(),
            md.UnorderedListSyntax(),
            md.OrderedListSyntax()
          ]);
          final quillDocDelta =
              MarkdownToDelta(markdownDocument: markdownDocument)
                  .convert(markDownString); // markDownString is a typical markdown formatted document
          result = jsonEncode(quillDocDelta.toJson());

The result can be used to create a Quill document, but as described above, only some of the formatting makes it into the document.

@781flyingdutchman 781flyingdutchman added the help wanted Extra attention is needed label May 8, 2024
@hoangsang17th
Copy link
Contributor

Almost convert package like Html to Quill, Md to Quill are not good, so I have 2 options for u.

  1. U using Quill format for storage (not need convert) (best solution)
  2. Or, You write a new convert function, which will take about 8-12 hours of u (not good, you need very effort and you can mistakes in some cases)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants