Struct prettify_cmark::PrettyPrinter [] [src]

pub struct PrettyPrinter<W = String> { /* fields omitted */ }

Event-driven pretty printer for CommonMark documents.

The printer can be driven by pushing events into it, which can be obtained using pulldown_cmark::Parser.

Examples

extern crate pulldown_cmark;
extern crate prettify_cmark;

use pulldown_cmark::Parser;
use prettify_cmark::PrettyPrinter;

fn main() {
    let events = Parser::new("Lorem _ipsum_!\n\nDolor `sit`.");
    let mut printer = PrettyPrinter::new_with_prefix(String::new(), "///");
    printer.push_events(events).unwrap();

    assert_eq!(printer.into_inner(), "/// Lorem *ipsum*!\n///\n/// Dolor `sit`.")
}

Methods

impl<W: Write> PrettyPrinter<W>
[src]

[src]

Create a new pretty printer that wraps around a writer.

[src]

Create a new pretty printer with a prefix that wraps around a writer.

The prefix will be applied to all lines that are produced by the printer.

[src]

Push a single event into the printer.

Events can be obtained using pulldown_cmark::Parser.

[src]

Push a series of events into the printer.

Events can be obtained using pulldown_cmark::Parser.

[src]

Unwrap the printer, returning the underlying writer.

Trait Implementations

impl Default for PrettyPrinter
[src]

[src]

Returns the "default value" for a type. Read more