Skip to content
pubscout

dart_markdown

3.1.7, released 4 years ago by tagnote.app

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

WASM-ready
$ flutter pub add dart_markdown
Source repository

What it does

Parses Markdown text into an Abstract Syntax Tree (AST) complete with location information and renders it to HTML on both the client and server. It provides 100% compliance with CommonMark and GitHub Flavored Markdown (GFM), while supporting custom syntax extensions.

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

Use it when

  • You need to parse Markdown into an AST with exact location data in Dart.
  • You want to render Markdown to HTML on either the client or server.

Skip it when

  • You are looking for a complete rich-text editor or Markdown widget implementation for UI.

Strengths

  • 100% conform to CommonMark and GFM specifications.
  • Outputs AST with precise location information (line, column, offset) for text and markers.
  • Supports custom syntax extensions via custom syntax classes.

Weaknesses

  • Does not include built-in UI widgets for displaying Markdown in a Flutter app out of the box.

Setup

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

void main() {
  final markdown = Markdown();
  final nodes = markdown.parse('Hello **Markdown**!');
  final html = nodes.toHtml();
  print(html);
}

Alternatives

Packages that do the same job and could replace dart_markdown.

  • markdown

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

  • apollovm

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

  • markdown_description_list

    Adds support for Markdown description/definition lists to the markdown package

  • html2md

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

Works with

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