패키지, 저장소 및 앱 카테고리 검색

패키지 상세v1.0.12

flutter_markdown_plus

Flutter용 마크다운 렌더러입니다. 간단한 마크다운 태그로 포맷된 일반 텍스트 데이터에서 텍스트 스타일, 표, 링크 등을 포함하는 풍부한 텍스트 출력을 생성합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
95.6만
좋아요
153
Pub 점수
160

패키지 설치

flutter pub add flutter_markdown_plus

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

플러터 패키지로 마크다운 텍스트를 풍부하고 스타일이 적용된 위젯으로 렌더링하며, 텍스트 포맷팅, 표, 링크 등을 지원합니다. 단순한 마크다운 구문을 여러 플랫폼에서 시각적으로 매력적인 UI 요소로 변환합니다. 문서, 블로그 게시물 또는 사용자 생성 텍스트와 같은 동적 콘텐츠를 깔끔하고 일관된 방식으로 표시하는 데 이상적입니다. 이 패키지는 가볍고 플러터 앱에 원활하게 통합되며, 복잡한 커스텀 렌더링 없이 개발자가 텍스트 표현을 쉽게 향상시킬 수 있는 간단한 API를 제공합니다.

사용 사례

  • 렌더링 문서
  • 블로그 콘텐츠 표시
  • 사용자가 생성한 텍스트 표시
  • 앱에서 리치 텍스트 만들기
  • 다중 플랫폼 텍스트 표시 지원

주요 기능

  • 테이블 및 복잡한 레이아웃을 지원합니다
  • Markdown에서 풍부한 텍스트 스타일링
  • 크로스 플랫폼 호환성
  • Flutter와의 간편한 통합
  • 링크 및 이미지 처리
  • 확장 가능한 위젯 사용자 정의

적합한 대상

  • 풍부한 텍스트 렌더링이 필요한 앱
  • 문서 또는 도움 시스템
  • 콘텐츠 중심 애플리케이션
  • 콘텐츠에 마크다운을 사용하는 개발자
  • 다중 플랫폼 Flutter 프로젝트

고려 사항

  • 기본 마크다운 구문에 제한됨
  • 내장된 이미지 로딩 없음
  • 외부 링크에 대한 수동 처리가 필요합니다
  • 고급 형식 지정 요구 사항에 적합하지 않습니다
  • 복잡한 디자인의 경우 추가 스타일링이 필요할 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Flutter Markdown Plus

pub package

About This Package

flutter_markdown_plus is the continuation of the original flutter_markdown package that was developed and maintained by Google. As the original package has been discontinued, Foresight Mobile has taken over maintenance of this project to ensure continued support and development for the Flutter community.

The package is actively maintained: bug reports are triaged against the current release, community pull requests are reviewed and merged with credit, and fixes and additive features ship regularly as patch releases. See the changelog and GitHub releases for the full history, and CONTRIBUTING.md if you'd like to help.

Recent highlights
  • contextMenuBuilder — customise or suppress the text-selection toolbar shown when selectable is enabled (1.0.10).
  • noScroll — render Markdown in a non-scrolling Column for embedding inside an existing scroll view (1.0.8).
  • Theme-aware blockquotes — default blockquote styling now adapts to light and dark themes (1.0.8).
  • Correct inline formatting in blockquotes, consistent line height across mixed font weights, and custom builders/paddingBuilders support for the hr tag (1.0.8).
  • Integration test suite running on a real device or emulator, plus a GitHub Actions job on an Android emulator (1.0.8).

For historical context, see the original flutter_markdown package.

LaTeX Support: For LaTeX rendering support, check out the flutter_markdown_plus_latex package.

Features

  • GitHub Flavored Markdown by default — headings, bold/italic, strikethrough, blockquotes, lists, and horizontal rules.
  • Tables with customisable borders, cell alignment, and per-column widths.
  • Task lists rendered as checkboxes.
  • Fenced and inline code with independent per-block horizontal scrolling and selection highlighting.
  • Links with a tap callback, and images from the network, local files, or bundled assets.
  • Footnotes and emoji (Unicode or :shortcode: syntax).
  • Text selection with onSelectionChanged, a tap handler, and a customisable selection toolbar via contextMenuBuilder.
  • Three widgets for different layouts: scrollable Markdown, inline MarkdownBody, and unstyled MarkdownRaw.
  • Deep styling through MarkdownStyleSheet, plus custom element and padding builders for full control over rendering.
  • noScroll mode to embed rendered Markdown inside an existing scroll view.
  • Runs on Android, iOS, web, macOS, Windows, and Linux.

Screenshots

Rich text & formatting Tables & task lists Code blocks
Rich text and formatting Tables and task lists Code blocks

Installation

Add the package to your project:

flutter pub add flutter_markdown_plus

Then import it where you need it:

import 'package:flutter_markdown_plus/flutter_markdown_plus.dart';

A markdown renderer for Flutter. It supports the original format, but no inline HTML.

Overview

The flutter_markdown_plus package renders Markdown, a lightweight markup language, into a Flutter widget containing a rich text representation.

flutter_markdown_plus is built on top of the Dart markdown package, which parses the Markdown into an abstract syntax tree (AST). The nodes of the AST are an HTML representation of the Markdown data.

Flutter Isn't an HTML Renderer

While this approach to creating a rich text representation of Markdown source text in Flutter works well, Flutter isn't an HTML renderer like a web browser. Markdown was developed by John Gruber in 2004 to allow users to turn readable, plain text content into rich text HTML. This close association with HTML allows for the injection of HTML into the Markdown source data. Markdown parsers generally ignore hand-tuned HTML and pass it through to be included in the generated HTML. This trick has allowed users to perform some customization or tweaking of the HTML output. A common HTML tweak is to insert HTML line-break elements <br /> in Markdown source to force additional line breaks not supported by the Markdown syntax. This HTML trick doesn't apply to Flutter. The flutter_markdown_plus package doesn't support inline HTML.

Markdown Specifications and flutter_markdown_plus Compliance

There are three seminal documents regarding Markdown syntax; the original Markdown syntax documentation specified by John Gruber, the CommonMark specification, and the GitHub Flavored Markdown specification.

The CommonMark specification brings order to and clarifies the Markdown syntax cases left ambiguous or unclear in the Gruber document. GitHub Flavored Markdown (GFM) is a strict superset of CommonMark used by GitHub.

The markdown package, and in extension, the flutter_markdown_plus package, supports four levels of Markdown syntax; basic, CommonMark, GitHub Flavored, and GitHub Web. Basic, CommonMark, and GitHub Flavored adhere to the three Markdown documents, respectively. GitHub Web adds header ID and emoji support. The flutter_markdown_plus package defaults to GitHub Flavored Markdown.

Getting Started

Using the Markdown widget is simple, just pass in the source markdown as a string:

const Markdown(data: markdownSource);

If you do not want the padding or scrolling behavior, use the MarkdownBody instead:

const MarkdownBody(data: markdownSource);

By default, Markdown uses the formatting from the current material design theme, but it's possible to create your own custom styling. Use the MarkdownStyle class to pass in your own style. If you don't want to use Markdown outside of material design, use the MarkdownRaw class.

Choosing a widget
Widget Use it when
Markdown You want a standalone, scrollable view of the content.
MarkdownBody You want to embed rendered Markdown inside your own layout; it sizes itself to its content.
MarkdownRaw You want the rendering without Material theming.

To render inside an existing scroll view (for example a CustomScrollView or a Column in a SingleChildScrollView), use Markdown with noScroll: true so it lays out as a non-scrolling Column instead of managing its own scrolling.

Handling Links

Markdown links are not followed automatically — you decide what a tap does. Provide an onTapLink callback and open the URL yourself, for example with the url_launcher package:

Markdown(
  data: '[Flutter](https://flutter.dev)',
  onTapLink: (String text, String? href, String title) {
    if (href != null) {
      launchUrl(Uri.parse(href));
    }
  },
);

Styling

Pass a MarkdownStyleSheet to restyle any element. The easiest approach is to start from the current theme and override only what you need with copyWith:

MarkdownBody(
  data: markdownSource,
  styleSheet: MarkdownStyleSheet.fromTheme(Theme.of(context)).copyWith(
    h1: Theme.of(context).textTheme.headlineMedium,
    code: const TextStyle(
      fontFamily: 'monospace',
      backgroundColor: Color(0x11000000),
    ),
    blockquotePadding: const EdgeInsets.all(12),
  ),
);

Custom Rendering

For full control over how a specific tag renders, supply a MarkdownElementBuilder through the builders map, and fine-tune spacing with paddingBuilders. This lets you swap in your own widgets for elements such as code, a, or custom tags. See the example/ app for working custom-builder demos.

Selection

By default, Markdown is not selectable. A caller may use the following ways to customize the selection behavior of Markdown:

  • Set selectable to true, and use onTapText and onSelectionChanged to handle tapping and selecting events.
  • Set selectable to false, and wrap Markdown with SelectionArea or SelectionRegion.

Emoji Support

Emoji glyphs can be included in the formatted text displayed by the Markdown widget by either inserting the emoji glyph directly or using the inline emoji tag syntax in the source Markdown document.

Markdown documents using UTF-8 encoding can insert emojis, symbols, and other Unicode characters directly in the source document. Emoji glyphs inserted directly in the Markdown source data are treated as text and preserved in the formatted output of the Markdown widget. For example, in the following Markdown widget constructor, a text string with a smiley face emoji is passed in as the source Markdown data.

Markdown(
  controller: controller,
  selectable: true,
  data: 'Insert emoji here😀 ',
);

The resulting Markdown widget will contain a single line of text with the emoji preserved in the formatted text output.

The second method for including emoji glyphs is to provide the Markdown widget with a syntax extension for inline emoji tags. The Markdown package includes a syntax extension for emojis, EmojiSyntax. The default extension set used by the Markdown widget is the GitHub flavored extension set. This pre-defined extension set approximates the GitHub supported Markdown tags, providing syntax handlers for fenced code blocks, tables, auto-links, and strike-through. To include the inline emoji tag syntax while maintaining the default GitHub flavored Markdown behavior, define an extension set that combines EmojiSyntax with ExtensionSet.gitHubFlavored.

import 'package:markdown/markdown.dart' as md;
// ···
  Markdown(
    controller: controller,
    selectable: true,
    data: 'Insert emoji :smiley: here',
    extensionSet: md.ExtensionSet(
      md.ExtensionSet.gitHubFlavored.blockSyntaxes,
      <md.InlineSyntax>[
        md.EmojiSyntax(),
        ...md.ExtensionSet.gitHubFlavored.inlineSyntaxes
      ],
    ),
  );

Image Support

The Img tag only supports the following image locations:

  • From the network: Use a URL prefixed by either http:// or https://.

  • From local files on the device: Use an absolute path to the file, for example by concatenating the file name with the path returned by a known storage location, such as those provided by the path_provider plugin.

  • From image locations referring to bundled assets: Use an asset name prefixed by resource:. like resource:assets/image.png.

Verifying Markdown Behavior

Verifying Markdown behavior in other applications can often be useful to track down or identify unexpected output from the flutter_markdown_plus package. Two valuable resources are the Dart Markdown Live Editor and the Markdown Live Preview. These two resources are dynamic, online Markdown viewers.

Markdown Resources

Here are some additional Markdown syntax resources:

Maintainers

This package is proudly maintained by Gareth Reese and Marko Radisavljevic for Foresight Mobile (GitHub)

카테고리

의존성

의존성 목록 3 개

소스 저장소

이 패키지를 사용하는 프로젝트