Skip to main content

ito_core/viewer/
glow.rs

1use crate::errors::CoreResult;
2
3use super::ViewerBackend;
4use super::util::run_with_stdin;
5
6/// Render markdown via `glow`.
7pub struct GlowViewer;
8
9impl ViewerBackend for GlowViewer {
10    fn name(&self) -> &str {
11        "glow"
12    }
13
14    fn description(&self) -> &str {
15        "Render the proposal in the terminal with glow"
16    }
17
18    fn is_available(&self) -> bool {
19        super::util::command_on_path("glow")
20    }
21
22    fn open(&self, content: &str) -> CoreResult<()> {
23        run_with_stdin("glow", &["-"], content)
24    }
25}