parchment_to_html 1.0.0+1 copy "parchment_to_html: ^1.0.0+1" to clipboard
parchment_to_html: ^1.0.0+1 copied to clipboard

A Dart package for converting between Parchment and HTML formats.

example/main.dart

import 'dart:developer';

import 'package:fleather/fleather.dart';

import 'package:parchment_delta/parchment_delta.dart';

import 'package:parchment_to_html/parachment_to_html.dart';

void main() {
  const converter = ParchmentHtmlCodec();

  // Replace with the document you have take from the Zefyr editor
  final doc = ParchmentDocument.fromJson(
    [
      {
        "insert": "Hello World!",
      },
      {
        "insert": "\n",
        "attributes": {
          "heading": 1,
        },
      },
    ],
  );

  String html = converter.encode(doc.toDelta());
  log(html); // The HTML representation of the ParchmentDocument

  Delta delta = converter.decode(html); // Fleather compatible Delta
  ParchmentDocument document = ParchmentDocument.fromDelta(delta);
  log(document.toString());
}
3
likes
135
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart package for converting between Parchment and HTML formats.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

cupertino_icons, fleather, flutter, html, parchment_delta

More

Packages that depend on parchment_to_html