#cmark #gfm #github #markdown #api-bindings

cmark-gfm

Rust wrapper of libcmark-gfm

1 unstable release

0.1.1 Jun 26, 2019
0.1.0 Jun 23, 2019

#6 in #cmark

MIT license

1MB
30K SLoC

C 21K SLoC // 0.0% comments Bitbake 6.5K SLoC // 0.0% comments Python 1K SLoC // 0.3% comments OCaml 381 SLoC XSL 284 SLoC // 0.1% comments Racket 170 SLoC // 0.1% comments Rust 138 SLoC Perl 20 SLoC C++ 11 SLoC Ruby 10 SLoC Batch 8 SLoC JavaScript 2 SLoC

Simple cmark-gfm Rust wrapper

This crates has been developed to cover only the main functions of cmark-gfm. Feel free to propose PR!

Example

extern crate cmark_gfm;

use cmark_gfm::{Options, Parser, Render};

fn main() {
    let text = &"# Hello world";

    let mut options = Options::empty();
    options.insert(Options::CMARK_OPT_FOOTNOTES);

    let parser = Parser::new(options);

    let extensions = &["table", "strikethrough", "autolink", "tasklist"];
    for extension in extensions {
        parser.add_extension(extension).unwrap();
    }

    parser.parse(text);
    let result = Render::to_html(&parser);

    println!("Output : {}", result);
}

License

MIT

Dependencies

~0–2.4MB
~47K SLoC