~matthiasbeyer/imag

c402742b245c504bee7b10175c8bff32b958e35e — Matthias Beyer 1 year, 23 days ago 9d543a5
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>
2 files changed, 7 insertions(+), 6 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 +3 -3
@@ 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"]

M lib/entry/libimagentryview/src/builtin/md.rs => lib/entry/libimagentryview/src/builtin/md.rs +4 -3
@@ 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"))
    }
}