Skip to main content

rich_markdown 0.1.0 copy "rich_markdown: ^0.1.0" to clipboard
rich_markdown: ^0.1.0 copied to clipboard

A Flutter package for rendering Markdown, LaTeX, and HTML content.

rich_markdown #

A reusable Flutter widget for rendering Markdown, LaTeX equations, and HTML in one place.

Features #

  • Render Markdown content with GitHub-flavored extensions.
  • Render inline and block LaTeX equations.
  • Render HTML and common HTML/CSS styling.
  • Customize text styles and link callbacks.
  • Use a single widget API across Flutter applications.

Installation #

Add the dependency to your pubspec.yaml:

dependencies:
  rich_markdown: ^0.1.0

Then run:

flutter pub get

Markdown #

import 'package:rich_markdown/rich_markdown.dart';

RichMarkdownView(
  data: '''
# Hello Flutter

This is **bold** text.

Inline math: \\(E = mc^2\\)

$$
\\frac{a}{b}
$$
''',
  type: ContentType.markdown,
)

LaTeX #

RichMarkdownView(
  data: r'\int_0^1 x^2\,dx = \frac{1}{3}',
  type: ContentType.latex,
)

HTML #

RichMarkdownView(
  data: '<h2>Hello</h2><p>HTML content</p>',
  type: ContentType.html,
)

Customize text #

RichMarkdownView(
  data: '# Custom text',
  textStyle: const TextStyle(
    fontSize: 18,
    height: 1.5,
  ),
)
RichMarkdownView(
  data: '[Flutter](https://flutter.dev)',
  onLinkTap: (url) {
    debugPrint('Tapped: $url');
  },
)

Development #

Run tests:

flutter test

Run static analysis:

flutter analyze

Limitations #

  • LaTeX support depends on the capabilities of the underlying math renderer.
  • Inline HTML and complex Markdown combinations require regression testing.
  • HTML rendering is not a complete browser engine.
  • Sanitize untrusted HTML and validate URLs before allowing navigation.

License #

MIT

8
likes
130
points
450
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter package for rendering Markdown, LaTeX, and HTML content.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, flutter_html, flutter_math_fork, html, markdown

More

Packages that depend on rich_markdown