flutter_smooth_markdown 0.1.2 copy "flutter_smooth_markdown: ^0.1.2" to clipboard
flutter_smooth_markdown: ^0.1.2 copied to clipboard

A high-performance Flutter package for smooth markdown rendering with streaming support

Flutter Smooth Markdown #

A high-performance Flutter package for smooth markdown rendering with beautiful enhanced UI components.

โœจ Features #

  • ๐Ÿš€ High Performance - AST-based parsing with optimized rendering
  • ๐Ÿ“ Full Markdown Support - Headers, paragraphs, lists, code blocks, blockquotes, links, tables, and more
  • ๐ŸŽจ Customizable Styling - Easy theming with light/dark mode support and preset themes
  • โœจ Enhanced UI Components - Beautiful code blocks with copy buttons, animated links, gradient blockquotes
  • ๐ŸŽฏ Extensible Builder System - Custom widget builders for any markdown element
  • ๐Ÿ’ป Code Blocks - Syntax highlighting with language tags and copy functionality
  • ๐Ÿ”— Links - Hover animations and external link indicators
  • ๐Ÿ“ Flexible Theme System - Multiple built-in themes (Default, GitHub, VS Code) with light/dark variants
  • ๐Ÿ“Š Table Support - Beautiful table rendering with proper styling and borders
  • ๐Ÿงฎ Math Formulas - LaTeX equation rendering with flutter_math_fork
  • ๐Ÿ“Ž Footnotes - Reference and definition support for academic writing
  • ๐Ÿ–ผ๏ธ SVG Images - Native SVG rendering support with flutter_svg
  • ๐ŸŒ Internationalization - Multi-language example app (6 languages supported)
  • ๐ŸŽฌ Streaming Support - Real-time markdown rendering with StreamMarkdown widget

๐Ÿ“บ Demo #

Basic Rendering #

Basic Markdown Rendering

Enhanced Components #

Enhanced UI Components

Streaming Support #

Real-time Streaming

Note: Run the example app to see all features in action: cd example && flutter run

๐Ÿš€ Getting Started #

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_smooth_markdown: ^0.1.0

Then run:

flutter pub get

Basic Usage #

import 'package:flutter_smooth_markdown/flutter_smooth_markdown.dart';

// Simple markdown rendering
SmoothMarkdown(
  data: '# Hello Markdown\n\nThis is **bold** and this is *italic*.',
  styleSheet: MarkdownStyleSheet.light(),
  onTapLink: (url) {
    // Handle link tap
    print('Tapped: $url');
  },
)

Using Enhanced Components #

Get beautiful UI with enhanced components for code blocks, links, blockquotes, and headers:

import 'package:flutter_smooth_markdown/flutter_smooth_markdown.dart';

// Create custom renderer with enhanced components
final customRenderer = MarkdownRenderer(
  styleSheet: MarkdownStyleSheet.light(),
);

// Register enhanced builders
customRenderer.builderRegistry
  ..register('code_block', const EnhancedCodeBlockBuilder())
  ..register('blockquote', const EnhancedBlockquoteBuilder())
  ..register('link', const EnhancedLinkBuilder())
  ..register('header', const EnhancedHeaderBuilder());

// Render markdown
final nodes = MarkdownParser().parse(markdownText);
final widget = customRenderer.render(nodes);

Enhanced components include:

  • Code blocks with copy button, language tags, and hover effects
  • Blockquotes with quote icons, gradient backgrounds, and shadows
  • Links with hover animations and external link indicators
  • Headers with decorative accents and gradient borders

See ไฝฟ็”จๅขžๅผบ็ป„ไปถ.md for detailed usage.

๐Ÿ“š Documentation #

For detailed documentation, see:

  • Core Requirements - Project requirements and specifications
  • Development Plan - Development roadmap and phases
  • UI Optimization Guide - UI enhancement strategies
  • Using Enhanced Components - Guide to enhanced UI components
  • Theme System - Theming and customization guide
  • Phase 2 Summary - Parser implementation details

๐ŸŽฏ Supported Markdown Syntax #

Text Formatting #

  • Bold: **text** or __text__
  • Italic: *text* or _text_
  • Strikethrough: ~~text~~
  • Inline code: `code`

Headers #

# H1
## H2
### H3

Lists #

- Unordered list
1. Ordered list
- [ ] Task list
- [x] Completed task

Code Blocks #

```dart
void main() {
  print('Hello, World!');
}
```
[Link text](https://example.com)
![Flutter Logo](https://storage.flutter-io.cn/cms-storage-bucket/4fd0db61df0567c0f352.png)

Tables #

| Header 1 | Header 2 |
|----------|----------|
| Cell 1   | Cell 2   |

Math Formulas #

Inline math: $E = mc^2$

Block math:
$$
\int_{a}^{b} f(x) dx = F(b) - F(a)
$$

Footnotes #

This text has a footnote[^1].

[^1]: This is the footnote content.

SVG Images #

![Flutter Icon](https://rawgit.flutter-io.cn/simple-icons/simple-icons/develop/icons/flutter.svg)

๐ŸŽจ Theming #

The package includes multiple built-in themes with light and dark variants:

// Default themes
SmoothMarkdown(
  data: markdownText,
  styleSheet: MarkdownStyleSheet.light(), // or .dark()
)

// GitHub theme
SmoothMarkdown(
  data: markdownText,
  styleSheet: MarkdownStyleSheet.github(brightness: Brightness.light),
)

// VS Code theme
SmoothMarkdown(
  data: markdownText,
  styleSheet: MarkdownStyleSheet.vscode(brightness: Brightness.dark),
)

// Adapt to Flutter theme automatically
SmoothMarkdown(
  data: markdownText,
  styleSheet: MarkdownStyleSheet.fromTheme(Theme.of(context)),
)

// Custom theme
final customTheme = MarkdownStyleSheet.light().copyWith(
  h1Style: TextStyle(fontSize: 32, fontWeight: FontWeight.bold),
  linkStyle: TextStyle(color: Colors.blue),
  codeBlockDecoration: BoxDecoration(
    color: Colors.grey[100],
    borderRadius: BorderRadius.circular(8),
  ),
);

See ไธป้ข˜็ณป็ปŸ.md for complete theming guide.

๐Ÿค Contributing #

Contributions are welcome! Please read our contributing guidelines before submitting PRs.

๐Ÿ“„ License #

This project is licensed under the MIT License.

๐Ÿ“ Roadmap #

Completed #

  • โœ… Phase 1: Core project structure and AST node definitions
  • โœ… Phase 2: Markdown parser implementation (87+ tests passing)
  • โœ… Phase 3: Renderer implementation with widget builder system
  • โœ… Enhanced UI components (code blocks, blockquotes, links, headers)
  • โœ… Theme system with multiple presets (Default, GitHub, VS Code)
  • โœ… Example application with theme showcase
  • โœ… Syntax highlighting for code blocks with flutter_highlight
  • โœ… Table support with proper styling
  • โœ… Image rendering with caching (cached_network_image)
  • โœ… SVG image support (flutter_svg)
  • โœ… Math formula rendering (LaTeX with flutter_math_fork)
  • โœ… Footnote support (references and definitions)
  • โœ… Multi-language internationalization (Chinese, English, Japanese, Spanish, French, Korean)
  • โœ… Phase 4: Stream support for real-time rendering with StreamMarkdown widget
  • โœ… Streaming demo in example app

In Progress #

  • โŒ Performance optimization and benchmarking
  • โŒ API documentation and code comments

Planned #

  • โŒ More theme presets
  • โŒ Plugin system for custom parsers
  • โŒ Advanced table features (sorting, filtering)
  • โŒ Accessibility improvements (screen reader support)

Made with โค๏ธ for the Flutter community

4
likes
0
points
405
downloads

Publisher

unverified uploader

Weekly Downloads

A high-performance Flutter package for smooth markdown rendering with streaming support

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

cached_network_image, flutter, flutter_highlight, flutter_math_fork, flutter_svg, markdown, url_launcher

More

Packages that depend on flutter_smooth_markdown