summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-03-24 13:41:11 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-03-24 23:20:03 +0100
commitc402742b245c504bee7b10175c8bff32b958e35e (patch)
treea4a1a434001cf7baabdf81b6932e1a32d5869727
parent9d543a5a2e48c14f502a0e89c9e7d690bce6b45e (diff)
Update mdcat 0.13.0 -> 0.15.0
Make version restriction for syntect less strict, as mdcat pins it to a certain version, and we only need it to actually invoke mdcat itself. So no problem with that lax requirement. Because mdcat updated its version of pulldown-cmark, we have to update here as well. We also had to adapt our error handling, because mdcat chooses to return a Box<dyn Error>, which is absolutely garbage for us here. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--lib/entry/libimagentryview/Cargo.toml6
-rw-r--r--lib/entry/libimagentryview/src/builtin/md.rs7
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/entry/libimagentryview/Cargo.toml b/lib/entry/libimagentryview/Cargo.toml
index 280eb13f..8b924cef 100644
--- a/lib/entry/libimagentryview/Cargo.toml
+++ b/lib/entry/libimagentryview/Cargo.toml
@@ -30,16 +30,16 @@ libimagstore = { version = "0.10.0", path = "../../../lib/core/libimagstore"
libimagerror = { version = "0.10.0", path = "../../../lib/core/libimagerror" }
libimagentryedit = { version = "0.10.0", path = "../../../lib/entry/libimagentryedit" }
-mdcat = { version = "0.13.0", optional = true }
+mdcat = { version = "0.15.0", optional = true }
[dependencies.pulldown-cmark]
-version = "^0.4"
+version = "^0.7"
optional = true
default-features = false
features = []
[dependencies.syntect]
-version = "3.2.0"
+version = "3"
optional = true
default-features = false
features = ["parsing", "assets", "dump-load"]
diff --git a/lib/entry/libimagentryview/src/builtin/md.rs b/lib/entry/libimagentryview/src/builtin/md.rs
index 065ca28d..b4bd13c6 100644
--- a/lib/entry/libimagentryview/src/builtin/md.rs
+++ b/lib/entry/libimagentryview/src/builtin/md.rs
@@ -26,7 +26,7 @@ use mdcat::{ResourceAccess, TerminalCapabilities, TerminalSize};
use pulldown_cmark::Parser;
use syntect::parsing::SyntaxSet;
use anyhow::Result;
-use anyhow::Error;
+use anyhow::format_err;
use crate::viewer::Viewer;
@@ -56,15 +56,16 @@ impl<'a> Viewer for MarkdownViewer<'a> {
let parser = Parser::new(e.get_content());
let base_dir = self.rt.rtp();
let syntax_set = SyntaxSet::load_defaults_newlines();
+ let capa = TerminalCapabilities::ansi();
::mdcat::push_tty(sink,
- TerminalCapabilities::ansi(),
+ &capa,
self.termsize,
parser,
base_dir,
self.resource_access,
syntax_set)
- .map_err(|e| Error::from(e.compat()))
+ .map_err(|_| format_err!("Failed while formatting markdown"))
}
}