Open jazzbpn opened 5 years ago
🙋♂️I do need this. Thanks
I do need this too, Thanks.
There's a PR #178 ...and a PR for the PR: https://github.com/Yom3n/zefyr/pull/1
I had this problem just now. I have found this package: markdown And code:
Delta _delta = _controller.document.toDelta();
String html = markdownToHtml(notusMarkdown.encode(_delta) .toString());
print(html);
@sil-main-coo Dose these methods works well? it will help me a lot if so. Thanks
@sil-main-coo Dose these methods works well? it will help me a lot if so. Thanks
It supports markdown conversion to html. For my project it is very good. Please read the documentation for reference. But if you require more complicated tags, find something else. You can also refer to @nalbion 's pull request above.
If you want to use the HTML codec in my PR right now, add the following to your pubspec.yaml
:
dependency_overrides:
notus:
git:
url: git://github.com/nalbion/zefyr.git
path: packages/notus
This is how I'm using my Markdown decoder:
_saveNotes() {
final markdown = notusMarkdown.encode(_notesController.document.toDelta());
// save the markdown string
}
NotusDocument _loadNotes() {
// load a markdown string
var markdown = null; // 'This is **Markdown**'
if (markdown == null) {
return NotusDocument();
}
return NotusDocument.fromDelta(notusMarkdown.decode(markdown));
}
I had this problem just now. I have found this package: markdown And code:
Delta _delta = _controller.document.toDelta(); String html = markdownToHtml(notusMarkdown.encode(_delta) .toString()); print(html);
How to use create notusMaskdown object? Please checkout the screenshot below.
I had this problem just now. I have found this package: markdown And code:
Delta _delta = _controller.document.toDelta(); String html = markdownToHtml(notusMarkdown.encode(_delta) .toString()); print(html);
How to use create notusMaskdown object? Please checkout the screenshot below.
Sorry. I wrote missing a package: Notus. And Delta Package if u need
You need to add import 'package:notus/convert.dart';
and use the HTML codec instead of Markdown
Awesome thanks!!.
Does anyone know how to make it from the other way? How to display html inside zephyr? I'am trying to convert html to Notusdocument
You need to add
import 'package:notus/convert.dart';
and use the HTML codec instead of Markdown
Do you have any examples?
Anyone Has complete code for reference
import 'package:markdown/markdown.dart' as markdown; import 'package:notus/convert.dart';
Delta _delta = _controller.document.toDelta();
String html = markdown
.markdownToHtml(notusMarkdown.encode(_delta).toString());
print(html);
What is package:markdown/markdown.dart? BTW, it is also possible to do it at server side. We found a Golang package to do it https://github.com/singerdmx/BulletJournal/commit/16fc1c2b82872a94a69880a711ed46377e9bb2d4
I am trying to get entered content as HTML format from this ZefyrField. If it is possible how?
_controller.document.toJson()
and_controller.document.toString()
gives the content in json and string format. But what if want to get that entered content as HTML format?