docsy_markdown 0.1.3 copy "docsy_markdown: ^0.1.3" to clipboard
docsy_markdown: ^0.1.3 copied to clipboard

Markdown import and export support for Docsy, the modular Flutter WYSIWYG editor. Convert documents seamlessly between Docsy and Markdown.

Docsy Markdown #

The Docsy Markdown package provides Markdown import and export for the Docsy editor. It converts a DocumentRoot to Markdown and parses Markdown back into Docsy blocks.

Try it Live

Features #

  • Export DocumentRoot to Markdown
  • Import Markdown back into Docsy
  • Supports paragraphs, headings, quotes, lists, dividers, code blocks, inline formatting, links, and image embeds
  • Uses Markdown syntax when possible
  • Falls back to HTML <img> output when image width or height must be preserved

Installation #

Add this to your pubspec.yaml:

dependencies:
  docsy_markdown: ^0.1.3

Usage #

import 'package:docsy/docsy.dart';
import 'package:docsy_markdown/docsy_markdown.dart';

void main() {
  final doc = DocumentRoot(
    blocks: [
      ParagraphNode(
        inlines: const [
          TextSpanNode('Hello '),
          TextSpanNode('world', marks: TextMarks(bold: true)),
        ],
      ),
      EmbedNode(
        kind: 'image',
        data: const {
          'src': 'https://example.com/image.png',
          'alt': 'Example image',
        },
      ),
    ],
  );

  final markdown = DocsyMarkdownCodec().encode(doc);
  final roundTrip = DocsyMarkdownCodec().decode(markdown);

  print(markdown);
  print(roundTrip.blocks.length);
}

Example #

Hello **world**

![Example image](https://example.com/image.png)

License #

MIT License. See LICENSE.

1
likes
140
points
147
downloads

Documentation

API reference

Publisher

verified publisherastrodevs.space

Weekly Downloads

Markdown import and export support for Docsy, the modular Flutter WYSIWYG editor. Convert documents seamlessly between Docsy and Markdown.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

docsy, flutter, markdown

More

Packages that depend on docsy_markdown