-
Notifications
You must be signed in to change notification settings - Fork 858
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
Support conversion of Delta to HTML and Markdown #15
Comments
It is also possible to do it at server side. |
Note our underlying format is different than Notus |
Zefyr's library won't work since it is missing a lot of attributes. |
This could be a huge limitation for flutter apps looking to use this package. |
You can modify Zefyr's library to submit a pull request if you want. |
I mean you can copy Zefyr's code and make changes to it. It is much easier |
@singerdmx In my opinion, there are only a few minor changes needed to be made in this code for it to work with this package. Like replacing |
The above is what Zefyr supports. |
That is why this library is leaps and bounds better than Zeyfr library in my humble opinion.
This is right. That is why only a few changes are needed to be made in this code before it can work with this library. |
Here is my modified version (Doesn't work yet, needs a few getters and functions from the Flutter-quill library)
|
Hope so. We can add this ourself but it is lower priority for us - you may need to wait several months. |
@singerdmx That PR you mentioned works with
The above code doesn't work and shows this error:
The quill_delta version is different that is the root cause of the problem. |
OK, that is just for reference. |
This is unfortunately the crux of the matter. I actually found the way to convert Zeyfr document into flutter-quill document and vice-versa. My plan is to convert the flutter-quill doc to Zeyfr doc and then convert it into markdown. Will keep you posted. |
@singerdmx I have successfully created the Delta to markdown converter. Right now it has a few limitations, such as not able to convert It depends on |
1.0.0 is just one file right? |
It also depends on notus and it is quite large. |
Taking dependency on notus is fine. |
There is, as notus itself depends on |
Ok it seems so |
I have created the |
I think it is private repo |
However, there are a few limitations. For markdown to quill conversion, the markdown format needs to be very basic. Any fancy attributes are not supported yet. Let's keep this issue open till we implement our own conversion code without being at the mercy of |
I cannot access this repo |
Check now. |
I can access now |
So this is converting to markdown instead of html? |
There are existing packages for the conversion of md to HTML. |
You guys are working on it seriously or not? Please atleast tell this |
No not right now. Feel free to submit a PR if you want. In the meantime you can use the package. |
Ok Thanks For Informing
|
I created a new converter delta_markdown. It's an adapted version of an existing Markdown - Delta (Zefyr) converter so that it can now convert between Markdown - Delta (flutter_quill). It works in simple cases and I will probably extend it further in the coming weeks. One advantage is that images are supported. Currently it only works with flutter_quill ^0.3.5, as I am in the process of migrating to Flutter 2. |
@friebetill if it works out, you can update our REAMDE to add a section to use yours |
In case if someone is looking for workaround import 'dart:convert';
import 'package:delta_markdown/delta_markdown.dart';
import 'package:flutter_quill/models/quill_delta.dart';
import 'package:markdown/markdown.dart';
String quillDeltaToHtml(Delta delta) {
final convertedValue = jsonEncode(delta.toJson());
final markdown = deltaToMarkdown(convertedValue);
final html = markdownToHtml(markdown);
return html;
} |
As it's possible with the library delta_markdown to convert between delta and markdown and with the library markdown to convert between markdown and html, I close the issue. If you disagree, please write a comment and I will reopen it. |
@friebetill You saved my day. Much appreciate it! |
@friebetill instead of dropping support from many features (like colors) because they are not supported in Markdown, you should allow the user to customize it as he wants. For example, the user may like to encode them as elements with a style, since using HTML inside Markdown is very popular. |
For us to be able to create other extensible packages, it would be handy to isolate the delta implementation used for |
I have created a new library that can convert from and to markdown that addresses the following:
Contribution and feedback are most certainly welcome. Library Repo: https://github.com/TarekkMA/markdown_quill I will release it soon to pub.dev. |
Good luck bro, Unfortunately, I found that Markdown is not the most suitable language for me since it needs a lot of customization, so I switched to HTML because it has all the rich text stuff out-of-the-box. I am currently writing my own code to export to and import from HTML, using the available parser library called |
@Hamza5 thank you, in my current project markdown is a requirement so I will need to stick to it. |
Nice @TarekkMA! I will try your version and if it's better than my hacky package, I will link to your package, deprecate my package and archive my repository. |
Published on pub https://pub.dev/packages/markdown_quill |
This Library converts Zeyfr documents to HTML.
There are many plugins that can help with the conversion of HTML to markdown. I was thinking that with some tweaking we can create our own converter too.
Or we can take another approach, we can first convert Delta to markdown like here and then to HTML.
Again, this requires just some minor tweaking.
The text was updated successfully, but these errors were encountered: