~matthiasbeyer/imag

366ca62eb9c25cdbf12a2be807b645203b772acd — Matthias Beyer 3 years ago d1ce518
Update dependency: mdcat: 0.8 -> 0.11
2 files changed, 11 insertions(+), 12 deletions(-)

M lib/entry/libimagentryview/Cargo.toml
M lib/entry/libimagentryview/src/builtin/md.rs
M lib/entry/libimagentryview/Cargo.toml => lib/entry/libimagentryview/Cargo.toml +1 -1
@@ 30,7 30,7 @@ libimagstore     = { version = "0.9.0", path = "../../../lib/core/libimagstore" 
libimagerror     = { version = "0.9.0", path = "../../../lib/core/libimagerror" }
libimagentryedit = { version = "0.9.0", path = "../../../lib/entry/libimagentryedit" }

mdcat   = { version = "0.8", optional = true }
mdcat   = { version = "0.11", optional = true }

[dependencies.pulldown-cmark]
version          = "^0.1"

M lib/entry/libimagentryview/src/builtin/md.rs => lib/entry/libimagentryview/src/builtin/md.rs +10 -11
@@ 22,10 22,9 @@ use std::io::Write;
use libimagstore::store::Entry;
use libimagrt::runtime::Runtime;

use mdcat::{ResourceAccess, Terminal, TerminalSize};
use mdcat::{AnsiTerminal, ResourceAccess, TerminalSize};
use pulldown_cmark::Parser;
use syntect::parsing::SyntaxSet;
use mdcat;

use viewer::Viewer;
use failure::Fallible as Result;


@@ 34,7 33,6 @@ use failure::Error;
pub struct MarkdownViewer<'a> {
    rt:                 &'a Runtime<'a>,
    resource_access:    ResourceAccess,
    terminal:           Terminal,
    termsize:           TerminalSize,
}



@@ 43,7 41,6 @@ impl<'a> MarkdownViewer<'a> {
        MarkdownViewer {
            rt,
            resource_access: ResourceAccess::LocalOnly,
            terminal:        Terminal::detect(),
            termsize:        TerminalSize::detect().unwrap_or(TerminalSize {
                width: 80,
                height: 20,


@@ 60,13 57,15 @@ impl<'a> Viewer for MarkdownViewer<'a> {
        let base_dir        = self.rt.rtp();
        let syntax_set      = SyntaxSet::load_defaults_newlines();

        mdcat::push_tty(sink,
                        self.terminal.clone(),
                        self.termsize.clone(),
                        parser,
                        base_dir,
                        self.resource_access.clone(),
                        syntax_set)
        let mut term = AnsiTerminal::new(sink);

        ::mdcat::push_tty(&mut term,
                          self.termsize.clone(),
                          parser,
                          base_dir,
                          self.resource_access.clone(),
                          syntax_set)
        .map_err(|e| e.compat())
        .map_err(Error::from)
    }
}