FLUTTER ECOSYSTEM

zahniar88/simple_markdown_editor

Flutter용 마크다운 편집기

simple_markdown_editor 프로젝트 이미지
Stars
19
Forks
64
최근 푸시(UTC)
2024. 7. 15.
프로젝트 상태
활성
Zahniar Adirahman GitHub avatar
GITHUB User

Zahniar Adirahman ↗

Baturaja, Sumatera Selatan, Indonesia
언어DartHTMLRubySwiftKotlinObjective-C

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 7 개

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

simple_markdown_editor

Support Me Support Me GitHub stars undo GitHub

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

What's new (21/01/2022)

  • Auto preview if editor unfocused, request from issue #4

Features

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

Usage

Add dependencies to your pubspec.yaml

dependencies:
    simple_markdown_editor: ^latest

Run flutter pub get to install.

How it works

Import library

import 'package:simple_markdown_editor/simple_markdown_editor.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();
FocusNode _focusNode = FocusNode();

Show widget for editor

// editable text with toolbar
MarkdownFormField(
    controller: _controller,
    enableToolBar: true,
    emojiConvert: true,
    autoCloseAfterSelectEmoji: false,
)

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

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
    },
)