Giter Club home page Giter Club logo

delta_markdown's Introduction

A portable Markdown library written in Dart. It can convert between Markdown and Delta.

The converter is not ready for production

Usage

import 'package:delta_markdown/delta_markdown.dart';

void main() {
  const markdown = 'Hello **Markdown**';
  print(markdownToDelta(markdown));

  const delta = r'[{"insert":"Hello "},{"insert":"Markdown","attributes":{"bold":true}},{"insert":"\n"}]';
  print(deltaToMarkdown(delta));
}

Supports

Currently, these elements are supported:

  • Bold
  • Italic
  • Link
  • Blockquote
  • Header
  • List
  • Code Block
  • Image
  • Horizontal Rule

Does not support the following elements, because Markdown does not support them:

  • Background Color
  • Color
  • Font
  • Size
  • Strikethrough
  • Superscript/Subscript
  • Underline
  • Text Alignment
  • Text Direction
  • Formula
  • Video

Does not support the following elements, because flutter_quill does not support them:

  • Inline Code

Known limits

Support for these elements must be implemented:

  • Indent

There are only a few tests so far, so the functionality is not yet guaranteed in complex cases.

delta_markdown's People

Contributors

0xcaff avatar blquinn avatar chalin avatar devtud avatar dikmax avatar dudeofawesome avatar efortuna avatar filiph avatar friebetill avatar harkairt avatar jcollins-g avatar jiridanek avatar kevmoo avatar kolja-esders avatar kwalrath avatar lrhn avatar matthiasn avatar mehaase avatar mit-mit avatar munificent avatar srawlins avatar tomyeh avatar westy92 avatar zoechi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

delta_markdown's Issues

Issues with new lines

Thank you very much for this great tool. I noticed an issue with new lines handling

In markdown new lines must be specified with 2 (or more) consecutive lines. so one \n in quill should be transformed into two \n. and 1 \n in markdown should be ignored and more than that should result in only a single \n.

deltaToMarkdown

[{"insert":"line 1line 2\\nline 3\\n"}]

expected:

line 1line 2

line3

actual:

line 1line 2
line 3

markdownToDelta

line 1
line 2

line 3

expected:

[{"insert":"line 1line 2\\nline3\\n"}]

actual:

[{"insert":"line 1\\nline 2\\nline 3\\n"}]

Does not support flutter_quill >3.4.4

Looks like flutter_quill had a breaking change in the way they export stuff (models etc are no longer exposed)
So to use delta_markdown we are having to cap flutter_quill to 3.4.4 for now

package update than show issue flutter_quill: ^3.0.0

Because delta_markdown 0.3.0 depends on flutter_quill ^2.0.0 and no versions of delta_markdown match >0.3.0 <0.4.0, delta_markdown ^0.3.0 requires flutter_quill ^2.0.0.
So, because lms_teacher depends on both delta_markdown ^0.3.0 and flutter_quill ^3.0.0, version solving failed.
pub get failed (1; So, because lms_teacher depends on both delta_markdown ^0.3.0 and flutter_quill ^3.0.0, version solving failed.)
Process finished with exit code 1

Video conversion failure

String quillDeltaToHtml(Delta delta) {
final convertedValue = jsonEncode(delta.toJson());
print(convertedValue);
final markdown = deltaToMarkdown(convertedValue);
print(markdown.toString());
final html = markdownToHtml(markdown);
return html;
}

I/flutter ( 3379): [{"insert":{"video":"https://www.runoob.com/try/demo_source/movie.mp4"}},{"insert":"\n\n\n"}]
I/flutter ( 3379):
I/flutter ( 3379):
I/flutter ( 3379):

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.