Skip to content
pubscout

markdown

7.3.1, released 8 months ago by tools.dart.dev

A portable Markdown library written in Dart that can parse Markdown into HTML.

WASM-readyRock solid
$ flutter pub add markdown
Source repository

What it does

Parses Markdown text into HTML on both the client and server. Supports multiple extension sets such as CommonMark and GitHub Flavored Markdown, as well as custom syntax extensions.

AI-written summary of version 7.3.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to parse Markdown documents into HTML in a Dart or Flutter application.
  • You want support for CommonMark or GitHub Flavored Markdown extension sets.

Skip it when

  • You need built-in HTML sanitization out of the box.
  • You are looking for a Markdown widget for rendering rich text natively rather than via HTML.

Strengths

  • Portable and works on both client and server.
  • Supports multiple pre-defined extension sets like CommonMark and GitHub Flavored Markdown.
  • Allows creating and using custom syntax extensions.

Weaknesses

  • Offers no features in the way of HTML sanitization.
  • Requires manual handling of XSS vulnerabilities via sanitization.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2
import 'package:markdown/markdown.dart';

void main() {
  print(markdownToHtml('Hello *Markdown*'));
  //=> <p>Hello <em>Markdown</em></p>
}

Alternatives

Packages that do the same job and could replace markdown.

  • dart_markdown

    A portable Markdown library written in Dart that parses Markdown into AST and HTML.

  • apollovm

    Portable multi-language VM to parse, run, translate, and compile Dart, Java, Kotlin, Go, C#, JS, and Python.

  • html2md

    Converts HTML strings or DOM nodes to CommonMark‑compatible Markdown.

  • icalendar_parser

    Package to parse iCalendar (.ics) files written in pure Dart.

Works with

Packages commonly used together with markdown: ones it builds on, ones built on it, and its own family.