搜索插件、代码仓与 APP 分类

插件详情v0.2.15

markdown_editor_plus

一个 TextField 小部件,可让您轻松地将 TextField 中的内容转换为 Markdown,并支持自定义工具栏。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
8270
喜欢数
73
Pub 分数
140

安装插件

flutter pub add markdown_editor_plus

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个增强文本输入的 Flutter 小部件,具备实时 Markdown 格式化功能。它包装了 TextField 以支持 Markdown 语法转换,并包含一个可自定义的工具栏,便于格式化。非常适合需要富文本编辑并输出 Markdown 的应用,例如笔记应用或内容管理系统。该包支持多种平台,包括移动设备、网页和桌面端,确保在不同设备上行为一致。

适合场景

  • 记事本应用
  • 内容创作工具
  • 文档编辑器
  • 博客写作界面
  • 基于 Markdown 的聊天应用

主要特点

  • 实时 Markdown 转换
  • 可自定义工具栏
  • 跨平台兼容性
  • 与 TextField 的简单集成
  • 支持所有主要平台

适合对象

  • 开发支持 Markdown 的表单的开发者
  • 需要轻量级富文本编辑的应用程序
  • 需要跨平台文本输入的项目
  • 想要直观 Markdown 格式化的用户

使用建议

  • 有限的高级格式设置选项
  • 无内置预览模式
  • 需要手动处理复杂的 Markdown 结构
  • 未针对大文档进行优化
  • 工具栏自定义需要基本的Flutter知识

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Markdown Editor Plus

This is a fork of simple_markdown_editor by zahnia88 with contributions from fossfreaks

Simple markdown editor library For flutter. For demo video, you can see it at this url Demo

Features

  • ✅ Convert to Bold, Italic, Strikethrough
  • ✅ Convert to Code, Quote, Links
  • ✅ Convert to Heading (H1, H2, H3).
  • ✅ Convert to unorder list and checkbox list
  • ✅ Support multiline convert
  • ✅ Support auto convert emoji

Usage

Add dependencies to your pubspec.yaml

dependencies:
    markdown_editor_plus: ^latest

Run flutter pub get to install.

How it works

Import library

import 'package:markdown_editor_plus/markdown_editor_plus.dart';

Initialize controller and focus node. These controllers and focus nodes are optional because if you don't create them, the editor will create them themselves

TextEditingController _controller = TextEditingController();

Show widget for editor

// editable text with toolbar by default
MarkdownAutoPreview(
    controller: _controller,
    emojiConvert: true,
)

// editable text without toolbar
MarkdownField(
    controller: _controller,
    emojiConvert: true,
    enableToolBar: false,
)

if you want to parse text into markdown you can use the following widget:

String data = '''
**bold**
*italic*

#hashtag
@mention
'''

MarkdownParse(
    data: data,
    onTapHastag: (String name, String match) {
        // name => hashtag
        // match => #hashtag
    },
    onTapMention: (String name, String match) {
        // name => mention
        // match => #mention
    },
)

In order to set the colors

MarkdownAutoPreview(
    controller: _controller,
    enableToolBar: true,
    emojiConvert: true,
    autoCloseAfterSelectEmoji: false,
    // toolbar's background color, text color will be based on theme
    toolbarBackground: Colors.blue,
    // toolbar's expandable widget colors like headings, ordering
    expandableBackground: Colors.blue[200],
)

所属分类

依赖

依赖清单 4 项

源码仓库

使用此插件的项目

暂无相关数据。