Docsy

pub package likes popularity points

Docsy is the core Flutter editor package for the Docsy ecosystem. It provides:

  • the document model
  • the EditorController
  • the RichTextEditor widget
  • JSON serialization
  • block editing for paragraphs, headings, quotes, dividers, code blocks, lists, and image embeds

Markdown and HTML conversion live in the companion packages docsy_markdown and docsy_html.

Try it Live

Features

  • WYSIWYG editing for Flutter
  • Inline formatting: bold, italic, underline, code, links
  • Block editing: paragraphs, headings, quotes, dividers, code blocks, list items, embeds
  • Undo and redo
  • JSON import/export through DocsyJson
  • Works on mobile, web, and desktop

Screenshots

Editing mode Readonly mode
Docsy editing Docsy readonly

Installation

Add this to your pubspec.yaml:

dependencies:
  docsy: ^0.1.3

Usage

import 'package:docsy/docsy.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    final controller = EditorController(
      document: DocumentRoot(
        blocks: [
          ParagraphNode(
            inlines: const [TextSpanNode('Hello from Docsy')],
          ),
        ],
      ),
    );

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Docsy Demo')),
        body: RichTextEditor(controller: controller),
        floatingActionButton: FloatingActionButton(
          onPressed: controller.insertParagraphAtEnd,
          child: const Icon(Icons.add),
        ),
      ),
    );
  }
}

Example

For a complete demo with edit/view mode, toolbar actions, image insertion, and export dialogs, see the docsy_example package.

Contributing

Contributions are welcome. Open an issue or submit a pull request if you want to improve Docsy.

License

Licensed under the MIT License. See LICENSE for details.

Libraries

docsy