md_proc 0.2.4 copy "md_proc: ^0.2.4" to clipboard
md_proc: ^0.2.4 copied to clipboard

outdatedDart 1 only

CommonMark-compliant markdown parser

md_proc #

CommonMark-compliant Markdown parser.

Basic usage:

print(markdownToHtml('# Hello world!'));

Main difference from other parsers is Markdown-based AST. You can parse Markdown, process resulting AST and write results back to markdown.

Project main goal is create processing library for Markdown.

Parsing #

import "package:md_proc/md_proc.dart";

void main() {
  Document doc = CommonMarkParser.DEFAULT.parse('Hello world!\n===');
  print(doc); // Document [SetextHeader 1 [Str "Hello", Space, Str "world", Str "!"]]
}

Writing html #

import "package:md_proc/md_proc.dart";

void main() {
  Document doc = CommonMarkParser.DEFAULT.parse('Hello world!\n===');
  String res = HtmlWriter.DEFAULT.write(doc);
  print(res); // <h1>Hello world!</h1>
}

Writing markdown #

import "package:md_proc/md_proc.dart";

void main() {
  Document doc = CommonMarkParser.DEFAULT.parse('Hello world!\n===');
  String res = MarkdownWriter.DEFAULT.write(doc);
  print(res); // Hello world\!
              // =============
}

High-level plan for development #

  1. Follow CommonMark specification changes.
  2. Add MarkDown-extensions from pandoc, then change them to CommonMark extensions when they will be finally developed and accepted. (inline math, footnotes, etc.)
  3. AST-processing classes. Don't have much time to think about this. But this is definitely required.
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

CommonMark-compliant markdown parser

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, parsers, unicode_helper

More

Packages that depend on md_proc