flutter_quill_kit_markdown 0.1.0
flutter_quill_kit_markdown: ^0.1.0 copied to clipboard
Bidirectional Quill Delta to Markdown conversion. Pure Dart companion package to flutter_quill_kit; also usable standalone or server-side.
flutter_quill_kit_markdown #
Bidirectional Quill Delta ↔ Markdown conversion in pure Dart — the
Markdown companion to
flutter_quill_kit, also
usable standalone or server-side. Depends only on dart_quill_delta and
markdown; no Flutter.
Installation #
dart pub add flutter_quill_kit_markdown
Pure Dart — usable in Flutter apps, CLI tools, and on the server.
Quick start #
import 'package:flutter_quill_kit_markdown/flutter_quill_kit_markdown.dart';
// Markdown -> Delta (always a valid, insert-only, '\n'-terminated document):
final delta = markdownToDelta('# Hello\n\nSome **bold** text.');
// Delta -> Markdown:
final markdown = deltaToMarkdown(delta);
The function forms wrap the configurable MarkdownToDelta and
DeltaToMarkdown classes.
Supported syntax #
Both directions cover: bold, italic, strikethrough (GFM), inline code,
links, images, headers 1–6, ordered and bullet lists (nesting ↔ the Quill
indent attribute), GFM task-list checklists (- [x] / - [ ]),
blockquotes, and fenced code blocks with language
({"code-block": "dart"}).
Attributes Markdown cannot express (color, background, font, size, align,
direction, ...) are dropped on the way out and reported through the
onUnsupported hook:
final md = deltaToMarkdown(
delta,
onUnsupported: (key, value) => log('dropped $key: $value'),
);
Underline has no Markdown syntax; opt into an HTML fallback to round-trip
it as literal <u>...</u>:
deltaToMarkdown(delta, htmlFallback: true);
markdownToDelta(source, htmlFallback: true);
Delta compatibility #
Attribute keys and values match what Quill, flutter_quill and
flutter_quill_kit write (bold, strike, code-block,
list: "ordered", ...), redeclared locally as QuillKeys so this package
needs no editor dependency.
License #
MIT — see LICENSE.