Update dependency: mdcat: 0.8 -> 0.11
This commit is contained in:
parent
d1ce5188ee
commit
366ca62eb9
2 changed files with 11 additions and 12 deletions
|
@ -30,7 +30,7 @@ libimagstore = { version = "0.9.0", path = "../../../lib/core/libimagstore"
|
||||||
libimagerror = { version = "0.9.0", path = "../../../lib/core/libimagerror" }
|
libimagerror = { version = "0.9.0", path = "../../../lib/core/libimagerror" }
|
||||||
libimagentryedit = { version = "0.9.0", path = "../../../lib/entry/libimagentryedit" }
|
libimagentryedit = { version = "0.9.0", path = "../../../lib/entry/libimagentryedit" }
|
||||||
|
|
||||||
mdcat = { version = "0.8", optional = true }
|
mdcat = { version = "0.11", optional = true }
|
||||||
|
|
||||||
[dependencies.pulldown-cmark]
|
[dependencies.pulldown-cmark]
|
||||||
version = "^0.1"
|
version = "^0.1"
|
||||||
|
|
|
@ -22,10 +22,9 @@ use std::io::Write;
|
||||||
use libimagstore::store::Entry;
|
use libimagstore::store::Entry;
|
||||||
use libimagrt::runtime::Runtime;
|
use libimagrt::runtime::Runtime;
|
||||||
|
|
||||||
use mdcat::{ResourceAccess, Terminal, TerminalSize};
|
use mdcat::{AnsiTerminal, ResourceAccess, TerminalSize};
|
||||||
use pulldown_cmark::Parser;
|
use pulldown_cmark::Parser;
|
||||||
use syntect::parsing::SyntaxSet;
|
use syntect::parsing::SyntaxSet;
|
||||||
use mdcat;
|
|
||||||
|
|
||||||
use viewer::Viewer;
|
use viewer::Viewer;
|
||||||
use failure::Fallible as Result;
|
use failure::Fallible as Result;
|
||||||
|
@ -34,7 +33,6 @@ use failure::Error;
|
||||||
pub struct MarkdownViewer<'a> {
|
pub struct MarkdownViewer<'a> {
|
||||||
rt: &'a Runtime<'a>,
|
rt: &'a Runtime<'a>,
|
||||||
resource_access: ResourceAccess,
|
resource_access: ResourceAccess,
|
||||||
terminal: Terminal,
|
|
||||||
termsize: TerminalSize,
|
termsize: TerminalSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +41,6 @@ impl<'a> MarkdownViewer<'a> {
|
||||||
MarkdownViewer {
|
MarkdownViewer {
|
||||||
rt,
|
rt,
|
||||||
resource_access: ResourceAccess::LocalOnly,
|
resource_access: ResourceAccess::LocalOnly,
|
||||||
terminal: Terminal::detect(),
|
|
||||||
termsize: TerminalSize::detect().unwrap_or(TerminalSize {
|
termsize: TerminalSize::detect().unwrap_or(TerminalSize {
|
||||||
width: 80,
|
width: 80,
|
||||||
height: 20,
|
height: 20,
|
||||||
|
@ -60,13 +57,15 @@ impl<'a> Viewer for MarkdownViewer<'a> {
|
||||||
let base_dir = self.rt.rtp();
|
let base_dir = self.rt.rtp();
|
||||||
let syntax_set = SyntaxSet::load_defaults_newlines();
|
let syntax_set = SyntaxSet::load_defaults_newlines();
|
||||||
|
|
||||||
mdcat::push_tty(sink,
|
let mut term = AnsiTerminal::new(sink);
|
||||||
self.terminal.clone(),
|
|
||||||
self.termsize.clone(),
|
::mdcat::push_tty(&mut term,
|
||||||
parser,
|
self.termsize.clone(),
|
||||||
base_dir,
|
parser,
|
||||||
self.resource_access.clone(),
|
base_dir,
|
||||||
syntax_set)
|
self.resource_access.clone(),
|
||||||
|
syntax_set)
|
||||||
|
.map_err(|e| e.compat())
|
||||||
.map_err(Error::from)
|
.map_err(Error::from)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue